mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
CMake: Use DEBUG_CONFIGURATIONS to determine whether a configuration is a Debug configuration
This commit is contained in:
parent
82377a787a
commit
13c2ba2dcc
2 changed files with 19 additions and 3 deletions
|
|
@ -24,6 +24,19 @@
|
|||
add_library(juce_recommended_warning_flags INTERFACE)
|
||||
add_library(juce::juce_recommended_warning_flags ALIAS juce_recommended_warning_flags)
|
||||
|
||||
function(_juce_get_debug_config_genex result)
|
||||
get_property(debug_configs GLOBAL PROPERTY DEBUG_CONFIGURATIONS)
|
||||
if(NOT debug_configs)
|
||||
set(debug_configs Debug)
|
||||
endif()
|
||||
list(TRANSFORM debug_configs REPLACE [[^.+$]] [[$<CONFIG:\0>]])
|
||||
list(JOIN debug_configs "," debug_configs)
|
||||
# $<CONFIG> doesn't accept multiple configurations until CMake 3.19
|
||||
set(${result} "$<OR:${debug_configs}>" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# ==================================================================================================
|
||||
|
||||
if((CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") OR (CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC"))
|
||||
target_compile_options(juce_recommended_warning_flags INTERFACE "/W4")
|
||||
elseif((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") OR (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang"))
|
||||
|
|
@ -58,13 +71,15 @@ add_library(juce_recommended_config_flags INTERFACE)
|
|||
add_library(juce::juce_recommended_config_flags ALIAS juce_recommended_config_flags)
|
||||
|
||||
if((CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") OR (CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC"))
|
||||
_juce_get_debug_config_genex(debug_config)
|
||||
target_compile_options(juce_recommended_config_flags INTERFACE
|
||||
$<IF:$<CONFIG:Debug>,/Od /Zi,/Ox> $<$<STREQUAL:"${CMAKE_CXX_COMPILER_ID}","MSVC">:/MP> /EHsc)
|
||||
$<IF:${debug_config},/Od /Zi,/Ox> $<$<STREQUAL:"${CMAKE_CXX_COMPILER_ID}","MSVC">:/MP> /EHsc)
|
||||
elseif((CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
OR (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
|
||||
OR (CMAKE_CXX_COMPILER_ID STREQUAL "GNU"))
|
||||
_juce_get_debug_config_genex(debug_config)
|
||||
target_compile_options(juce_recommended_config_flags INTERFACE
|
||||
$<$<CONFIG:Debug>:-g -O0>
|
||||
$<${debug_config}:-g -O0>
|
||||
$<$<CONFIG:Release>:-O3>)
|
||||
endif()
|
||||
|
||||
|
|
|
|||
|
|
@ -73,9 +73,10 @@ endfunction()
|
|||
# ==================================================================================================
|
||||
|
||||
function(_juce_add_standard_defs juce_target)
|
||||
_juce_get_debug_config_genex(debug_config)
|
||||
target_compile_definitions(${juce_target} INTERFACE
|
||||
JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1
|
||||
$<IF:$<CONFIG:DEBUG>,DEBUG=1 _DEBUG=1,NDEBUG=1 _NDEBUG=1>
|
||||
$<IF:${debug_config},DEBUG=1 _DEBUG=1,NDEBUG=1 _NDEBUG=1>
|
||||
$<$<PLATFORM_ID:Android>:JUCE_ANDROID=1>)
|
||||
endfunction()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue