Kaynağa Gözat

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 yıl önce
ebeveyn
işleme
a42f1a49a4
1 değiştirilmiş dosya ile 5 ekleme ve 0 silme
  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()
   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(database_directory "${database}" DIRECTORY)