Browse Source

CMake: Update Interrogate.cmake macro's use of COMPILE_DEFINITIONS:

- Slightly older versions of CMake default this to NOTFOUND, so test before iterating.
- Add to local definitions for building the _igate sources.
Sam Edwards 12 years ago
parent
commit
95e25af828
1 changed files with 7 additions and 3 deletions
  1. 7 3
      cmake/macros/Interrogate.cmake

+ 7 - 3
cmake/macros/Interrogate.cmake

@@ -174,9 +174,13 @@ function(interrogate_sources target output database module)
     # will preprocess each file in the same way.
     # will preprocess each file in the same way.
     set(define_flags)
     set(define_flags)
     get_target_property(target_defines "${target}" COMPILE_DEFINITIONS)
     get_target_property(target_defines "${target}" COMPILE_DEFINITIONS)
-    foreach(target_define ${target_defines})
-      list(APPEND define_flags "-D${target_define}")
-    endforeach(target_define)
+    if(target_defines)
+      foreach(target_define ${target_defines})
+        list(APPEND define_flags "-D${target_define}")
+        # And add the same definition when we compile the _igate.cxx file:
+        add_definitions("-D${target_define}")
+      endforeach(target_define)
+    endif()
     # If this is a release build that has NDEBUG defined, we need that too:
     # If this is a release build that has NDEBUG defined, we need that too:
     string(TOUPPER "${CMAKE_BUILD_TYPE}" build_type)
     string(TOUPPER "${CMAKE_BUILD_TYPE}" build_type)
     if("${CMAKE_CXX_FLAGS_${build_type}}" MATCHES ".*NDEBUG.*")
     if("${CMAKE_CXX_FLAGS_${build_type}}" MATCHES ".*NDEBUG.*")