@@ -192,32 +192,48 @@ function(PCL_ADD_LIBRARY _name)
192192 message (FATAL_ERROR "PCL_ADD_LIBRARY requires parameter COMPONENT." )
193193 endif ()
194194
195- add_library (${_name} ${PCL_LIB_TYPE} ${ARGS_SOURCES} )
196- PCL_ADD_VERSION_INFO (${_name} )
197- target_compile_features (${_name} PUBLIC ${PCL_CXX_COMPILE_FEATURES} )
195+ if (NOT ARGS_SOURCES)
196+ add_library (${_name} INTERFACE )
197+
198+ target_include_directories (${_name} INTERFACE
199+ $<BUILD_INTERFACE :${CMAKE_CURRENT_SOURCE_DIR } /include >
200+ $<INSTALL_INTERFACE :${INCLUDE_INSTALL_ROOT} >
201+ )
198202
199- target_link_libraries (${_name} Threads::Threads )
200- if (TARGET OpenMP::OpenMP_CXX)
201- target_link_libraries (${_name} OpenMP::OpenMP_CXX )
202- endif ()
203+ else ()
204+ add_library (${_name} ${PCL_LIB_TYPE} ${ARGS_SOURCES} )
205+ PCL_ADD_VERSION_INFO (${_name} )
206+ target_compile_features (${_name} PUBLIC ${PCL_CXX_COMPILE_FEATURES} )
207+
208+ target_include_directories (${_name} PUBLIC
209+ $<BUILD_INTERFACE :${CMAKE_CURRENT_SOURCE_DIR } /include >
210+ $<INSTALL_INTERFACE :${INCLUDE_INSTALL_ROOT} >
211+ )
212+
213+ target_link_libraries (${_name} Threads::Threads )
214+ if (TARGET OpenMP::OpenMP_CXX)
215+ target_link_libraries (${_name} OpenMP::OpenMP_CXX )
216+ endif ()
203217
204- if ((UNIX AND NOT ANDROID ) OR MINGW)
205- target_link_libraries (${_name} m ${ATOMIC_LIBRARY} )
206- endif ()
218+ if ((UNIX AND NOT ANDROID ) OR MINGW)
219+ target_link_libraries (${_name} m ${ATOMIC_LIBRARY} )
220+ endif ()
207221
208- if (MINGW)
209- target_link_libraries (${_name} gomp )
210- endif ()
222+ if (MINGW)
223+ target_link_libraries (${_name} gomp )
224+ endif ()
211225
212- if (MSVC )
213- target_link_libraries (${_name} delayimp.lib ) # because delay load is enabled for openmp.dll
214- endif ()
226+ if (MSVC )
227+ target_link_libraries (${_name} delayimp.lib ) # because delay load is enabled for openmp.dll
228+ endif ()
229+
230+ set_target_properties (${_name} PROPERTIES
231+ VERSION ${PCL_VERSION}
232+ SOVERSION ${PCL_VERSION_MAJOR} .${PCL_VERSION_MINOR}
233+ DEFINE_SYMBOL "PCLAPI_EXPORTS" )
215234
216- set_target_properties (${_name} PROPERTIES
217- VERSION ${PCL_VERSION}
218- SOVERSION ${PCL_VERSION_MAJOR} .${PCL_VERSION_MINOR}
219- DEFINE_SYMBOL "PCLAPI_EXPORTS" )
220- set_target_properties (${_name} PROPERTIES FOLDER "Libraries" )
235+ set_target_properties (${_name} PROPERTIES FOLDER "Libraries" )
236+ endif ()
221237
222238 install (TARGETS ${_name}
223239 RUNTIME DESTINATION ${BIN_INSTALL_DIR} COMPONENT pcl_${ARGS_COMPONENT}
@@ -257,6 +273,11 @@ function(PCL_CUDA_ADD_LIBRARY _name)
257273
258274 target_compile_options (${_name} PRIVATE $<$<COMPILE_LANGUAGE :CUDA >: ${GEN_CODE} --expt -relaxed -constexpr >)
259275
276+ target_include_directories (${_name} PUBLIC
277+ $<BUILD_INTERFACE :${CMAKE_CURRENT_SOURCE_DIR } /include >
278+ $<INSTALL_INTERFACE :${INCLUDE_INSTALL_ROOT} >
279+ )
280+
260281 target_include_directories (${_name} PRIVATE ${CUDA_TOOLKIT_INCLUDE} )
261282
262283 if (MSVC )
0 commit comments