Merge branch 'cmake-improvements' of github.com:MaartenBent/wxWidgets
Unix builds / Ubuntu 18.04 wxGTK 3 compatible 3.0 (push) Has been cancelled
Unix builds / Ubuntu 24.04 wxGTK ASAN not compatible (push) Has been cancelled
Unix builds / Ubuntu 18.04 wxGTK UTF-8 (push) Has been cancelled
Unix builds / Ubuntu 18.04 wxQt (push) Has been cancelled
Unix builds / Ubuntu 18.04 wxX11 (push) Has been cancelled
Unix builds / Ubuntu 20.04 wxGTK 3 with clang (push) Has been cancelled
Unix builds / Ubuntu 22.04 wxGTK with wx containers (push) Has been cancelled
Unix builds / Ubuntu 18.04 wxDFB (push) Has been cancelled
Unix builds / Ubuntu 24.04 wxGTK UBSAN (push) Has been cancelled
Unix builds / Ubuntu 18.04 wxGTK 3 static with gcc 4.8 (push) Has been cancelled
Unix builds / Ubuntu 18.04 wxGTK 2 (push) Has been cancelled
CMake builds / Ubuntu 22.04 wxGTK 3 (push) Has been cancelled
CMake builds / macOS latest wxGTK 3 Unix Makefiles (push) Has been cancelled
CMake builds / MSW/MSVC wxMSW (push) Has been cancelled
CMake builds / MSW/Clang wxMSW (push) Has been cancelled
CMake builds / macOS latest wxOSX Ninja (push) Has been cancelled
CMake builds / macOS 14 wxOSX Xcode (push) Has been cancelled
CMake builds / macOS 14 wxIOS (push) Has been cancelled
CMake builds / MSW/MSVC wxQt 5.15 (push) Has been cancelled
CMake builds / MSW/MSVC wxQt 6.10 (push) Has been cancelled
Mac builds / wxMac ARM ASAN not compatible (push) Has been cancelled
Mac builds / wxMac Universal C++14 (push) Has been cancelled
Mac builds / wxiOS Simulator on Silicon Mac (push) Has been cancelled
Mac builds / wxiOS (push) Has been cancelled
Mac builds / wxMac Intel C++17 (push) Has been cancelled
Mac Xcode builds / iOS Simulator static (push) Has been cancelled
Mac Xcode builds / macOS dynamic Release (push) Has been cancelled
Mac Xcode builds / iOS static Debug (push) Has been cancelled
MSW builds / wxMSW vs2022 DLL Debug x64 (push) Has been cancelled
MSW builds / wxMSW vs2022 DLL Release x64 (push) Has been cancelled
MSW builds / wxMSW vs2022 Debug Win32 (push) Has been cancelled
MSW builds / wxMSW vs2022 Release arm64 (push) Has been cancelled
MSW builds / wxMSW vs2026 DLL Release x64 (push) Has been cancelled
MSW cross-builds / wxMSW 64 bits not compatible (push) Has been cancelled
MSW cross-builds / wxMSW/Univ (push) Has been cancelled
MSW cross-builds / wxMSW 32 bits (push) Has been cancelled
Code Checks / Check Spelling (push) Has been cancelled
Code Checks / Check Whitespace (push) Has been cancelled
Code Checks / Check Mixed EOL (push) Has been cancelled
Code Checks / Check C++ Style (push) Has been cancelled
Code Checks / Check All Headers In allheaders.h (push) Has been cancelled
No Response / no-response (push) Has been cancelled

CMake improvements, mostly installation-related (fixes for static
libraries, use relative symlinks if possible and more), but also add
wxbase_only target for console applications.

See #26325.
This commit is contained in:
Vadim Zeitlin
2026-04-12 21:42:38 +02:00
11 changed files with 161 additions and 79 deletions
+2 -2
View File
@@ -92,7 +92,7 @@ function(wx_write_config_inplace)
"wx-config-inplace.in"
"inplace-${TOOLCHAIN_FULLNAME}"
)
if(WIN32_MSVC_NAMING)
if(WIN32_MSVC_NAMING OR NOT wxBUILD_INSTALL_USE_SYMLINK)
set(COPY_CMD copy)
else()
set(COPY_CMD create_symlink)
@@ -200,7 +200,7 @@ function(wx_write_config)
set(WXCONFIG_RESFLAGS)
set(WXCONFIG_RPATH "-Wl,-rpath,\$libdir")
set(LDFLAGS_GL)
set(RESCOMP)
get_filename_component(RESCOMP "${CMAKE_RC_COMPILER}" NAME_WE)
wx_configure_script(
"wx-config.in"
+73 -33
View File
@@ -14,6 +14,8 @@ include(GNUInstallDirs)
# List of libraries added via wx_add_library() to use for wx-config
set(wxLIB_TARGETS)
# List of the (static) builtin libraries to use in wxWidgetsConfig.cmake
set(wxLIB_BUILTIN_TARGETS)
# List of headers added via wx_append_sources() to use for install
set(wxINSTALL_HEADERS)
# List of files not included in the install manifest
@@ -90,6 +92,42 @@ macro(wx_install)
endif()
endmacro()
# wx_install_symlink(...)
# Create symlink dst pointing to src
# try different symlink and copy methods until one succeeds
macro(wx_install_symlink src dst)
if(wxBUILD_INSTALL)
install(CODE "
set(SYMLINK_SRC \"${src}\")
set(SYMLINK_DST \"${dst}\")
message(STATUS \"Installing: \${SYMLINK_DST}\")
if(CMAKE_VERSION GREATER_EQUAL \"3.17\")
execute_process(COMMAND \"\${CMAKE_COMMAND}\" -E rm -f \"\${SYMLINK_DST}\")
else()
execute_process(COMMAND \"\${CMAKE_COMMAND}\" -E remove -f \"\${SYMLINK_DST}\")
endif()
set(SYMLINK_RES 1)
set(wxBUILD_INSTALL_USE_SYMLINK ${wxBUILD_INSTALL_USE_SYMLINK})
if(wxBUILD_INSTALL_USE_SYMLINK)
if(SYMLINK_RES)
execute_process(COMMAND ln -s --relative \"\${SYMLINK_SRC}\" \"\${SYMLINK_DST}\" RESULT_VARIABLE SYMLINK_RES OUTPUT_QUIET ERROR_QUIET)
endif()
if(SYMLINK_RES)
execute_process(COMMAND ln -s \"\${SYMLINK_SRC}\" \"\${SYMLINK_DST}\" RESULT_VARIABLE SYMLINK_RES OUTPUT_QUIET ERROR_QUIET)
endif()
if(SYMLINK_RES)
execute_process(COMMAND \"\${CMAKE_COMMAND}\" -E create_symlink \"\${SYMLINK_SRC}\" \"\${SYMLINK_DST}\" RESULT_VARIABLE SYMLINK_RES)
endif()
endif()
if(SYMLINK_RES)
execute_process(COMMAND \"\${CMAKE_COMMAND}\" -E copy \"\${SYMLINK_SRC}\" \"\${SYMLINK_DST}\" RESULT_VARIABLE SYMLINK_RES)
endif()
")
endif()
endmacro()
# Get a valid flavour name with optional prefix
macro(wx_get_flavour flavour prefix)
if(wxBUILD_FLAVOUR)
@@ -398,11 +436,6 @@ function(wx_set_target_properties target_name)
$<INSTALL_INTERFACE:${wxINSTALL_INCLUDE_DIR}>
)
if(wxTOOLKIT_INCLUDE_DIRS AND NOT wxTARGET_IS_BASE)
target_include_directories(${target_name}
PRIVATE ${wxTOOLKIT_INCLUDE_DIRS})
endif()
if (WIN32)
set(WIN32_LIBRARIES
kernel32
@@ -431,25 +464,27 @@ function(wx_set_target_properties target_name)
PUBLIC ${WIN32_LIBRARIES})
endif()
if(wxTOOLKIT_LIBRARY_DIRS AND NOT wxTARGET_IS_BASE)
target_link_directories(${target_name}
PUBLIC ${wxTOOLKIT_LIBRARY_DIRS})
endif()
if(wxTOOLKIT_LIBRARIES AND NOT wxTARGET_IS_BASE)
target_link_libraries(${target_name}
PUBLIC ${wxTOOLKIT_LIBRARIES})
endif()
if(wxTARGET_IS_BASE)
# Currently base libraries still use toolkit definitions internally.
# This is wrong and should, ideally, be fixed, but for now keep
# defining them. However we don't need to define this for the targets
# using the base library.
target_compile_definitions(${target_name}
PRIVATE ${wxTOOLKIT_DEFINITIONS})
if(wxTOOLKIT_DEFINITIONS)
target_compile_definitions(${target_name} PRIVATE ${wxTOOLKIT_DEFINITIONS})
endif()
else()
target_compile_definitions(${target_name}
PUBLIC ${wxTOOLKIT_DEFINITIONS})
if(wxTOOLKIT_INCLUDE_DIRS)
target_include_directories(${target_name} PRIVATE ${wxTOOLKIT_INCLUDE_DIRS})
endif()
if(wxTOOLKIT_LIBRARY_DIRS)
target_link_directories(${target_name} PUBLIC ${wxTOOLKIT_LIBRARY_DIRS})
endif()
if(wxTOOLKIT_LIBRARIES)
target_link_libraries(${target_name} PUBLIC ${wxTOOLKIT_LIBRARIES})
endif()
if(wxTOOLKIT_DEFINITIONS)
target_compile_definitions(${target_name} PUBLIC ${wxTOOLKIT_DEFINITIONS})
endif()
endif()
if(wxBUILD_SHARED)
@@ -553,7 +588,11 @@ macro(wx_add_library name)
)
if(wxBUILD_SHARED AND MSVC AND wxBUILD_INSTALL_PDB)
wx_install(FILES $<TARGET_PDB_FILE:${name}> DESTINATION "${runtime_dir}")
if(wxBUILD_STRIPPED_RELEASE)
wx_install(FILES $<TARGET_PDB_FILE:${name}> DESTINATION "${runtime_dir}" CONFIGURATIONS Debug RelWithDebInfo)
else()
wx_install(FILES $<TARGET_PDB_FILE:${name}> DESTINATION "${runtime_dir}")
endif()
endif()
wx_target_enable_precomp(${name} "${wxSOURCE_DIR}/include/wx/wxprec.h")
@@ -719,6 +758,9 @@ endfunction()
# Add a third party builtin library
function(wx_add_builtin_library name)
list(APPEND wxLIB_BUILTIN_TARGETS ${name})
set(wxLIB_BUILTIN_TARGETS ${wxLIB_BUILTIN_TARGETS} PARENT_SCOPE)
wx_list_add_prefix(src_list "${wxSOURCE_DIR}/" ${ARGN})
list(GET src_list 0 src_file)
@@ -970,17 +1012,16 @@ function(wx_add name group)
endif()
# All applications use at least the base library other libraries
# will have to be added with wx_link_sample_libraries()
wx_exe_link_libraries(${target_name} wxbase)
if(NOT APP_CONSOLE)
# UI applications always require core
wx_exe_link_libraries(${target_name} wxcore)
if(APP_CONSOLE)
wx_exe_link_libraries(${target_name} wxbase_only)
else()
target_compile_definitions(${target_name} PRIVATE wxUSE_GUI=0 wxUSE_BASE=1)
wx_exe_link_libraries(${target_name} wxcore)
endif()
if(APP_LIBRARIES)
wx_exe_link_libraries(${target_name} ${APP_LIBRARIES})
endif()
if(APP_DEFINITIONS)
target_compile_definitions(${target_name} PRIVATE ${APP_DEFINITIONS})
endif()
@@ -1061,13 +1102,6 @@ function(wx_add name group)
endif()
endfunction()
# Link libraries to a sample
function(wx_link_sample_libraries name)
if(TARGET ${name})
target_link_libraries(${name} PUBLIC ${ARGN})
endif()
endfunction()
# Add a option and mark is as advanced if it starts with wxUSE_
# wx_option(<name> <desc> [default] [STRINGS strings])
# The default is ON if not third parameter is specified
@@ -1114,7 +1148,13 @@ endfunction()
# just a warning otherwise, while ON means that an error is given if it can't
# be enabled.
function(wx_option_auto name desc)
wx_option(${name} ${desc} AUTO STRINGS ON OFF AUTO)
cmake_parse_arguments(OPTION "" "" "STRINGS" ${ARGN})
if(ARGC EQUAL 2)
set(default AUTO)
else()
set(default ${OPTION_UNPARSED_ARGUMENTS})
endif()
wx_option(${name} ${desc} ${default} STRINGS ON OFF AUTO)
endfunction()
# Force a new value for an option created with wx_option
+6 -7
View File
@@ -67,13 +67,12 @@ else()
wx_get_install_platform_dir(runtime)
install(DIRECTORY DESTINATION "${runtime_dir}")
install(CODE "execute_process( \
COMMAND ${CMAKE_COMMAND} -E create_symlink \
\"${CMAKE_INSTALL_PREFIX}/${library_dir}/wx/config/${wxBUILD_FILE_ID}\" \
\"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${runtime_dir}/wx-config\" \
)"
)
list(APPEND WX_EXTRA_UNINSTALL_FILES "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${runtime_dir}/wx-config")
set(CONFIG_DIR "\\\$ENV{DESTDIR}\\\${CMAKE_INSTALL_PREFIX}")
set(CONFIG_SRC "${CONFIG_DIR}/${library_dir}/wx/config/${wxBUILD_FILE_ID}")
set(CONFIG_DST "${CONFIG_DIR}/${runtime_dir}/wx-config")
wx_install_symlink(${CONFIG_SRC} ${CONFIG_DST})
list(APPEND WX_EXTRA_UNINSTALL_FILES "\"${CMAKE_INSTALL_PREFIX}/${runtime_dir}/wx-config\"")
endif()
wx_get_install_dir(library)
+1
View File
@@ -122,4 +122,5 @@ endif()
# Propagate variable(s) to parent scope
set(wxLIB_TARGETS ${wxLIB_TARGETS} PARENT_SCOPE)
set(wxLIB_BUILTIN_TARGETS ${wxLIB_BUILTIN_TARGETS} PARENT_SCOPE)
set(wxINSTALL_HEADERS ${wxINSTALL_HEADERS} PARENT_SCOPE)
+10
View File
@@ -82,3 +82,13 @@ if(APPLE)
elseif(UNIX)
wx_lib_link_libraries(wxbase PRIVATE ${CMAKE_DL_LIBS})
endif()
add_library(wxbase_only INTERFACE)
add_library(wx::base_only ALIAS wxbase_only)
add_library(wxWidgets::base_only ALIAS wxbase_only)
target_link_libraries(wxbase_only INTERFACE wxbase)
target_compile_definitions(wxbase_only INTERFACE wxUSE_GUI=0)
wx_install(TARGETS wxbase_only EXPORT wxWidgetsTargets)
list(APPEND wxLIB_TARGETS wxbase_only)
set(wxLIB_TARGETS ${wxLIB_TARGETS} PARENT_SCOPE)
+2
View File
@@ -71,6 +71,8 @@ if(wxUSE_LIBWEBP STREQUAL "builtin")
endforeach()
set(WebP_LIBRARIES webp webpdemux sharpyuv)
list(APPEND wxLIB_BUILTIN_TARGETS ${WebP_LIBRARIES})
if(NOT wxBUILD_SHARED)
wx_get_install_platform_dir(archive)
wx_install(TARGETS ${WebP_LIBRARIES}
+2
View File
@@ -92,6 +92,8 @@ wx_option(wxBUILD_INSTALL_PLATFORM_SUBDIR "use platform specific sub-directory (
mark_as_advanced(wxBUILD_INSTALL_PLATFORM_SUBDIR)
wx_option(wxBUILD_INSTALL_PDB "install pdb files in the runtime directory (MSVC-naming)" OFF)
mark_as_advanced(wxBUILD_INSTALL_PDB)
wx_option(wxBUILD_INSTALL_USE_SYMLINK "use symlinks when possible, disable to always use copy" ON)
mark_as_advanced(wxBUILD_INSTALL_USE_SYMLINK)
# Use the MSVC/makefile naming convention, or the configure naming convention,
# this is the same check as used in FindwxWidgets.
+9 -3
View File
@@ -216,7 +216,9 @@ wx_add_sample(widgets IMPORTANT ${SAMPLE_WIDGETS_SRC}
DATA ${WIDGETS_RC_FILES} textctrl.cpp ../image/toucan.png:toucan.png
)
# includes needed by the native widget (like gtk.h)
target_include_directories(widgets PRIVATE ${wxTOOLKIT_INCLUDE_DIRS})
if(TARGET widgets)
target_include_directories(widgets PRIVATE ${wxTOOLKIT_INCLUDE_DIRS})
endif()
wx_add_sample(wizard DATA wiztest.svg wiztest2.svg DEPENDS wxUSE_WIZARDDLG)
wx_add_sample(wrapsizer)
@@ -265,11 +267,15 @@ if(WIN32)
# this test only makes sense with statically built wx, otherwise
# the same copy of wx would be used
wx_add_sample(dll wx_exe.cpp my_dll.h NAME wx_exe FOLDER dll)
wx_link_sample_libraries(wx_exe my_dll)
if(TARGET wx_exe AND TARGET my_dll)
target_link_libraries(wx_exe PRIVATE my_dll)
endif()
endif()
wx_add_sample(dll sdk_exe.cpp my_dll.h NAME sdk_exe FOLDER dll)
wx_link_sample_libraries(sdk_exe my_dll)
if(TARGET sdk_exe AND TARGET my_dll)
target_link_libraries(sdk_exe PRIVATE my_dll)
endif()
endif()
wx_add_sample(regtest RES regtest.rc DEPENDS wxUSE_REGKEY)
+7 -3
View File
@@ -183,13 +183,17 @@ else()
function(wx_check_symbols_exist_if_not_linux header)
foreach(func ${ARGN})
string(TOUPPER "HAVE_${func}" var)
message(STATUS "Looking for ${func} in ${header}")
set(MSG_TYPE STATUS)
if(DEFINED ${var})
set(MSG_TYPE DEBUG)
endif()
message(${MSG_TYPE} "Looking for ${func} in ${header}")
check_symbol_exists(${func} ${header} ${var})
if(${var})
message(STATUS "Looking for ${func} in ${header} - found")
message(${MSG_TYPE} "Looking for ${func} in ${header} - found")
set(${var} 1 PARENT_SCOPE)
else()
message(STATUS "Looking for ${func} in ${header} - not found")
message(${MSG_TYPE} "Looking for ${func} in ${header} - not found")
endif()
endforeach()
endfunction()
+6 -8
View File
@@ -38,14 +38,12 @@ if(wxUSE_XRC)
set(EXE_SUFFIX ${CMAKE_EXECUTABLE_SUFFIX})
endif()
# Don't use wx_install() here to preserve escaping.
install(CODE "execute_process( \
COMMAND ${CMAKE_COMMAND} -E create_symlink \
\"${CMAKE_INSTALL_PREFIX}/${runtime_dir}/${wxrc_output_name}${EXE_SUFFIX}\" \
\"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${runtime_dir}/wxrc${EXE_SUFFIX}\" \
)"
)
list(APPEND WX_EXTRA_UNINSTALL_FILES "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/${runtime_dir}/wxrc${EXE_SUFFIX}")
set(WXRC_DIR "\\\$ENV{DESTDIR}\\\${CMAKE_INSTALL_PREFIX}")
set(WXRC_SRC "${WXRC_DIR}/${runtime_dir}/${wxrc_output_name}${EXE_SUFFIX}")
set(WXRC_DST "${WXRC_DIR}/${runtime_dir}/wxrc${EXE_SUFFIX}")
wx_install_symlink(${WXRC_SRC} ${WXRC_DST})
list(APPEND WX_EXTRA_UNINSTALL_FILES "\"${CMAKE_INSTALL_PREFIX}/${runtime_dir}/wxrc${EXE_SUFFIX}\"")
set(WX_EXTRA_UNINSTALL_FILES ${WX_EXTRA_UNINSTALL_FILES} PARENT_SCOPE)
endif()
endif()
+43 -23
View File
@@ -81,17 +81,41 @@ macro(wx_copy_target ns name libname)
get_target_property(target_type wx::${libname} TYPE)
if(target_type STREQUAL STATIC_LIBRARY)
add_library(${ns}::${name} STATIC IMPORTED)
else()
elseif(target_type STREQUAL SHARED_LIBRARY)
add_library(${ns}::${name} SHARED IMPORTED)
elseif(target_type STREQUAL INTERFACE_LIBRARY)
add_library(${ns}::${name} INTERFACE IMPORTED)
else()
message(FATAL_ERROR "Unsupported library type: ${target_type}")
endif()
wx_inherit_property(wx::${libname} ${ns}::${name} IMPORTED_CONFIGURATIONS)
wx_inherit_property(wx::${libname} ${ns}::${name} INTERFACE_COMPILE_DEFINITIONS)
wx_inherit_property(wx::${libname} ${ns}::${name} INTERFACE_INCLUDE_DIRECTORIES)
wx_inherit_property(wx::${libname} ${ns}::${name} INTERFACE_LINK_LIBRARIES)
wx_inherit_property(wx::${libname} ${ns}::${name} IMPORTED_LINK_INTERFACE_LANGUAGES)
wx_inherit_property(wx::${libname} ${ns}::${name} IMPORTED_LOCATION)
wx_inherit_property(wx::${libname} ${ns}::${name} IMPORTED_IMPLIB)
wx_inherit_property(wx::${libname} ${ns}::${name} IMPORTED_LINK_DEPENDENT_LIBRARIES)
if(target_type STREQUAL STATIC_LIBRARY OR target_type STREQUAL SHARED_LIBRARY)
wx_inherit_property(wx::${libname} ${ns}::${name} IMPORTED_CONFIGURATIONS)
wx_inherit_property(wx::${libname} ${ns}::${name} IMPORTED_LINK_INTERFACE_LANGUAGES)
wx_inherit_property(wx::${libname} ${ns}::${name} IMPORTED_LOCATION)
wx_inherit_property(wx::${libname} ${ns}::${name} IMPORTED_IMPLIB)
wx_inherit_property(wx::${libname} ${ns}::${name} IMPORTED_LINK_DEPENDENT_LIBRARIES)
endif()
endmacro()
macro(wx_map_release libname)
# use the Release configuration for MinSizeRel and RelWithDebInfo configurations
# only when Release target exists, and MinSizeRel/RelWithDebInfo doesn't exist
get_target_property(configs wx::${libname} IMPORTED_CONFIGURATIONS)
if("RELEASE" IN_LIST configs)
if(NOT "MINSIZEREL" IN_LIST configs)
if("MinSizeRel" IN_LIST CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE STREQUAL "MinSizeRel")
set_target_properties(wx::${libname} PROPERTIES MAP_IMPORTED_CONFIG_MINSIZEREL "Release")
endif()
endif()
if(NOT "RELWITHDEBINFO" IN_LIST configs)
if("RelWithDebInfo" IN_LIST CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
set_target_properties(wx::${libname} PROPERTIES MAP_IMPORTED_CONFIG_RELWITHDEBINFO "Release")
endif()
endif()
endif()
endmacro()
# for compatibility with FindwxWidgets
@@ -108,6 +132,8 @@ endif()
set(@PROJECT_NAME@_COMPONENTS)
foreach(libname @wxLIB_TARGETS@)
if(TARGET wx::${libname})
wx_map_release(${libname})
# remove wx prefix from component name
string(SUBSTRING ${libname} 2 -1 name)
@@ -116,23 +142,7 @@ foreach(libname @wxLIB_TARGETS@)
set(@PROJECT_NAME@_${name}_FOUND 1)
set(@PROJECT_NAME@_FIND_REQUIRED_${name} 1)
# use the Release configuration for MinSizeRel and RelWithDebInfo configurations
# only when Release target exists, and MinSizeRel/RelWithDebInfo doesn't exist
get_target_property(configs wx::${libname} IMPORTED_CONFIGURATIONS)
if("RELEASE" IN_LIST configs)
if(NOT "MINSIZEREL" IN_LIST configs)
if("MinSizeRel" IN_LIST CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE STREQUAL "MinSizeRel")
set_target_properties(wx::${libname} PROPERTIES MAP_IMPORTED_CONFIG_MINSIZEREL "Release")
endif()
endif()
if(NOT "RELWITHDEBINFO" IN_LIST configs)
if("RelWithDebInfo" IN_LIST CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
set_target_properties(wx::${libname} PROPERTIES MAP_IMPORTED_CONFIG_RELWITHDEBINFO "Release")
endif()
endif()
endif()
# add an alias from wx::<lib> to wx::wx<lib>
# add aliases from wx::<lib> and wxWidgets::${lib} to wx::wx<lib>
if(NOT TARGET wx::${name})
if(CMAKE_VERSION VERSION_LESS "3.18")
# CMake <3.18 does not support alias to non-global imported target, create a copy of the library
@@ -144,6 +154,11 @@ foreach(libname @wxLIB_TARGETS@)
endif()
endif()
# don't include 'wxbase_only' in wxWidgets_LIBRARIES and wxWidgets::wxWidgets
if(${libname} STREQUAL "wxbase_only")
continue()
endif()
# add to FindwxWidgets variable
if(NOT @PROJECT_NAME@_FIND_COMPONENTS OR ${name} IN_LIST @PROJECT_NAME@_FIND_COMPONENTS)
list(APPEND wxWidgets_LIBRARIES wx::${name})
@@ -153,6 +168,11 @@ foreach(libname @wxLIB_TARGETS@)
endif()
endif()
endforeach()
foreach(libname @wxLIB_BUILTIN_TARGETS@)
if(TARGET wx::${libname})
wx_map_release(${libname})
endif()
endforeach()
include(CMakeFindDependencyMacro)