diff --git a/cmake/macros/Interrogate.cmake b/cmake/macros/Interrogate.cmake index 9001d05ff1..6809d8eaec 100644 --- a/cmake/macros/Interrogate.cmake +++ b/cmake/macros/Interrogate.cmake @@ -218,7 +218,10 @@ function(interrogate_sources target output database language_flags) # that's fine, it also ignores '"' set(_q "'") endif() - set(define_flags "$<$:-D${_q}$${_q}>") + set(_compile_defs_flags "-D${_q}$${_q}") + # We may have just ended up with -D'' if there are no flags; filter that + set(define_flags + "$<$>:${_compile_defs_flags}>") # Some of the definitions may be specified using -D flags in the global # CXX_FLAGS variables; parse those out (this also picks up NDEBUG)