Bläddra i källkod

CMake: Interrogate needs -DNDEBUG when -DNDEBUG is passed as a flag

Some buildsystems (Gentoo's Portage, to be specific) are very
roughshod about how they use CMake, and might bypass the
"configuration types" system altogether, passing their own release
flags instead. This change detects that and ensures that Interrogate
picks up the NDEBUG flag when it's specified manually.
Sam Edwards 6 år sedan
förälder
incheckning
a42f1a49a4
1 ändrade filer med 5 tillägg och 0 borttagningar
  1. 5 0
      cmake/macros/Interrogate.cmake

+ 5 - 0
cmake/macros/Interrogate.cmake

@@ -228,6 +228,11 @@ function(interrogate_sources target output database language_flags)
     endif()
     endif()
   endforeach(build_type)
   endforeach(build_type)
 
 
+  # In case the user (or a distro buildsystem) is throwing NDEBUG in by hand:
+  if(CMAKE_CXX_FLAGS MATCHES ".*NDEBUG.*")
+    list(APPEND define_flags "-DNDEBUG")
+  endif()
+
   get_filename_component(output_directory "${output}" DIRECTORY)
   get_filename_component(output_directory "${output}" DIRECTORY)
   get_filename_component(database_directory "${database}" DIRECTORY)
   get_filename_component(database_directory "${database}" DIRECTORY)