@@ -192,38 +192,49 @@ 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_include_directories (${_name} PUBLIC
200- $<BUILD_INTERFACE :${CMAKE_CURRENT_SOURCE_DIR } /include >
201- $<INSTALL_INTERFACE :${INCLUDE_INSTALL_ROOT} >
202- )
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- target_link_libraries (${_name} Threads::Threads )
205- if (TARGET OpenMP::OpenMP_CXX)
206- target_link_libraries (${_name} OpenMP::OpenMP_CXX )
207- endif ()
218+ if ((UNIX AND NOT ANDROID ) OR MINGW)
219+ target_link_libraries (${_name} m ${ATOMIC_LIBRARY} )
220+ endif ()
208221
209- if (( UNIX AND NOT ANDROID ) OR MINGW)
210- target_link_libraries (${_name} m ${ATOMIC_LIBRARY} )
211- endif ()
222+ if ( MINGW)
223+ target_link_libraries (${_name} gomp )
224+ endif ()
212225
213- if (MINGW)
214- target_link_libraries (${_name} gomp )
215- 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" )
216234
217- if (MSVC )
218- target_link_libraries (${_name} delayimp.lib ) # because delay load is enabled for openmp.dll
235+ set_target_properties (${_name} PROPERTIES FOLDER "Libraries" )
219236 endif ()
220237
221- set_target_properties (${_name} PROPERTIES
222- VERSION ${PCL_VERSION}
223- SOVERSION ${PCL_VERSION_MAJOR} .${PCL_VERSION_MINOR}
224- DEFINE_SYMBOL "PCLAPI_EXPORTS" )
225- set_target_properties (${_name} PROPERTIES FOLDER "Libraries" )
226-
227238 install (TARGETS ${_name}
228239 RUNTIME DESTINATION ${BIN_INSTALL_DIR} COMPONENT pcl_${ARGS_COMPONENT}
229240 LIBRARY DESTINATION ${LIB_INSTALL_DIR} COMPONENT pcl_${ARGS_COMPONENT}
0 commit comments