Skip to content

Commit bdd8ae4

Browse files
committed
Avoid generator expression for easier reading.
Remember to add defines for CUDA libraries. Only add export flags, if they should be exported. If not the would default to import (cloud composer plugins).
1 parent b1817f5 commit bdd8ae4

1 file changed

Lines changed: 19 additions & 11 deletions

File tree

cmake/pcl_targets.cmake

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -228,13 +228,13 @@ function(PCL_ADD_LIBRARY _name)
228228
endif()
229229

230230
if(ARGS_EXPORT_SYMBOLS)
231-
set_target_properties(${_name} PROPERTIES
232-
DEFINE_SYMBOL "PCLAPI_EXPORTS")
231+
if(PCL_SHARED_LIBS)
232+
target_compile_definitions(${_name} PRIVATE PCLAPI_EXPORTS)
233+
else()
234+
target_compile_definitions(${_name} PRIVATE PCL_STATIC_DEFINE)
235+
endif()
233236
endif()
234237

235-
target_compile_definitions(
236-
${_name} PUBLIC "$<IF:$<BOOL:${PCL_SHARED_LIBS}>,PCLAPI_EXPORTS,PCL_STATIC_DEFINE>")
237-
238238
set_target_properties(${_name} PROPERTIES
239239
VERSION ${PCL_VERSION}
240240
SOVERSION ${PCL_VERSION_MAJOR}.${PCL_VERSION_MINOR})
@@ -260,7 +260,7 @@ endfunction()
260260
# SOURCES The source files for the library.
261261
function(PCL_CUDA_ADD_LIBRARY _name)
262262
set(options)
263-
set(oneValueArgs COMPONENT)
263+
set(oneValueArgs COMPONENT EXPORT_SYMBOLS)
264264
set(multiValueArgs SOURCES INCLUDES)
265265
cmake_parse_arguments(ARGS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
266266

@@ -304,11 +304,19 @@ function(PCL_CUDA_ADD_LIBRARY _name)
304304
if(MSVC)
305305
target_link_libraries(${_name} delayimp.lib) # because delay load is enabled for openmp.dll
306306
endif()
307-
308-
set_target_properties(${_name} PROPERTIES
309-
VERSION ${PCL_VERSION}
310-
SOVERSION ${PCL_VERSION_MAJOR}.${PCL_VERSION_MINOR}
311-
DEFINE_SYMBOL "PCLAPI_EXPORTS")
307+
308+
if(NOT DEFINED ARGS_EXPORT_SYMBOLS)
309+
set(ARGS_EXPORT_SYMBOLS TRUE)
310+
endif()
311+
312+
if(ARGS_EXPORT_SYMBOLS)
313+
if(PCL_SHARED_LIBS)
314+
target_compile_definitions(${_name} PRIVATE PCLAPI_EXPORTS)
315+
else()
316+
target_compile_definitions(${_name} PRIVATE PCL_STATIC_DEFINE)
317+
endif()
318+
endif()
319+
312320
set_target_properties(${_name} PROPERTIES FOLDER "Libraries")
313321
endif()
314322

0 commit comments

Comments
 (0)