@@ -20,14 +20,13 @@ block()
2020 else ()
2121 set (
2222 allowedBuildTypes
23- Debug # Debug info, assertions, not optimized.
24- DebugAssertions # Custom PHP debug build type with assertions enabled
25- # in the RelWithDebInfo mode: optimized, debug info,
26- # assertions.
23+ Debug # Not optimized, debug info, assertions.
24+ DebugAssertions # Custom PHP debug build type based on RelWithDebInfo:
25+ # optimized, debug info, assertions.
2726 MinSizeRel # Same as Release but optimized for size rather than
2827 # speed.
29- Release # No debug info, no assertions, optimized .
30- RelWithDebInfo # Debug info, optimized , no assertions.
28+ Release # Optimized, no debug info, no assertions.
29+ RelWithDebInfo # Optimized, debug info , no assertions.
3130 )
3231
3332 set_property (
@@ -48,19 +47,22 @@ block()
4847 endif ()
4948endblock()
5049
51- target_compile_definitions (
52- php_configuration
53- INTERFACE
54- $<IF:$<CONFIG:Debug,DebugAssertions>,ZEND_DEBUG=1,ZEND_DEBUG=0>
55- )
56-
5750# Set CMAKE_<LANG>_FLAGS_<CONFIG> variables for the DebugAssertions build type.
58- foreach (prefix CMAKE_C_FLAGS CMAKE_CXX_FLAGS CMAKE_ASM_FLAGS)
51+ # These should ideally be set for all languages needed for the project scope
52+ # before adding binary targets that need these flags (for example, PHP
53+ # extensions or SAPIs).
54+ foreach (lang C CXX ASM)
5955 string (
6056 REGEX REPLACE
6157 "(-DNDEBUG|/DNDEBUG)"
6258 ""
63- ${prefix} _DEBUGASSERTIONS
64- "${${prefix} _RELWITHDEBINFO }"
59+ CMAKE_ ${lang} _FLAGS_DEBUGASSERTIONS
60+ "${CMAKE_ ${lang} _FLAGS_RELWITHDEBINFO }"
6561 )
6662endforeach ()
63+
64+ target_compile_definitions (
65+ php_configuration
66+ INTERFACE
67+ $<IF:$<CONFIG:Debug,DebugAssertions>,ZEND_DEBUG=1,ZEND_DEBUG=0>
68+ )
0 commit comments