mirror of
https://github.com/wxWidgets/wxWidgets.git
synced 2026-09-26 09:56:32 +08:00
CMake: Fix using Cotire for precompiled headers
Cotire doesn't work when $<COMPILE_LANGUAGE:CXX> is used.
This commit is contained in:
@@ -154,10 +154,14 @@ function(wx_set_common_target_properties target_name)
|
||||
)
|
||||
endif()
|
||||
|
||||
target_compile_options(${target_name} PRIVATE
|
||||
${common_gcc_clang_compile_options}
|
||||
$<$<COMPILE_LANGUAGE:CXX>:${common_gcc_clang_cpp_compile_options}>
|
||||
)
|
||||
# Using $<COMPILE_LANGUAGE:CXX> breaks cotire:
|
||||
# Evaluation file to be written multiple times with different content.
|
||||
if(NOT USE_COTIRE)
|
||||
target_compile_options(${target_name} PRIVATE
|
||||
${common_gcc_clang_compile_options}
|
||||
$<$<COMPILE_LANGUAGE:CXX>:${common_gcc_clang_cpp_compile_options}>
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(wxUSE_NO_RTTI)
|
||||
|
||||
@@ -665,5 +665,7 @@ if((wxBUILD_PRECOMP STREQUAL "ON" AND CMAKE_VERSION VERSION_LESS "3.16") OR (wxB
|
||||
if(NOT RESULT_VAR)
|
||||
message(WARNING "precompiled header (PCH) test failed, it will be turned off")
|
||||
wx_option_force_value(wxBUILD_PRECOMP OFF)
|
||||
else()
|
||||
set(USE_COTIRE ON)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -20,7 +20,7 @@ endif()
|
||||
macro(wx_target_enable_precomp target_name prec_header)
|
||||
if(wxBUILD_PRECOMP)
|
||||
target_compile_definitions(${target_name} PRIVATE WX_PRECOMP)
|
||||
if(CMAKE_VERSION VERSION_LESS "3.16" OR wxBUILD_PRECOMP STREQUAL "COTIRE")
|
||||
if(USE_COTIRE)
|
||||
set_target_properties(${target_name} PROPERTIES COTIRE_CXX_PREFIX_HEADER_INIT ${prec_header})
|
||||
set_target_properties(${target_name} PROPERTIES COTIRE_ADD_UNITY_BUILD FALSE)
|
||||
cotire(${target_name})
|
||||
|
||||
Reference in New Issue
Block a user