From d0f669c08e5c5c41ab3cea0fa071bd1072a589cf Mon Sep 17 00:00:00 2001 From: mlodhi Date: Sat, 2 Mar 2024 13:24:29 +0000 Subject: [PATCH 1/2] Correctly setup pkg config file --- src/CMakeLists.txt | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 749a75d..ca77256 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -23,7 +23,7 @@ set(SOURCES tools/TraversabilityGrassfire.cpp ) -add_library(${PROJECT_NAME} ${SOURCES}) +add_library(${PROJECT_NAME} SHARED ${SOURCES}) target_link_libraries(${PROJECT_NAME} PUBLIC PkgConfig::DEPS @@ -33,8 +33,7 @@ target_link_libraries(${PROJECT_NAME} ${PCL_IO_LIBRARIES} ) -target_include_directories(${PROJECT_NAME} - PUBLIC +target_include_directories(${PROJECT_NAME} PUBLIC $ $ ${PCL_INCLUDE_DIRS} @@ -57,13 +56,22 @@ install (TARGETS RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) -set(PKGCONFIG_CFLAGS) -set(PKGCONFIG_REQUIRES - base-types - base-logging - boost_serialization - pcl_io-${PCL_VERSION_MAJOR}.${PCL_VERSION_MINOR} +set(PKG_CONFIG_DEPS + base-types + base-logging + boost_serialization + pcl_io-${PCL_VERSION_MAJOR}.${PCL_VERSION_MINOR} ) + +set(pkg_config_dependencies "") + +foreach(value ${PKG_CONFIG_DEPS}) + set(pkg_config_dependencies "${pkg_config_dependencies} ${value}") +endforeach() + +set(PKGCONFIG_REQUIRES ${pkg_config_dependencies}) +set(PKGCONFIG_CFLAGS) + configure_file(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc From ecbc520c558a8b388c00c2cf6ffc51850b3a0e26 Mon Sep 17 00:00:00 2001 From: mlodhi Date: Mon, 4 Mar 2024 08:30:49 +0000 Subject: [PATCH 2/2] Simplify pkg config file setup --- src/CMakeLists.txt | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ca77256..7e8d98b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -63,14 +63,8 @@ set(PKG_CONFIG_DEPS pcl_io-${PCL_VERSION_MAJOR}.${PCL_VERSION_MINOR} ) -set(pkg_config_dependencies "") - -foreach(value ${PKG_CONFIG_DEPS}) - set(pkg_config_dependencies "${pkg_config_dependencies} ${value}") -endforeach() - -set(PKGCONFIG_REQUIRES ${pkg_config_dependencies}) set(PKGCONFIG_CFLAGS) +list(JOIN PKG_CONFIG_DEPS " " PKGCONFIG_REQUIRES) configure_file(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY) install(FILES