wxWidgets/build/cmake
Maarten Bent f6631a3d6a CMake: Create a config file for use with find_package
The config file uses the wxWidgetsTargets file to find all the libraries that
can be linked to.

It supports checking for components (e.g. base, core, aui, gl) and fails if a
requested component is not found.

Set the version compatibility to SameMinorVersion (when CMake supports this),
because different minor wxWidgets versions (3.0 and 3.1/3.2) are expected to
break API.

Because the default libraries are named like wx::wxname, create an alias that
is just called wx::name. CMake older than 3.18 does not support creating an
alias to non-global imported targets, so manually create a library with the
same properties.

The wxWidgets CMake build only builds the Release and Debug configurations, but
when creating a (MSVC) CMake project it also contains MinSizeRel and
RelWithDebInfo configurations. By default these seems to use the Debug
libraries, causing build errors. Map them to the Release libraries instead.

Also create a wxWidgets_LIBRARIES variable that can be used to link with, so
users can keep using the same variables from FindwxWidgets.
2022-06-18 17:06:15 +02:00
..
benchmarks CMake: Add benchmarks 2021-02-07 20:34:42 +01:00
demos CMake: Use common function for adding samples, tests and demos 2021-01-19 19:58:46 +01:00
lib CMake: Fix building with wxUSE_WEBVIEW_EDGE_STATIC 2022-06-16 13:02:15 +01:00
modules CMake: Mark Cairo and other module variables as advanced 2022-04-26 21:25:56 +02:00
samples CMake: Fix building tests and sample after making target includes private 2022-04-10 23:41:44 +02:00
tests Only read BMP pixel data from stream in LoadBMPData() 2022-06-08 23:49:18 +01:00
utils CMake: Consistent [wx_]install usage 2022-06-18 16:08:35 +02:00
build_cfg.cmake CMake: generate build.cfg 2021-06-18 00:41:45 +02:00
build.cfg.in CMake: generate build.cfg 2021-06-18 00:41:45 +02:00
config.cmake CMake: Fix warning when copying inplace config 2022-04-20 20:33:28 +02:00
files.cmake Add new wx/filedlgcustomize.h to the list of files 2022-06-11 15:13:38 +02:00
functions.cmake CMake: Use correct INSTALL_INTERFACE include directory on Linux 2022-06-18 16:08:35 +02:00
init.cmake CMake: Remove workaround for removing png headers from cairo 2022-04-24 18:47:43 +02:00
install.cmake CMake: Create a config file for use with find_package 2022-06-18 17:06:15 +02:00
main.cmake CMake: Allow to use wxLIB_TARGETS in install.cmake 2022-06-18 16:08:35 +02:00
options.cmake CMake: Add support for external NanoSVG library 2022-05-11 01:54:03 +02:00
pch.cmake CMake: Fix the minimum supported version 2022-04-16 15:35:49 +02:00
policies.cmake
README.md
setup.cmake CMake: Don't use Windows path separators in install prefix 2022-06-18 16:08:29 +02:00
setup.h.in Add NanoSVG setup options 2022-05-05 22:15:49 +02:00
source_groups.cmake CMake: Fix different identifier warning when building with XCode 2022-04-12 22:08:46 +02:00
toolkit.cmake CMake: generate build.cfg 2021-06-18 00:41:45 +02:00
uninstall.cmake.in
wxWidgetsConfig.cmake.in CMake: Create a config file for use with find_package 2022-06-18 17:06:15 +02:00

This directory contains CMake files needed to build native build files for wxWidgets.

For building wxWidgets or using wxWidgets in your CMake project please see the CMake overview in the wxWidgets documentation.

CMake files organization

All CMake files are located in $(wx)/build/cmake additionally there is a CMakeLists.txt in the root directory.

Files

  • $(wx)/CMakeLists.txt
    • This should only contain commands and definitions which need to be contained in the top level and includes main.cmake
  • config.cmake
    • Generates config files used to find wxWidgets by other build systems
    • Creates wx-config
  • files.cmake
    • List of source files generated by $(wx)build/upmake from $(wx)build/files
    • This file should usually never be edited manually
    • However if a new group of files is added it needs to be edited manually
  • functions.cmake
    • contains various wxWidgets specific functions and macros used throughout the CMake files
    • Every function should contain a short description of it's parameters as a comment before the function/macro
  • install.cmake
    • Handles definitions for the install and uninstall target
  • init.cmake
    • Initializes various variables used during the build process and for generation of setup.h and configuration files
  • main.cmake
    • Includes all other cmake files
  • options.cmake
    • All user selectable build options should be defined in this file via calls to wx_option()
  • policies.cmake
  • setup.cmake
    • Handles all tests required to create the setup.h header based platform and user settings
  • setup.h.in
    • Template for setup.h updated automatically by $(wx)/build/update-setup-h
  • source_groups.cmake
    • Define source groups used in supported IDEs
  • toolkit.cmake
    • Define toolkit specific options and detection to this file
  • uninstall.cmake.in
    • Used by install.cmake when creating the uninstall target

Sub directories

Each sub directory contains a CMakeLists.txt and might contain various other .cmake files.

  • demos
    • Defines build targets for demos via wx_add_demo()
  • lib
    • Defines build targets for all libraries and bundle third party libraries
    • Each library is contained in a separate directory and uses wx_add_library() to define the library target
    • Bundled third party library without upstream CMake support are defined in a .cmake file using wx_add_builtin_library() to define static library targets
  • modules
    • Includes CMake modules used to find third party packages via find_package()
    • Includes the cotire module used to for precompiled header generation
  • samples
    • Defines build targets for all samples via wx_add_sample()
    • Definitions for trivial samples are included in CMakeLists.txt more complex samples might have a separate .cmake file
  • tests
    • Defines build targets for all tests
  • utils
    • Defines build targets for all utilities