Skip to content

Commit

Permalink
Make it possible to add header only libraries - useful when using an …
Browse files Browse the repository at this point in the history
…IDE like visual studio.
  • Loading branch information
larshg committed Nov 4, 2024
1 parent 26267bc commit 437bbbe
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion 2d/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ set(impl_incs
)

set(LIB_NAME "pcl_${SUBSYS_NAME}")
PCL_ADD_LIBRARY(${LIB_NAME} COMPONENT ${SUBSYS_NAME})
target_link_libraries(${LIB_NAME} INTERFACE pcl_filters)
PCL_ADD_LIBRARY(${LIB_NAME} COMPONENT ${SUBSYS_NAME} INCLUDES ${incs} ${impl_incs})
PCL_MAKE_PKGCONFIG(${LIB_NAME} COMPONENT ${SUBSYS_NAME} DESC ${SUBSYS_DESC} PCL_DEPS ${SUBSYS_DEPS} HEADER_ONLY)

#Install include files
Expand Down
6 changes: 3 additions & 3 deletions cmake/pcl_targets.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ endmacro()
function(PCL_ADD_LIBRARY _name)
set(options)
set(oneValueArgs COMPONENT)
set(multiValueArgs SOURCES)
set(multiValueArgs SOURCES INCLUDES)
cmake_parse_arguments(ARGS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})

if(ARGS_UNPARSED_ARGUMENTS)
Expand All @@ -184,13 +184,13 @@ function(PCL_ADD_LIBRARY _name)
endif()

if(NOT ARGS_SOURCES)
add_library(${_name} INTERFACE)
add_library(${_name} INTERFACE ${ARGS_INCLUDES})

target_include_directories(${_name} INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${INCLUDE_INSTALL_ROOT}>
)

set_target_properties(${_name} PROPERTIES FOLDER "Libraries")
else()
add_library(${_name} ${PCL_LIB_TYPE} ${ARGS_SOURCES})
PCL_ADD_VERSION_INFO(${_name})
Expand Down
3 changes: 1 addition & 2 deletions geometry/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,8 @@ set(impl_incs
"include/pcl/${SUBSYS_NAME}/impl/polygon_operations.hpp"
)


set(LIB_NAME "pcl_${SUBSYS_NAME}")
PCL_ADD_LIBRARY(${LIB_NAME} COMPONENT ${SUBSYS_NAME})
PCL_ADD_LIBRARY(${LIB_NAME} COMPONENT ${SUBSYS_NAME} INCLUDES ${incs} ${impl_incs})
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)
Expand Down

0 comments on commit 437bbbe

Please sign in to comment.