From: Matthias Maier Date: Thu, 12 Jan 2017 16:34:42 +0000 (-0600) Subject: CMake: Rename all object targets to obj__(debug|release) X-Git-Tag: v8.5.0-rc1~250^2~5 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aefdb5af5dc6cb92cf1424b61365842c960698d6;p=dealii.git CMake: Rename all object targets to obj__(debug|release) This change is necessary to please the cuda wrapper nvcc that insists on exporting the target name as preprocessor definition. Unfortunately, a period "." is an invalid character and we end up with warnings of the form "missing whitespace after the macro name" Fix this by renaming all object targets to only contain underscores. --- diff --git a/cmake/macros/macro_deal_ii_add_library.cmake b/cmake/macros/macro_deal_ii_add_library.cmake index 643536f2bf..0fc796796d 100644 --- a/cmake/macros/macro_deal_ii_add_library.cmake +++ b/cmake/macros/macro_deal_ii_add_library.cmake @@ -33,7 +33,7 @@ MACRO(DEAL_II_ADD_LIBRARY _library) FOREACH(_build ${DEAL_II_BUILD_TYPES}) STRING(TOLOWER ${_build} _build_lowercase) - ADD_LIBRARY(${_library}.${_build_lowercase} + ADD_LIBRARY(${_library}_${_build_lowercase} ${ARGN} ) @@ -47,7 +47,7 @@ MACRO(DEAL_II_ADD_LIBRARY _library) ${DEAL_II_DEFINITIONS_${_build}} ) - SET_TARGET_PROPERTIES(${_library}.${_build_lowercase} PROPERTIES + SET_TARGET_PROPERTIES(${_library}_${_build_lowercase} PROPERTIES LINK_FLAGS "${DEAL_II_LINKER_FLAGS} ${DEAL_II_LINKER_FLAGS_${_build}}" COMPILE_DEFINITIONS "${_definitions}" COMPILE_FLAGS "${DEAL_II_CXX_FLAGS} ${DEAL_II_CXX_FLAGS_${_build}}" @@ -55,23 +55,23 @@ MACRO(DEAL_II_ADD_LIBRARY _library) ) SET_PROPERTY(GLOBAL APPEND PROPERTY DEAL_II_OBJECTS_${_build} - "$" + "$" ) # # Cuda specific target setup: # IF(DEAL_II_WITH_CUDA) - CUDA_WRAP_SRCS(${_library}.${_build_lowercase} + CUDA_WRAP_SRCS(${_library}_${_build_lowercase} OBJ _generated_cuda_files ${ARGN} SHARED ) - ADD_CUSTOM_TARGET(${_library}.${_build_lowercase}_cuda + ADD_CUSTOM_TARGET(${_library}_${_build_lowercase}_cuda DEPENDS ${_generated_cuda_files} ) - ADD_DEPENDENCIES(${_library}.${_build_lowercase} - ${_library}.${_build_lowercase}_cuda + ADD_DEPENDENCIES(${_library}_${_build_lowercase} + ${_library}_${_build_lowercase}_cuda ) SET_PROPERTY(GLOBAL APPEND PROPERTY DEAL_II_OBJECTS_${_build} diff --git a/cmake/macros/macro_expand_instantiations.cmake b/cmake/macros/macro_expand_instantiations.cmake index 02ec5019b1..9877a00389 100644 --- a/cmake/macros/macro_expand_instantiations.cmake +++ b/cmake/macros/macro_expand_instantiations.cmake @@ -23,7 +23,7 @@ # # target # -# where target.${build_type} (and if present) target.${build_type}_cuda +# where target_${build_type} (and if present) target_${build_type}_cuda # will depend on the generation of all .inst files, to ensure that all # .inst files are generated prior to compiling. # @@ -70,7 +70,7 @@ MACRO(EXPAND_INSTANTIATIONS _target _inst_in_files) # Define a custom target that depends on the generation of all inst.in # files. # - ADD_CUSTOM_TARGET(${_target}.inst ALL DEPENDS ${_inst_targets}) + ADD_CUSTOM_TARGET(${_target}_inst ALL DEPENDS ${_inst_targets}) # # Add a dependency to all target.${build_type} so that target.inst is @@ -79,11 +79,12 @@ MACRO(EXPAND_INSTANTIATIONS _target _inst_in_files) FOREACH(_build ${DEAL_II_BUILD_TYPES}) STRING(TOLOWER ${_build} _build_lowercase) - ADD_DEPENDENCIES(${_target}.${_build_lowercase} ${_target}.inst) + ADD_DEPENDENCIES(${_target}_${_build_lowercase} ${_target}_inst) - IF(TARGET ${_target}.${_build_lowercase}_cuda) - ADD_DEPENDENCIES(${_target}.${_build_lowercase}_cuda ${_target}.inst) + IF(TARGET ${_target}_${_build_lowercase}_cuda) + ADD_DEPENDENCIES(${_target}_${_build_lowercase}_cuda ${_target}_inst) ENDIF() + ENDFOREACH() ENDMACRO()