1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-14 02:08:27 +08:00

Use_wxWindows: Update documentation

Refactored examples to highlight the code upgrade towards the
FindwxWidgets module.
This commit is contained in:
Peter Kokot
2025-08-08 03:40:13 +02:00
parent 9eb1c56a84
commit 14334d7604
2 changed files with 40 additions and 10 deletions

View File

@@ -11,7 +11,11 @@ FindwxWindows
Finds the wxWidgets (formerly known as wxWindows) installation and determines Finds the wxWidgets (formerly known as wxWindows) installation and determines
the locations of its include directories and libraries, as well as the name of the locations of its include directories and libraries, as well as the name of
the library. the library:
.. code-block:: cmake
find_package(wxWindows [...])
wxWidgets 2.6.x is supported for monolithic builds, such as those compiled in wxWidgets 2.6.x is supported for monolithic builds, such as those compiled in
the ``wx/build/msw`` directory using: the ``wx/build/msw`` directory using:
@@ -57,7 +61,7 @@ This module accepts the following variables before calling the
Deprecated Variables Deprecated Variables
^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^
These variables are provided for backward compatibility: The following variables are provided for backward compatibility:
``CMAKE_WX_CAN_COMPILE`` ``CMAKE_WX_CAN_COMPILE``
.. deprecated:: 1.8 .. deprecated:: 1.8
@@ -78,7 +82,7 @@ These variables are provided for backward compatibility:
Examples Examples
^^^^^^^^ ^^^^^^^^
Example: Finding wxWidgets in earlier CMake versions Example: Finding wxWidgets in Earlier CMake Versions
"""""""""""""""""""""""""""""""""""""""""""""""""""" """"""""""""""""""""""""""""""""""""""""""""""""""""
In earlier versions of CMake, wxWidgets (wxWindows) could be found using: In earlier versions of CMake, wxWidgets (wxWindows) could be found using:

View File

@@ -7,28 +7,54 @@ Use_wxWindows
.. deprecated:: 2.8.10 .. deprecated:: 2.8.10
Use :module:`find_package(wxWidgets) <FindwxWidgets>` instead. This module should no longer be used. Use :module:`find_package(wxWidgets)
<FindwxWidgets>` instead.
This convenience include finds if wxWindows library is installed and sets the This module serves as a convenience wrapper for finding the wxWidgets library
appropriate libraries, include directories, flags, etc. (formerly known as wxWindows) and propagates its usage requirements, such as
libraries, include directories, and compiler flags, into the current directory
scope for use by targets.
Load this module in a CMake project with:
.. code-block:: cmake
include(Use_wxWindows)
Examples Examples
^^^^^^^^ ^^^^^^^^
Include ``Use_wxWindows`` module in project's ``CMakeLists.txt``: In earlier versions of CMake, wxWidgets (wxWindows) could be found and used in
the current directory like this:
.. code-block:: cmake .. code-block:: cmake
:caption: ``CMakeLists.txt``
# CMakeLists.txt
include(Use_wxWindows) include(Use_wxWindows)
When the GL support is required, set ``WXWINDOWS_USE_GL`` *before* including To request OpenGL support, the ``WXWINDOWS_USE_GL`` variable could be set before
this module: including this module:
.. code-block:: cmake .. code-block:: cmake
:caption: ``CMakeLists.txt``
set(WXWINDOWS_USE_GL ON) set(WXWINDOWS_USE_GL ON)
include(Use_wxWindows) include(Use_wxWindows)
add_library(example example.cxx)
Starting with CMake 3.0, wxWidgets can be found using the
:module:`FindwxWidgets` module, which provides the wxWidgets usage requirements
either using result variables or imported target as of CMake 3.27:
.. code-block:: cmake
:caption: ``CMakeLists.txt``
find_package(wxWidgets)
add_library(example example.cxx)
target_link_libraries(example PRIVATE wxWidgets::wxWidgets)
#]=======================================================================] #]=======================================================================]
# Author: Jan Woetzel <jw -at- mip.informatik.uni-kiel.de> (07/2003) # Author: Jan Woetzel <jw -at- mip.informatik.uni-kiel.de> (07/2003)