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.
This commit is contained in:
Sam Edwards 2019-08-29 23:09:28 -06:00
parent cde25670d6
commit a42f1a49a4

View File

@ -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)