diff --git a/2d/CMakeLists.txt b/2d/CMakeLists.txt index 457aae7dbcf..f2656b2f475 100644 --- a/2d/CMakeLists.txt +++ b/2d/CMakeLists.txt @@ -30,6 +30,7 @@ set(impl_incs ) set(LIB_NAME "pcl_${SUBSYS_NAME}") +PCL_ADD_LIBRARY(${LIB_NAME} COMPONENT ${SUBSYS_NAME}) PCL_MAKE_PKGCONFIG(${LIB_NAME} COMPONENT ${SUBSYS_NAME} DESC ${SUBSYS_DESC} PCL_DEPS ${SUBSYS_DEPS} HEADER_ONLY) #Install include files diff --git a/cmake/pcl_targets.cmake b/cmake/pcl_targets.cmake index f3ca56d1c54..c8cdbcb1c76 100644 --- a/cmake/pcl_targets.cmake +++ b/cmake/pcl_targets.cmake @@ -192,38 +192,49 @@ function(PCL_ADD_LIBRARY _name) message(FATAL_ERROR "PCL_ADD_LIBRARY requires parameter COMPONENT.") endif() - add_library(${_name} ${PCL_LIB_TYPE} ${ARGS_SOURCES}) - PCL_ADD_VERSION_INFO(${_name}) - target_compile_features(${_name} PUBLIC ${PCL_CXX_COMPILE_FEATURES}) + if(NOT ARGS_SOURCES) + add_library(${_name} INTERFACE) + + target_include_directories(${_name} INTERFACE + $ + $ + ) - target_include_directories(${_name} PUBLIC - $ - $ - ) + else() + add_library(${_name} ${PCL_LIB_TYPE} ${ARGS_SOURCES}) + PCL_ADD_VERSION_INFO(${_name}) + target_compile_features(${_name} PUBLIC ${PCL_CXX_COMPILE_FEATURES}) + + target_include_directories(${_name} PUBLIC + $ + $ + ) + + target_link_libraries(${_name} Threads::Threads) + if(TARGET OpenMP::OpenMP_CXX) + target_link_libraries(${_name} OpenMP::OpenMP_CXX) + endif() - target_link_libraries(${_name} Threads::Threads) - if(TARGET OpenMP::OpenMP_CXX) - target_link_libraries(${_name} OpenMP::OpenMP_CXX) - endif() + if((UNIX AND NOT ANDROID) OR MINGW) + target_link_libraries(${_name} m ${ATOMIC_LIBRARY}) + endif() - if((UNIX AND NOT ANDROID) OR MINGW) - target_link_libraries(${_name} m ${ATOMIC_LIBRARY}) - endif() + if(MINGW) + target_link_libraries(${_name} gomp) + endif() - if(MINGW) - target_link_libraries(${_name} gomp) - endif() + if(MSVC) + target_link_libraries(${_name} delayimp.lib) # because delay load is enabled for openmp.dll + endif() + + set_target_properties(${_name} PROPERTIES + VERSION ${PCL_VERSION} + SOVERSION ${PCL_VERSION_MAJOR}.${PCL_VERSION_MINOR} + DEFINE_SYMBOL "PCLAPI_EXPORTS") - if(MSVC) - target_link_libraries(${_name} delayimp.lib) # because delay load is enabled for openmp.dll + set_target_properties(${_name} PROPERTIES FOLDER "Libraries") endif() - set_target_properties(${_name} PROPERTIES - VERSION ${PCL_VERSION} - SOVERSION ${PCL_VERSION_MAJOR}.${PCL_VERSION_MINOR} - DEFINE_SYMBOL "PCLAPI_EXPORTS") - set_target_properties(${_name} PROPERTIES FOLDER "Libraries") - install(TARGETS ${_name} RUNTIME DESTINATION ${BIN_INSTALL_DIR} COMPONENT pcl_${ARGS_COMPONENT} LIBRARY DESTINATION ${LIB_INSTALL_DIR} COMPONENT pcl_${ARGS_COMPONENT} diff --git a/geometry/CMakeLists.txt b/geometry/CMakeLists.txt index 2e0a9ee58b8..54929f709b9 100644 --- a/geometry/CMakeLists.txt +++ b/geometry/CMakeLists.txt @@ -37,8 +37,7 @@ set(impl_incs set(LIB_NAME "pcl_${SUBSYS_NAME}") - -add_library(${LIB_NAME} INTERFACE) +PCL_ADD_LIBRARY(${LIB_NAME} COMPONENT ${SUBSYS_NAME}) target_link_libraries(${LIB_NAME} INTERFACE Boost::boost pcl_common) PCL_MAKE_PKGCONFIG(${LIB_NAME} COMPONENT ${SUBSYS_NAME} DESC ${SUBSYS_DESC} PCL_DEPS ${SUBSYS_DEPS} HEADER_ONLY)