mirror of
https://github.com/Kitware/CMake.git
synced 2025-12-30 18:29:37 -06:00
FindwxWidgets: Add an imported target
This commit is contained in:
@@ -65,6 +65,7 @@ set(CMake_TEST_FindRuby "ON" CACHE BOOL "")
|
||||
set(CMake_TEST_FindSDL "ON" CACHE BOOL "")
|
||||
set(CMake_TEST_FindSQLite3 "ON" CACHE BOOL "")
|
||||
set(CMake_TEST_FindTIFF "ON" CACHE BOOL "")
|
||||
set(CMake_TEST_FindwxWidgets "ON" CACHE BOOL "")
|
||||
set(CMake_TEST_FindX11 "ON" CACHE BOOL "")
|
||||
set(CMake_TEST_FindXalanC "ON" CACHE BOOL "")
|
||||
set(CMake_TEST_FindXercesC "ON" CACHE BOOL "")
|
||||
|
||||
@@ -71,6 +71,7 @@ set(CMake_TEST_FindRuby_RVM "ON" CACHE BOOL "")
|
||||
set(CMake_TEST_FindSDL "ON" CACHE BOOL "")
|
||||
set(CMake_TEST_FindSQLite3 "ON" CACHE BOOL "")
|
||||
set(CMake_TEST_FindTIFF "ON" CACHE BOOL "")
|
||||
set(CMake_TEST_FindwxWidgets "ON" CACHE BOOL "")
|
||||
set(CMake_TEST_FindX11 "ON" CACHE BOOL "")
|
||||
set(CMake_TEST_FindXalanC "ON" CACHE BOOL "")
|
||||
set(CMake_TEST_FindXercesC "ON" CACHE BOOL "")
|
||||
|
||||
@@ -69,6 +69,7 @@ set(CMake_TEST_FindRuby_RVM "ON" CACHE BOOL "")
|
||||
set(CMake_TEST_FindSDL "ON" CACHE BOOL "")
|
||||
set(CMake_TEST_FindSQLite3 "ON" CACHE BOOL "")
|
||||
set(CMake_TEST_FindTIFF "ON" CACHE BOOL "")
|
||||
set(CMake_TEST_FindwxWidgets "ON" CACHE BOOL "")
|
||||
set(CMake_TEST_FindX11 "ON" CACHE BOOL "")
|
||||
set(CMake_TEST_FindXalanC "ON" CACHE BOOL "")
|
||||
set(CMake_TEST_FindXercesC "ON" CACHE BOOL "")
|
||||
|
||||
4
Help/release/dev/FindwxWidgets-imported-target.rst
Normal file
4
Help/release/dev/FindwxWidgets-imported-target.rst
Normal file
@@ -0,0 +1,4 @@
|
||||
FindwxWidgets-imported-target
|
||||
-----------------------------
|
||||
|
||||
* The :module:`FindwxWidgets` module now provides an imported target.
|
||||
@@ -113,6 +113,16 @@ If wxWidgets is required (i.e., not an optional part):
|
||||
include(${wxWidgets_USE_FILE})
|
||||
# and for each of your dependent executable/library targets:
|
||||
target_link_libraries(<YourTarget> ${wxWidgets_LIBRARIES})
|
||||
|
||||
Imported targets
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
.. versionadded:: 3.27
|
||||
|
||||
This module defines the following :prop_tgt:`IMPORTED` targets:
|
||||
|
||||
``wxWidgets::wxWidgets``
|
||||
An interface library providing usage requirements for the found components.
|
||||
#]=======================================================================]
|
||||
|
||||
#
|
||||
@@ -981,6 +991,17 @@ find_package_handle_standard_args(wxWidgets
|
||||
)
|
||||
unset(wxWidgets_HANDLE_COMPONENTS)
|
||||
|
||||
if(wxWidgets_FOUND AND NOT TARGET wxWidgets::wxWidgets)
|
||||
add_library(wxWidgets::wxWidgets INTERFACE IMPORTED)
|
||||
target_link_libraries(wxWidgets::wxWidgets INTERFACE ${wxWidgets_LIBRARIES})
|
||||
target_link_directories(wxWidgets::wxWidgets INTERFACE ${wxWidgets_LIBRARY_DIRS})
|
||||
target_include_directories(wxWidgets::wxWidgets INTERFACE ${wxWidgets_INCLUDE_DIRS})
|
||||
target_compile_options(wxWidgets::wxWidgets INTERFACE ${wxWidgets_CXX_FLAGS})
|
||||
target_compile_definitions(wxWidgets::wxWidgets INTERFACE ${wxWidgets_DEFINITIONS})
|
||||
# FIXME: Add "$<$<CONFIG:Debug>:${wxWidgets_DEFINITIONS_DEBUG}>"
|
||||
# if the debug library variant is available.
|
||||
endif()
|
||||
|
||||
#=====================================================================
|
||||
# Macros for use in wxWidgets apps.
|
||||
# - This module will not fail to find wxWidgets based on the code
|
||||
|
||||
@@ -1484,6 +1484,7 @@ if(BUILD_TESTING)
|
||||
SQLite3
|
||||
TIFF
|
||||
Vulkan
|
||||
wxWidgets
|
||||
X11
|
||||
XalanC
|
||||
XercesC
|
||||
|
||||
10
Tests/FindwxWidgets/CMakeLists.txt
Normal file
10
Tests/FindwxWidgets/CMakeLists.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
add_test(NAME FindwxWidgets.Test COMMAND
|
||||
${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
|
||||
--build-and-test
|
||||
"${CMake_SOURCE_DIR}/Tests/FindwxWidgets/Test"
|
||||
"${CMake_BINARY_DIR}/Tests/FindwxWidgets/Test"
|
||||
${build_generator_args}
|
||||
--build-project TestFindwxWidgets
|
||||
--build-options ${build_options}
|
||||
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
|
||||
)
|
||||
17
Tests/FindwxWidgets/Test/CMakeLists.txt
Normal file
17
Tests/FindwxWidgets/Test/CMakeLists.txt
Normal file
@@ -0,0 +1,17 @@
|
||||
cmake_minimum_required(VERSION 3.26)
|
||||
project(TestFindwxWidgets CXX)
|
||||
include(CTest)
|
||||
|
||||
find_package(wxWidgets REQUIRED)
|
||||
|
||||
add_executable(test_tgt main.cpp)
|
||||
target_link_libraries(test_tgt wxWidgets::wxWidgets)
|
||||
add_test(NAME test_tgt COMMAND test_tgt)
|
||||
|
||||
add_executable(test_var main.cpp)
|
||||
target_link_libraries(test_var PRIVATE ${wxWidgets_LIBRARIES})
|
||||
target_link_directories(test_var PRIVATE ${wxWidgets_LIBRARY_DIRS})
|
||||
target_include_directories(test_var PRIVATE ${wxWidgets_INCLUDE_DIRS})
|
||||
target_compile_options(test_var PRIVATE ${wxWidgets_CONFIG_OPTIONS})
|
||||
target_compile_definitions(test_var PRIVATE ${wxWidgets_DEFINITIONS})
|
||||
add_test(NAME test_var COMMAND test_var)
|
||||
7
Tests/FindwxWidgets/Test/main.cpp
Normal file
7
Tests/FindwxWidgets/Test/main.cpp
Normal file
@@ -0,0 +1,7 @@
|
||||
#include <wx/filefn.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
wxGetCwd();
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user