CMake: Fix Interrogate macro not working on Windows

This was broken by 2d5bdb351557ed1ee51e4026aac26e251045c2a0,
which wrote -D flags as -D'symbol' -- this choked Windows,
so this commit turns it off in that case.

It's a shame there's no generator expression to escape quotes,
otherwise this hack wouldn't even be needed.
This commit is contained in:
Sam Edwards 2019-06-03 21:47:07 -06:00
parent 668ad6e559
commit 81f0fb78f2

View File

@ -210,7 +210,12 @@ function(interrogate_sources target output database language_flags)
# in the same way that they are passed to the compiler so that Interrogate # in the same way that they are passed to the compiler so that Interrogate
# will preprocess each file in the same way. # will preprocess each file in the same way.
set(_compile_defs "$<TARGET_PROPERTY:${target},COMPILE_DEFINITIONS>") set(_compile_defs "$<TARGET_PROPERTY:${target},COMPILE_DEFINITIONS>")
set(define_flags "$<$<BOOL:${_compile_defs}>:-D'$<JOIN:${_compile_defs},'\t-D'>'>") if(NOT CMAKE_HOST_WIN32)
# Win32's command-line parser doesn't understand "'"
# that's fine, it also ignores '"'
set(_q "'")
endif()
set(define_flags "$<$<BOOL:${_compile_defs}>:-D${_q}$<JOIN:${_compile_defs},${_q}\t-D${_q}>${_q}>")
# 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:
foreach(build_type ${CMAKE_CONFIGURATION_TYPES} ${CMAKE_BUILD_TYPE}) foreach(build_type ${CMAKE_CONFIGURATION_TYPES} ${CMAKE_BUILD_TYPE})