@PACKAGE_INIT@ cmake_policy(PUSH) # Set policies to prevent warnings if(POLICY CMP0057) # Support new if() IN_LIST operator. cmake_policy(SET CMP0057 NEW) endif() if(POLICY CMP0072) # FindOpenGL prefers GLVND by default when available. cmake_policy(GET CMP0072 _OpenGL_GL_POLICY) if (_OpenGL_GL_POLICY STREQUAL "") cmake_policy(SET CMP0072 NEW) endif() endif() # determine target from compiler, platform and library type if(WIN32 AND NOT CYGWIN AND NOT MSYS) if(${CMAKE_CXX_COMPILER_ID} STREQUAL MSVC) set(wxCOMPILER_PREFIX "vc") elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL GNU) set(wxCOMPILER_PREFIX "gcc") elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL Clang) set(wxCOMPILER_PREFIX "clang") endif() set(wxPLATFORM_ARCH) if(CMAKE_GENERATOR_PLATFORM) if(NOT CMAKE_GENERATOR_PLATFORM STREQUAL "Win32") string(TOLOWER ${CMAKE_GENERATOR_PLATFORM} wxPLATFORM_ARCH) endif() elseif(CMAKE_VS_PLATFORM_NAME) if(NOT CMAKE_VS_PLATFORM_NAME STREQUAL "Win32") string(TOLOWER ${CMAKE_VS_PLATFORM_NAME} wxPLATFORM_ARCH) endif() else() if(CMAKE_SIZEOF_VOID_P EQUAL 8) set(wxPLATFORM_ARCH "x64") endif() endif() if(wxPLATFORM_ARCH) set(wxARCH_SUFFIX "_${wxPLATFORM_ARCH}") endif() # use wxWidgets_USE_STATIC to force static libraries, otherwise shared is searched first if(NOT wxWidgets_USE_STATIC AND EXISTS "${CMAKE_CURRENT_LIST_DIR}/${wxCOMPILER_PREFIX}${wxARCH_SUFFIX}_dll/@PROJECT_NAME@Targets.cmake") set(wxPLATFORM_LIB_DIR "/${wxCOMPILER_PREFIX}${wxARCH_SUFFIX}_dll") elseif(EXISTS "${CMAKE_CURRENT_LIST_DIR}/${wxCOMPILER_PREFIX}${wxARCH_SUFFIX}_lib/@PROJECT_NAME@Targets.cmake") set(wxPLATFORM_LIB_DIR "/${wxCOMPILER_PREFIX}${wxARCH_SUFFIX}_lib") endif() endif() include("${CMAKE_CURRENT_LIST_DIR}${wxPLATFORM_LIB_DIR}/@PROJECT_NAME@Targets.cmake") macro(wx_inherit_property source dest name) # property name without _ get_target_property(prop ${source} ${name}) if(prop) set_target_properties(${dest} PROPERTIES ${name} "${prop}") endif() # property name with _ get_target_property(configs ${source} IMPORTED_CONFIGURATIONS) foreach(cfg ${configs}) set(name_cfg "${name}_${cfg}") get_target_property(prop ${source} ${name_cfg}) if(prop) set_target_properties(${dest} PROPERTIES ${name_cfg} "${prop}") endif() endforeach() endmacro() # for compatibility with FindwxWidgets set(wxWidgets_LIBRARIES) # create one target with all libraries, same as FindwxWidgets set(CREATE_WX_TARGET OFF) if(NOT TARGET wxWidgets::wxWidgets) add_library(wxWidgets::wxWidgets INTERFACE IMPORTED) set(CREATE_WX_TARGET ON) endif() # list all available components set(@PROJECT_NAME@_COMPONENTS) foreach(libname @wxLIB_TARGETS@) if(TARGET wx::${libname}) # remove wx prefix from component name string(SUBSTRING ${libname} 2 -1 name) # set variables used in check_required_components list(APPEND @PROJECT_NAME@_COMPONENTS ${name}) 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:: to wx::wx 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 get_target_property(target_type wx::${libname} TYPE) if(target_type STREQUAL STATIC_LIBRARY) add_library(wx::${name} STATIC IMPORTED) else() add_library(wx::${name} SHARED IMPORTED) endif() wx_inherit_property(wx::${libname} wx::${name} IMPORTED_CONFIGURATIONS) wx_inherit_property(wx::${libname} wx::${name} INTERFACE_COMPILE_DEFINITIONS) wx_inherit_property(wx::${libname} wx::${name} INTERFACE_INCLUDE_DIRECTORIES) wx_inherit_property(wx::${libname} wx::${name} INTERFACE_LINK_LIBRARIES) wx_inherit_property(wx::${libname} wx::${name} IMPORTED_LINK_INTERFACE_LANGUAGES) wx_inherit_property(wx::${libname} wx::${name} IMPORTED_LOCATION) wx_inherit_property(wx::${libname} wx::${name} IMPORTED_IMPLIB) wx_inherit_property(wx::${libname} wx::${name} IMPORTED_LINK_DEPENDENT_LIBRARIES) else() add_library(wx::${name} ALIAS wx::${libname}) 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}) if(CREATE_WX_TARGET) target_link_libraries(wxWidgets::wxWidgets INTERFACE wx::${name}) endif() endif() endif() endforeach() if(TARGET wx::wxgl) # make sure OpenGL targets are available: # The link interface of target "wx::wxgl" contains: OpenGL::GLU find_package(OpenGL QUIET) endif() # if no components are specified in find_package, check all of them if(NOT @PROJECT_NAME@_FIND_COMPONENTS) set(@PROJECT_NAME@_FIND_COMPONENTS ${@PROJECT_NAME@_COMPONENTS}) endif() check_required_components("@PROJECT_NAME@") cmake_policy(POP)