Skip to content

Commit

Permalink
Move real library only commands under else case.
Browse files Browse the repository at this point in the history
  • Loading branch information
= committed Jan 15, 2024
1 parent a721399 commit a420273
Showing 1 changed file with 21 additions and 17 deletions.
38 changes: 21 additions & 17 deletions cmake/pcl_targets.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ macro(PCL_ADD_INCLUDES _component _subdir)
COMPONENT pcl_${_component})
endmacro()


###############################################################################
# Add a library target.
# _name The library name.
Expand All @@ -192,32 +193,35 @@ function(PCL_ADD_LIBRARY _name)
message(FATAL_ERROR "PCL_ADD_LIBRARY requires parameter COMPONENT.")
endif()

PCL_ADD_VERSION_INFO(${_name})

if(NOT ARGS_SOURCES)
add_library(${_name} INTERFACE)
else()
add_library(${_name} ${PCL_LIB_TYPE} ${ARGS_SOURCES})
endif()

PCL_ADD_VERSION_INFO(${_name})
target_compile_features(${_name} PUBLIC ${PCL_CXX_COMPILE_FEATURES})

target_link_libraries(${_name} Threads::Threads)
if(TARGET OpenMP::OpenMP_CXX)
target_link_libraries(${_name} OpenMP::OpenMP_CXX)
endif()
target_compile_features(${_name} PUBLIC ${PCL_CXX_COMPILE_FEATURES})

if((UNIX AND NOT ANDROID) OR MINGW)
target_link_libraries(${_name} m ${ATOMIC_LIBRARY})
endif()
target_link_libraries(${_name} Threads::Threads)

if(MINGW)
target_link_libraries(${_name} gomp)
endif()
if(TARGET OpenMP::OpenMP_CXX)
target_link_libraries(${_name} OpenMP::OpenMP_CXX)
endif()

if(MSVC)
target_link_libraries(${_name} delayimp.lib) # because delay load is enabled for openmp.dll
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(MSVC)
target_link_libraries(${_name} delayimp.lib) # because delay load is enabled for openmp.dll
endif()

endif()

set_target_properties(${_name} PROPERTIES
VERSION ${PCL_VERSION}
SOVERSION ${PCL_VERSION_MAJOR}.${PCL_VERSION_MINOR}
Expand Down

0 comments on commit a420273

Please sign in to comment.