Skip to content

Commit 7a2ee31

Browse files
committed
Add pkg-config file
Signed-off-by: Nicolas Benes <nbenes.gh@xandea.de>
1 parent 8188b41 commit 7a2ee31

2 files changed

Lines changed: 37 additions & 0 deletions

File tree

fastdds.pc.in

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
prefix=@CMAKE_INSTALL_PREFIX@
2+
includedir=@includedir_for_pc_file@
3+
libdir=@libdir_for_pc_file@
4+
5+
Name: fastdds
6+
Description: C++ implementation of the DDS (Data Distribution Service) standard
7+
URL: https://github.com/eProsima/Fast-DDS
8+
Version: @PROJECT_VERSION@
9+
10+
Requires: fastcdr
11+
Requires.private: @private_requires_for_pc_file@
12+
Cflags: -I${includedir}
13+
Libs: -L${libdir} -lfastdds

src/cpp/CMakeLists.txt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,3 +391,27 @@ install(FILES ${PROJECT_BINARY_DIR}/cmake/config/${PROJECT_NAME}-config.cmake
391391
DESTINATION ${INSTALL_DESTINATION_PATH}
392392
COMPONENT cmake
393393
)
394+
395+
###############################################################################
396+
# Create pkg-config file
397+
###############################################################################
398+
cmake_path(APPEND includedir_for_pc_file "\${prefix}" "${CMAKE_INSTALL_INCLUDEDIR}")
399+
cmake_path(APPEND libdir_for_pc_file "\${prefix}" "${CMAKE_INSTALL_LIBDIR}")
400+
401+
set(private_requires_for_pc_file)
402+
if (LINK_SSL)
403+
list(APPEND private_requires_for_pc_file openssl)
404+
endif()
405+
if (TARGET tinyxml2::tinyxml2)
406+
list(APPEND private_requires_for_pc_file tinyxml2)
407+
endif()
408+
list(JOIN private_requires_for_pc_file ", " private_requires_for_pc_file)
409+
410+
configure_file(
411+
"${PROJECT_SOURCE_DIR}/fastdds.pc.in"
412+
"${PROJECT_BINARY_DIR}/fastdds.pc"
413+
@ONLY)
414+
install(FILES "${PROJECT_BINARY_DIR}/fastdds.pc"
415+
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig"
416+
COMPONENT pkgconfig
417+
)

0 commit comments

Comments
 (0)