Merge branch 'cmake-imported-libs' of https://github.com/MaartenBent/wxWidgets
CMake: Improve finding library name or path of imported targets. See #23635.
This commit is contained in:
commit
5cef6223c3
4 changed files with 25 additions and 8 deletions
|
|
@ -40,14 +40,25 @@ macro(wx_get_dependencies var lib)
|
|||
else()
|
||||
get_target_property(dep_name ${dep} OUTPUT_NAME)
|
||||
endif()
|
||||
if(NOT dep_name)
|
||||
# imported target
|
||||
|
||||
# imported target
|
||||
if(CMAKE_VERSION VERSION_GREATER "3.18")
|
||||
# CMake <= 3.18 only allows a few properties to be checked, not LOCATION, see
|
||||
# https://cmake.org/cmake/help/v3.18/manual/cmake-buildsystem.7.html#interface-libraries
|
||||
set(prop_suffix)
|
||||
if (CMAKE_BUILD_TYPE)
|
||||
string(TOUPPER "${CMAKE_BUILD_TYPE}" prop_suffix)
|
||||
set(prop_suffix "_${prop_suffix}")
|
||||
endif()
|
||||
get_target_property(dep_name ${dep} LOCATION${prop_suffix})
|
||||
if(NOT dep_name AND prop_suffix)
|
||||
get_target_property(dep_name ${dep} LOCATION${prop_suffix})
|
||||
endif()
|
||||
if(NOT dep_name)
|
||||
get_target_property(dep_name ${dep} LOCATION)
|
||||
endif()
|
||||
endif()
|
||||
if(NOT dep_name)
|
||||
get_target_property(dep_name ${dep} IMPORTED_LIBNAME)
|
||||
endif()
|
||||
else()
|
||||
# For the value like $<$<CONFIG:DEBUG>:LIB_PATH>
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -671,5 +671,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})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue