From 7ac1345f7f19677635f0438e18fcb954006e4069 Mon Sep 17 00:00:00 2001 From: Peter Kokot Date: Sun, 13 Apr 2025 02:52:57 +0200 Subject: FindwxWindows: Update documentation - Module documentation updated and synced with other similar find modules. - Added examples section highlighting the usage of the FindwxWidgets module instead. --- Modules/FindwxWindows.cmake | 115 ++++++++++++++++++++++++++++---------------- 1 file changed, 74 insertions(+), 41 deletions(-) diff --git a/Modules/FindwxWindows.cmake b/Modules/FindwxWindows.cmake index 43ec812..88af70c 100644 --- a/Modules/FindwxWindows.cmake +++ b/Modules/FindwxWindows.cmake @@ -9,79 +9,112 @@ FindwxWindows Replaced by :module:`FindwxWidgets`. -Find wxWindows (wxWidgets) installation +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 library. -This module finds if wxWindows/wxWidgets is installed and determines -where the include files and libraries are. It also determines what -the name of the library is. This code sets the following variables: +wxWidgets 2.6.x is supported for monolithic builds, such as those compiled in +the ``wx/build/msw`` directory using: -:: +.. code-block:: shell - WXWINDOWS_FOUND = system has WxWindows - WXWINDOWS_LIBRARIES = path to the wxWindows libraries - on Unix/Linux with additional - linker flags from - "wx-config --libs" - CMAKE_WXWINDOWS_CXX_FLAGS = Compiler flags for wxWindows, - essentially "`wx-config --cxxflags`" - on Linux - WXWINDOWS_INCLUDE_DIR = where to find "wx/wx.h" and "wx/setup.h" - WXWINDOWS_LINK_DIRECTORIES = link directories, useful for rpath on - Unix - WXWINDOWS_DEFINITIONS = extra defines + nmake -f makefile.vc BUILD=debug SHARED=0 USE_OPENGL=1 MONOLITHIC=1 +Result Variables +^^^^^^^^^^^^^^^^ +This module defines the following variables: -OPTIONS If you need OpenGL support please +``WXWINDOWS_FOUND`` + Boolean indicating whether the wxWidgets is found. +``WXWINDOWS_LIBRARIES`` + Libraries needed to link against to use wxWidgets. This includes paths to + the wxWidgets libraries and any additional linker flags, typically derived + from the output of ``wx-config --libs`` on Unix/Linux systems. +``CMAKE_WXWINDOWS_CXX_FLAGS`` + Compiler options needed to use wxWidgets (if any). On Linux, this corresponds + to the output of ``wx-config --cxxflags``. +``WXWINDOWS_INCLUDE_DIR`` + The directory containing the ``wx/wx.h`` and ``wx/setup.h`` header files. +``WXWINDOWS_LINK_DIRECTORIES`` + Link directories, useful for setting ``rpath`` on Unix-like platforms. +``WXWINDOWS_DEFINITIONS`` + Extra compile definitions needed to use wxWidgets (if any). -.. code-block:: cmake +Hints +^^^^^ - set(WXWINDOWS_USE_GL 1) +This module accepts the following variables before calling the +``find_package(wxWindows)``: -in your CMakeLists.txt *before* you include this file. +``WXWINDOWS_USE_GL`` + Set this variable to boolean true to require OpenGL support. -:: +``HAVE_ISYSTEM`` + Set this variable to boolean true to replace ``-I`` compiler options with + ``-isystem`` when the C++ compiler is GNU (``g++``). - HAVE_ISYSTEM - true required to replace -I by -isystem on g++ +Deprecated Variables +^^^^^^^^^^^^^^^^^^^^ +These variables are provided for backward compatibility: +``CMAKE_WX_CAN_COMPILE`` + .. deprecated:: 1.8 + Replaced by the ``WXWINDOWS_FOUND`` variable with the same value. -For convenience include Use_wxWindows.cmake in your project's -CMakeLists.txt using -include(${CMAKE_CURRENT_LIST_DIR}/Use_wxWindows.cmake). +``WXWINDOWS_LIBRARY`` + .. deprecated:: 1.8 + Replaced by the ``WXWINDOWS_LIBRARIES`` variable with the same value. -USAGE +``CMAKE_WX_CXX_FLAGS`` + .. deprecated:: 1.8 + Replaced by the ``CMAKE_WXWINDOWS_CXX_FLAGS`` variable with the same value. -.. code-block:: cmake +``WXWINDOWS_INCLUDE_PATH`` + .. deprecated:: 1.8 + Replaced by the ``WXWINDOWS_INCLUDE_DIR`` variable with the same value. - set(WXWINDOWS_USE_GL 1) - find_package(wxWindows) +Examples +^^^^^^^^ + +Example: Finding wxWidgets in earlier CMake versions +"""""""""""""""""""""""""""""""""""""""""""""""""""" +In earlier versions of CMake, wxWidgets (wxWindows) could be found using: +.. code-block:: cmake -NOTES wxWidgets 2.6.x is supported for monolithic builds e.g. -compiled in wx/build/msw dir as: + find_package(wxWindows) -:: +To request OpenGL support, the ``WXWINDOWS_USE_GL`` variable could be set before +calling ``find_package()``: - nmake -f makefile.vc BUILD=debug SHARED=0 USE_OPENGL=1 MONOLITHIC=1 +.. code-block:: cmake + set(WXWINDOWS_USE_GL ON) + find_package(wxWindows) +Using wxWidgets (wxWindows) in CMake was commonly done by including the +:module:`Use_wxWindows` module, which would find wxWidgets and set the +appropriate libraries, include directories, and compiler flags: -DEPRECATED +.. code-block:: cmake -:: + include(Use_wxWindows) - CMAKE_WX_CAN_COMPILE - WXWINDOWS_LIBRARY - CMAKE_WX_CXX_FLAGS - WXWINDOWS_INCLUDE_PATH +Example: Finding wxWidgets as of CMake 3.0 +"""""""""""""""""""""""""""""""""""""""""" +Starting with CMake 3.0, wxWidgets can be found using the +:module:`FindwxWidgets` module: +.. code-block:: cmake -AUTHOR Jan Woetzel (07/2003-01/2006) + find_package(wxWidgets) #]=======================================================================] +# AUTHOR Jan Woetzel (07/2003-01/2006) # ------------------------------------------------------------------ # # -removed OPTION for CMAKE_WXWINDOWS_USE_GL. Force the developer to SET it before calling this. -- cgit v0.12