]> https://gitweb.dealii.org/ - dealii.git/commitdiff
CMake: Rename all object targets to obj_<foo>_(debug|release)
authorMatthias Maier <tamiko@43-1.org>
Thu, 12 Jan 2017 16:34:42 +0000 (10:34 -0600)
committerMatthias Maier <tamiko@43-1.org>
Fri, 13 Jan 2017 09:34:44 +0000 (03:34 -0600)
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.

cmake/macros/macro_deal_ii_add_library.cmake
cmake/macros/macro_expand_instantiations.cmake

index 643536f2bf7b0432f28e7ef7cd1eb7d1f682ba81..0fc796796d8134aba4d1d673c27dbd33c76a4be4 100644 (file)
@@ -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}
-      "$<TARGET_OBJECTS:${_library}.${_build_lowercase}>"
+      "$<TARGET_OBJECTS:${_library}_${_build_lowercase}>"
       )
 
     #
     # 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}
index 02ec5019b1a5d5165f53ad3ad99c86646d0a593d..9877a00389cb6387193ff22b598a22d1f55f477c 100644 (file)
@@ -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()

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.