summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitlab-ci.yml14
-rw-r--r--Help/guide/tutorial/A Basic Starting Point.rst143
-rw-r--r--Help/guide/tutorial/Adding Export Configuration.rst94
-rw-r--r--Help/guide/tutorial/Adding Generator Expressions.rst71
-rw-r--r--Help/guide/tutorial/Adding Support for a Testing Dashboard.rst58
-rw-r--r--Help/guide/tutorial/Adding System Introspection.rst54
-rw-r--r--Help/guide/tutorial/Adding Usage Requirements for a Library.rst49
-rw-r--r--Help/guide/tutorial/Adding a Custom Command and Generated File.rst80
-rw-r--r--Help/guide/tutorial/Adding a Library.rst123
-rw-r--r--Help/guide/tutorial/Installing and Testing.rst90
-rw-r--r--Help/guide/tutorial/Packaging Debug and Release.rst82
-rw-r--r--Help/guide/tutorial/Packaging an Installer.rst56
-rw-r--r--Help/guide/tutorial/Selecting Static or Shared Libraries.rst72
-rw-r--r--Help/guide/tutorial/index.rst973
-rw-r--r--Help/release/3.21.rst291
-rw-r--r--Help/release/dev/0-sample-topic.rst7
-rw-r--r--Help/release/dev/ARMClang-cpu-arch-flags.rst7
-rw-r--r--Help/release/dev/FindDevIL-imported-targets.rst4
-rw-r--r--Help/release/dev/FindIconv-version.rst4
-rw-r--r--Help/release/dev/FindIntl-version.rst4
-rw-r--r--Help/release/dev/FindMsys.rst6
-rw-r--r--Help/release/dev/FindVulkan-add-Headers-glslangValidator-targets.rst5
-rw-r--r--Help/release/dev/UseJava-RESOURCES-NAMESPACE.rst5
-rw-r--r--Help/release/dev/UseSWIG-csharp.rst5
-rw-r--r--Help/release/dev/UseSWIG-dependencies.rst6
-rw-r--r--Help/release/dev/add_custom_command-DEPFILE-genex.rst5
-rw-r--r--Help/release/dev/add_custom_command-DEPFILE.rst6
-rw-r--r--Help/release/dev/add_custom_command-TARGET-genex.rst5
-rw-r--r--Help/release/dev/c-std.rst6
-rw-r--r--Help/release/dev/capabilties-generator-platforms.rst6
-rw-r--r--Help/release/dev/cmake-install-prefix-command.rst8
-rw-r--r--Help/release/dev/cmake-presets-condition.rst4
-rw-r--r--Help/release/dev/cmake-presets-host-system-name.rst5
-rw-r--r--Help/release/dev/cmake-presets-optional-generator-and-binarydir.rst5
-rw-r--r--Help/release/dev/cmake-system-name-version.rst10
-rw-r--r--Help/release/dev/cmake-toolchain-command.rst5
-rw-r--r--Help/release/dev/compile-options-order.rst7
-rw-r--r--Help/release/dev/cpack-dmg-filesystem.rst5
-rw-r--r--Help/release/dev/cpack-install-opts.rst6
-rw-r--r--Help/release/dev/cpack-nsis-executable-name.rst6
-rw-r--r--Help/release/dev/ctest-measurements-docs.rst5
-rw-r--r--Help/release/dev/ctest-output-junit.rst5
-rw-r--r--Help/release/dev/ctest-runtime-files.rst8
-rw-r--r--Help/release/dev/cxx-module-extensions.rst4
-rw-r--r--Help/release/dev/dir-IMPORTED_TARGETS.rst6
-rw-r--r--Help/release/dev/env-toolchain-file.rst5
-rw-r--r--Help/release/dev/file-COPY_FILE.rst4
-rw-r--r--Help/release/dev/file-REAL_PATH-EXPAND_TILDE.rst5
-rw-r--r--Help/release/dev/file-RENAME.rst6
-rw-r--r--Help/release/dev/fileapi-codemodel-directory.rst10
-rw-r--r--Help/release/dev/find_item-NO_CACHE.rst6
-rw-r--r--Help/release/dev/find_item-consistent-behavior.rst6
-rw-r--r--Help/release/dev/foreach-variable-scope.rst5
-rw-r--r--Help/release/dev/fujitsu-compiler-support.rst11
-rw-r--r--Help/release/dev/generate-cmake-build-command-parallel.rst6
-rw-r--r--Help/release/dev/get-runtime-dependencies-file-filter.rst5
-rw-r--r--Help/release/dev/hip.rst5
-rw-r--r--Help/release/dev/ifw-default-version-operator.rst7
-rw-r--r--Help/release/dev/install-imported-runtime-artifacts.rst5
-rw-r--r--Help/release/dev/install-runtime-dependencies.rst9
-rw-r--r--Help/release/dev/install-script-all-components.rst7
-rw-r--r--Help/release/dev/link-objects-first.rst8
-rw-r--r--Help/release/dev/linker-launcher.rst7
-rw-r--r--Help/release/dev/list-index-arg-parsing.rst7
-rw-r--r--Help/release/dev/lzma-threads.rst7
-rw-r--r--Help/release/dev/message-color.rst4
-rw-r--r--Help/release/dev/msys.rst4
-rw-r--r--Help/release/dev/ninja-absolute-paths.rst6
-rw-r--r--Help/release/dev/nmake-utf8.rst5
-rw-r--r--Help/release/dev/objc-std-17-23.rst4
-rw-r--r--Help/release/dev/project-is-top-level.rst6
-rw-r--r--Help/release/dev/runtime-dll-deps.rst4
-rw-r--r--Help/release/dev/set-cache-variable.rst5
-rw-r--r--Help/release/dev/xcode_app_extensions.rst11
-rw-r--r--Help/release/index.rst3
-rw-r--r--Help/variable/CPACK_CUSTOM_INSTALL_VARIABLES.rst2
-rw-r--r--Modules/Internal/CheckCompilerFlag.cmake6
-rw-r--r--Source/CMakeVersion.cmake6
-rw-r--r--Utilities/Sphinx/cmake.py11
79 files changed, 1326 insertions, 1302 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index d224088..bbed2e2 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -52,7 +52,7 @@ prep:doc-package:
- .cmake_doc_artifacts
- .run_only_for_package
-upload:source-package:
+.upload:source-package:
extends:
- .rsync_upload_binary
- .run_only_for_package
@@ -70,7 +70,7 @@ build:help:master:
- .cmake_org_help
- .run_only_for_continuous_master
-upload:help:master:
+.upload:help:master:
extends:
- .rsync_upload_help
- .run_only_for_continuous_master
@@ -86,7 +86,7 @@ build:help:stage:
- .cmake_org_help
- .run_only_for_continuous_stage
-upload:help:stage:
+.upload:help:stage:
extends:
- .rsync_upload_help
- .run_only_for_continuous_stage
@@ -495,7 +495,7 @@ build:linux-x86_64-package:
needs:
- prep:doc-package
-upload:linux-x86_64-package:
+.upload:linux-x86_64-package:
extends:
- .rsync_upload_binary
- .run_only_for_package
@@ -519,7 +519,7 @@ build:linux-aarch64-package:
needs:
- prep:doc-package
-upload:linux-aarch64-package:
+.upload:linux-aarch64-package:
extends:
- .rsync_upload_binary
- .run_only_for_package
@@ -656,7 +656,7 @@ build:macos-package:
needs:
- prep:doc-package
-upload:macos-package:
+.upload:macos-package:
extends:
- .rsync_upload_binary
- .run_only_for_package
@@ -679,7 +679,7 @@ build:macos10.10-package:
needs:
- prep:doc-package
-upload:macos10.10-package:
+.upload:macos10.10-package:
extends:
- .rsync_upload_binary
- .run_only_for_package
diff --git a/Help/guide/tutorial/A Basic Starting Point.rst b/Help/guide/tutorial/A Basic Starting Point.rst
new file mode 100644
index 0000000..20e4129
--- /dev/null
+++ b/Help/guide/tutorial/A Basic Starting Point.rst
@@ -0,0 +1,143 @@
+Step 1: A Basic Starting Point
+==============================
+
+The most basic project is an executable built from source code files.
+For simple projects, a three line ``CMakeLists.txt`` file is all that is
+required. This will be the starting point for our tutorial. Create a
+``CMakeLists.txt`` file in the ``Step1`` directory that looks like:
+
+.. code-block:: cmake
+ :caption: CMakeLists.txt
+
+ cmake_minimum_required(VERSION 3.10)
+
+ # set the project name
+ project(Tutorial)
+
+ # add the executable
+ add_executable(Tutorial tutorial.cxx)
+
+
+Note that this example uses lower case commands in the ``CMakeLists.txt`` file.
+Upper, lower, and mixed case commands are supported by CMake. The source
+code for ``tutorial.cxx`` is provided in the ``Step1`` directory and can be
+used to compute the square root of a number.
+
+Adding a Version Number and Configured Header File
+--------------------------------------------------
+
+The first feature we will add is to provide our executable and project with a
+version number. While we could do this exclusively in the source code, using
+``CMakeLists.txt`` provides more flexibility.
+
+First, modify the ``CMakeLists.txt`` file to use the :command:`project` command
+to set the project name and version number.
+
+.. literalinclude:: Step2/CMakeLists.txt
+ :caption: CMakeLists.txt
+ :language: cmake
+ :end-before: # specify the C++ standard
+
+Then, configure a header file to pass the version number to the source
+code:
+
+.. literalinclude:: Step2/CMakeLists.txt
+ :caption: CMakeLists.txt
+ :language: cmake
+ :start-after: # to the source code
+ :end-before: # add the executable
+
+Since the configured file will be written into the binary tree, we
+must add that directory to the list of paths to search for include
+files. Add the following lines to the end of the ``CMakeLists.txt`` file:
+
+.. literalinclude:: Step2/CMakeLists.txt
+ :caption: CMakeLists.txt
+ :language: cmake
+ :start-after: # so that we will find TutorialConfig.h
+
+Using your favorite editor, create ``TutorialConfig.h.in`` in the source
+directory with the following contents:
+
+.. literalinclude:: Step2/TutorialConfig.h.in
+ :caption: TutorialConfig.h.in
+ :language: c++
+
+When CMake configures this header file the values for
+``@Tutorial_VERSION_MAJOR@`` and ``@Tutorial_VERSION_MINOR@`` will be
+replaced.
+
+Next modify ``tutorial.cxx`` to include the configured header file,
+``TutorialConfig.h``.
+
+Finally, let's print out the executable name and version number by updating
+``tutorial.cxx`` as follows:
+
+.. literalinclude:: Step2/tutorial.cxx
+ :caption: tutorial.cxx
+ :language: c++
+ :start-after: {
+ :end-before: // convert input to double
+
+Specify the C++ Standard
+-------------------------
+
+Next let's add some C++11 features to our project by replacing ``atof`` with
+``std::stod`` in ``tutorial.cxx``. At the same time, remove
+``#include <cstdlib>``.
+
+.. literalinclude:: Step2/tutorial.cxx
+ :caption: tutorial.cxx
+ :language: c++
+ :start-after: // convert input to double
+ :end-before: // calculate square root
+
+We will need to explicitly state in the CMake code that it should use the
+correct flags. The easiest way to enable support for a specific C++ standard
+in CMake is by using the :variable:`CMAKE_CXX_STANDARD` variable. For this
+tutorial, set the :variable:`CMAKE_CXX_STANDARD` variable in the
+``CMakeLists.txt`` file to ``11`` and :variable:`CMAKE_CXX_STANDARD_REQUIRED`
+to ``True``. Make sure to add the ``CMAKE_CXX_STANDARD`` declarations above the
+call to ``add_executable``.
+
+.. literalinclude:: Step2/CMakeLists.txt
+ :caption: CMakeLists.txt
+ :language: cmake
+ :end-before: # configure a header file to pass some of the CMake settings
+
+Build and Test
+--------------
+
+Run the :manual:`cmake <cmake(1)>` executable or the
+:manual:`cmake-gui <cmake-gui(1)>` to configure the project and then build it
+with your chosen build tool.
+
+For example, from the command line we could navigate to the
+``Help/guide/tutorial`` directory of the CMake source code tree and create a
+build directory:
+
+.. code-block:: console
+
+ mkdir Step1_build
+
+Next, navigate to the build directory and run CMake to configure the project
+and generate a native build system:
+
+.. code-block:: console
+
+ cd Step1_build
+ cmake ../Step1
+
+Then call that build system to actually compile/link the project:
+
+.. code-block:: console
+
+ cmake --build .
+
+Finally, try to use the newly built ``Tutorial`` with these commands:
+
+.. code-block:: console
+
+ Tutorial 4294967296
+ Tutorial 10
+ Tutorial
diff --git a/Help/guide/tutorial/Adding Export Configuration.rst b/Help/guide/tutorial/Adding Export Configuration.rst
new file mode 100644
index 0000000..da0d877
--- /dev/null
+++ b/Help/guide/tutorial/Adding Export Configuration.rst
@@ -0,0 +1,94 @@
+Step 11: Adding Export Configuration
+====================================
+
+During :guide:`tutorial/Installing and Testing` of the tutorial we added the
+ability for CMake to install the library and headers of the project. During
+:guide:`tutorial/Packaging an Installer` we added the ability to package up
+this information so it could be distributed to other people.
+
+The next step is to add the necessary information so that other CMake projects
+can use our project, be it from a build directory, a local install or when
+packaged.
+
+The first step is to update our :command:`install(TARGETS)` commands to not
+only specify a ``DESTINATION`` but also an ``EXPORT``. The ``EXPORT`` keyword
+generates and installs a CMake file containing code to import all targets
+listed in the install command from the installation tree. So let's go ahead and
+explicitly ``EXPORT`` the ``MathFunctions`` library by updating the ``install``
+command in ``MathFunctions/CMakeLists.txt`` to look like:
+
+.. literalinclude:: Complete/MathFunctions/CMakeLists.txt
+ :caption: MathFunctions/CMakeLists.txt
+ :language: cmake
+ :start-after: # install rules
+
+Now that we have ``MathFunctions`` being exported, we also need to explicitly
+install the generated ``MathFunctionsTargets.cmake`` file. This is done by
+adding the following to the bottom of the top-level ``CMakeLists.txt``:
+
+.. literalinclude:: Complete/CMakeLists.txt
+ :caption: CMakeLists.txt
+ :language: cmake
+ :start-after: # install the configuration targets
+ :end-before: include(CMakePackageConfigHelpers)
+
+At this point you should try and run CMake. If everything is setup properly
+you will see that CMake will generate an error that looks like:
+
+.. code-block:: console
+
+ Target "MathFunctions" INTERFACE_INCLUDE_DIRECTORIES property contains
+ path:
+
+ "/Users/robert/Documents/CMakeClass/Tutorial/Step11/MathFunctions"
+
+ which is prefixed in the source directory.
+
+What CMake is trying to say is that during generating the export information
+it will export a path that is intrinsically tied to the current machine and
+will not be valid on other machines. The solution to this is to update the
+``MathFunctions`` :command:`target_include_directories` to understand that it
+needs different ``INTERFACE`` locations when being used from within the build
+directory and from an install / package. This means converting the
+:command:`target_include_directories` call for ``MathFunctions`` to look like:
+
+.. literalinclude:: Step12/MathFunctions/CMakeLists.txt
+ :caption: MathFunctions/CMakeLists.txt
+ :language: cmake
+ :start-after: # to find MathFunctions.h, while we don't.
+ :end-before: # should we use our own math functions
+
+Once this has been updated, we can re-run CMake and verify that it doesn't
+warn anymore.
+
+At this point, we have CMake properly packaging the target information that is
+required but we will still need to generate a ``MathFunctionsConfig.cmake`` so
+that the CMake :command:`find_package` command can find our project. So let's go
+ahead and add a new file to the top-level of the project called
+``Config.cmake.in`` with the following contents:
+
+.. literalinclude:: Step12/Config.cmake.in
+ :caption: Config.cmake.in
+
+Then, to properly configure and install that file, add the following to the
+bottom of the top-level ``CMakeLists.txt``:
+
+.. literalinclude:: Step12/CMakeLists.txt
+ :caption: CMakeLists.txt
+ :language: cmake
+ :start-after: # install the configuration targets
+ :end-before: # generate the export
+
+At this point, we have generated a relocatable CMake Configuration for our
+project that can be used after the project has been installed or packaged. If
+we want our project to also be used from a build directory we only have to add
+the following to the bottom of the top level ``CMakeLists.txt``:
+
+.. literalinclude:: Step12/CMakeLists.txt
+ :caption: CMakeLists.txt
+ :language: cmake
+ :start-after: # needs to be after the install(TARGETS ) command
+
+With this export call we now generate a ``Targets.cmake``, allowing the
+configured ``MathFunctionsConfig.cmake`` in the build directory to be used by
+other projects, without needing it to be installed.
diff --git a/Help/guide/tutorial/Adding Generator Expressions.rst b/Help/guide/tutorial/Adding Generator Expressions.rst
new file mode 100644
index 0000000..b21fc62
--- /dev/null
+++ b/Help/guide/tutorial/Adding Generator Expressions.rst
@@ -0,0 +1,71 @@
+Step 10: Adding Generator Expressions
+=====================================
+
+:manual:`Generator expressions <cmake-generator-expressions(7)>` are evaluated
+during build system generation to produce information specific to each build
+configuration.
+
+:manual:`Generator expressions <cmake-generator-expressions(7)>` are allowed in
+the context of many target properties, such as :prop_tgt:`LINK_LIBRARIES`,
+:prop_tgt:`INCLUDE_DIRECTORIES`, :prop_tgt:`COMPILE_DEFINITIONS` and others.
+They may also be used when using commands to populate those properties, such as
+:command:`target_link_libraries`, :command:`target_include_directories`,
+:command:`target_compile_definitions` and others.
+
+:manual:`Generator expressions <cmake-generator-expressions(7)>` may be used
+to enable conditional linking, conditional definitions used when compiling,
+conditional include directories and more. The conditions may be based on the
+build configuration, target properties, platform information or any other
+queryable information.
+
+There are different types of
+:manual:`generator expressions <cmake-generator-expressions(7)>` including
+Logical, Informational, and Output expressions.
+
+Logical expressions are used to create conditional output. The basic
+expressions are the ``0`` and ``1`` expressions. A ``$<0:...>`` results in the
+empty string, and ``<1:...>`` results in the content of ``...``. They can also
+be nested.
+
+A common usage of
+:manual:`generator expressions <cmake-generator-expressions(7)>` is to
+conditionally add compiler flags, such as those for language levels or
+warnings. A nice pattern is to associate this information to an ``INTERFACE``
+target allowing this information to propagate. Let's start by constructing an
+``INTERFACE`` target and specifying the required C++ standard level of ``11``
+instead of using :variable:`CMAKE_CXX_STANDARD`.
+
+So the following code:
+
+.. literalinclude:: Step10/CMakeLists.txt
+ :caption: CMakeLists.txt
+ :language: cmake
+ :start-after: project(Tutorial VERSION 1.0)
+ :end-before: # control where the static and shared libraries are built so that on windows
+
+Would be replaced with:
+
+.. literalinclude:: Step11/CMakeLists.txt
+ :caption: CMakeLists.txt
+ :language: cmake
+ :start-after: project(Tutorial VERSION 1.0)
+ :end-before: # add compiler warning flags just when building this project via
+
+
+Next we add the desired compiler warning flags that we want for our project. As
+warning flags vary based on the compiler we use the ``COMPILE_LANG_AND_ID``
+generator expression to control which flags to apply given a language and a set
+of compiler ids as seen below:
+
+.. literalinclude:: Step11/CMakeLists.txt
+ :caption: CMakeLists.txt
+ :language: cmake
+ :start-after: # the BUILD_INTERFACE genex
+ :end-before: # control where the static and shared libraries are built so that on windows
+
+Looking at this we see that the warning flags are encapsulated inside a
+``BUILD_INTERFACE`` condition. This is done so that consumers of our installed
+project will not inherit our warning flags.
+
+**Exercise**: Modify ``MathFunctions/CMakeLists.txt`` so that all targets have
+a :command:`target_link_libraries` call to ``tutorial_compiler_flags``.
diff --git a/Help/guide/tutorial/Adding Support for a Testing Dashboard.rst b/Help/guide/tutorial/Adding Support for a Testing Dashboard.rst
new file mode 100644
index 0000000..9cdbb34
--- /dev/null
+++ b/Help/guide/tutorial/Adding Support for a Testing Dashboard.rst
@@ -0,0 +1,58 @@
+Step 8: Adding Support for a Testing Dashboard
+==============================================
+
+Adding support for submitting our test results to a dashboard is simple. We
+already defined a number of tests for our project in
+:ref:`Testing Support <Tutorial Testing Support>`. Now we just have to run
+those tests and submit them to a dashboard. To include support for dashboards
+we include the :module:`CTest` module in our top-level ``CMakeLists.txt``.
+
+Replace:
+
+.. code-block:: cmake
+ :caption: CMakeLists.txt
+
+ # enable testing
+ enable_testing()
+
+With:
+
+.. code-block:: cmake
+ :caption: CMakeLists.txt
+
+ # enable dashboard scripting
+ include(CTest)
+
+The :module:`CTest` module will automatically call ``enable_testing()``, so we
+can remove it from our CMake files.
+
+We will also need to create a ``CTestConfig.cmake`` file in the top-level
+directory where we can specify the name of the project and where to submit the
+dashboard.
+
+.. literalinclude:: Step9/CTestConfig.cmake
+ :caption: CTestConfig.cmake
+ :language: cmake
+
+The :manual:`ctest <ctest(1)>` executable will read in this file when it runs.
+To create a simple dashboard you can run the :manual:`cmake <cmake(1)>`
+executable or the :manual:`cmake-gui <cmake-gui(1)>` to configure the project,
+but do not build it yet. Instead, change directory to the binary tree, and then
+run:
+
+.. code-block:: console
+
+ ctest [-VV] -D Experimental
+
+Remember, for multi-config generators (e.g. Visual Studio), the configuration
+type must be specified:
+
+.. code-block:: console
+
+ ctest [-VV] -C Debug -D Experimental
+
+Or, from an IDE, build the ``Experimental`` target.
+
+The :manual:`ctest <ctest(1)>` executable will build and test the project and
+submit the results to Kitware's public dashboard:
+https://my.cdash.org/index.php?project=CMakeTutorial.
diff --git a/Help/guide/tutorial/Adding System Introspection.rst b/Help/guide/tutorial/Adding System Introspection.rst
new file mode 100644
index 0000000..c11f793
--- /dev/null
+++ b/Help/guide/tutorial/Adding System Introspection.rst
@@ -0,0 +1,54 @@
+Step 5: Adding System Introspection
+===================================
+
+Let us consider adding some code to our project that depends on features the
+target platform may not have. For this example, we will add some code that
+depends on whether or not the target platform has the ``log`` and ``exp``
+functions. Of course almost every platform has these functions but for this
+tutorial assume that they are not common.
+
+If the platform has ``log`` and ``exp`` then we will use them to compute the
+square root in the ``mysqrt`` function. We first test for the availability of
+these functions using the :module:`CheckSymbolExists` module in
+``MathFunctions/CMakeLists.txt``. On some platforms, we will need to link to
+the ``m`` library. If ``log`` and ``exp`` are not initially found, require the
+``m`` library and try again.
+
+.. literalinclude:: Step6/MathFunctions/CMakeLists.txt
+ :caption: MathFunctions/CMakeLists.txt
+ :language: cmake
+ :start-after: # does this system provide the log and exp functions?
+ :end-before: # add compile definitions
+
+If available, use :command:`target_compile_definitions` to specify
+``HAVE_LOG`` and ``HAVE_EXP`` as ``PRIVATE`` compile definitions.
+
+.. literalinclude:: Step6/MathFunctions/CMakeLists.txt
+ :caption: MathFunctions/CMakeLists.txt
+ :language: cmake
+ :start-after: # add compile definitions
+ :end-before: # install rules
+
+If ``log`` and ``exp`` are available on the system, then we will use them to
+compute the square root in the ``mysqrt`` function. Add the following code to
+the ``mysqrt`` function in ``MathFunctions/mysqrt.cxx`` (don't forget the
+``#endif`` before returning the result!):
+
+.. literalinclude:: Step6/MathFunctions/mysqrt.cxx
+ :caption: MathFunctions/mysqrt.cxx
+ :language: c++
+ :start-after: // if we have both log and exp then use them
+ :end-before: // do ten iterations
+
+We will also need to modify ``mysqrt.cxx`` to include ``cmath``.
+
+.. literalinclude:: Step6/MathFunctions/mysqrt.cxx
+ :caption: MathFunctions/mysqrt.cxx
+ :language: c++
+ :end-before: #include <iostream>
+
+Run the :manual:`cmake <cmake(1)>` executable or the
+:manual:`cmake-gui <cmake-gui(1)>` to configure the project and then build it
+with your chosen build tool and run the Tutorial executable.
+
+Which function gives better results now, ``sqrt`` or ``mysqrt``?
diff --git a/Help/guide/tutorial/Adding Usage Requirements for a Library.rst b/Help/guide/tutorial/Adding Usage Requirements for a Library.rst
new file mode 100644
index 0000000..8ef9cc6
--- /dev/null
+++ b/Help/guide/tutorial/Adding Usage Requirements for a Library.rst
@@ -0,0 +1,49 @@
+Step 3: Adding Usage Requirements for a Library
+===============================================
+
+Usage requirements allow for far better control over a library or executable's
+link and include line while also giving more control over the transitive
+property of targets inside CMake. The primary commands that leverage usage
+requirements are:
+
+ - :command:`target_compile_definitions`
+ - :command:`target_compile_options`
+ - :command:`target_include_directories`
+ - :command:`target_link_libraries`
+
+Let's refactor our code from :guide:`tutorial/Adding a Library` to use the
+modern CMake approach of usage requirements. We first state that anybody
+linking to ``MathFunctions`` needs to include the current source directory,
+while ``MathFunctions`` itself doesn't. So this can become an ``INTERFACE``
+usage requirement.
+
+Remember ``INTERFACE`` means things that consumers require but the producer
+doesn't. Add the following lines to the end of
+``MathFunctions/CMakeLists.txt``:
+
+.. literalinclude:: Step4/MathFunctions/CMakeLists.txt
+ :caption: MathFunctions/CMakeLists.txt
+ :language: cmake
+ :start-after: # to find MathFunctions.h
+
+Now that we've specified usage requirements for ``MathFunctions`` we can safely
+remove our uses of the ``EXTRA_INCLUDES`` variable from the top-level
+``CMakeLists.txt``, here:
+
+.. literalinclude:: Step4/CMakeLists.txt
+ :caption: CMakeLists.txt
+ :language: cmake
+ :start-after: # add the MathFunctions library
+ :end-before: # add the executable
+
+And here:
+
+.. literalinclude:: Step4/CMakeLists.txt
+ :caption: CMakeLists.txt
+ :language: cmake
+ :start-after: # so that we will find TutorialConfig.h
+
+Once this is done, run the :manual:`cmake <cmake(1)>` executable or the
+:manual:`cmake-gui <cmake-gui(1)>` to configure the project and then build it
+with your chosen build tool or by using ``cmake --build .`` from the build
+directory.
diff --git a/Help/guide/tutorial/Adding a Custom Command and Generated File.rst b/Help/guide/tutorial/Adding a Custom Command and Generated File.rst
new file mode 100644
index 0000000..c60379a
--- /dev/null
+++ b/Help/guide/tutorial/Adding a Custom Command and Generated File.rst
@@ -0,0 +1,80 @@
+Step 6: Adding a Custom Command and Generated File
+==================================================
+
+Suppose, for the purpose of this tutorial, we decide that we never want to use
+the platform ``log`` and ``exp`` functions and instead would like to
+generate a table of precomputed values to use in the ``mysqrt`` function.
+In this section, we will create the table as part of the build process,
+and then compile that table into our application.
+
+First, let's remove the check for the ``log`` and ``exp`` functions in
+``MathFunctions/CMakeLists.txt``. Then remove the check for ``HAVE_LOG`` and
+``HAVE_EXP`` from ``mysqrt.cxx``. At the same time, we can remove
+:code:`#include <cmath>`.
+
+In the ``MathFunctions`` subdirectory, a new source file named
+``MakeTable.cxx`` has been provided to generate the table.
+
+After reviewing the file, we can see that the table is produced as valid C++
+code and that the output filename is passed in as an argument.
+
+The next step is to add the appropriate commands to the
+``MathFunctions/CMakeLists.txt`` file to build the MakeTable executable and
+then run it as part of the build process. A few commands are needed to
+accomplish this.
+
+First, at the top of ``MathFunctions/CMakeLists.txt``, the executable for
+``MakeTable`` is added as any other executable would be added.
+
+.. literalinclude:: Step7/MathFunctions/CMakeLists.txt
+ :caption: MathFunctions/CMakeLists.txt
+ :language: cmake
+ :start-after: # first we add the executable that generates the table
+ :end-before: # add the command to generate the source code
+
+Then we add a custom command that specifies how to produce ``Table.h``
+by running MakeTable.
+
+.. literalinclude:: Step7/MathFunctions/CMakeLists.txt
+ :caption: MathFunctions/CMakeLists.txt
+ :language: cmake
+ :start-after: # add the command to generate the source code
+ :end-before: # add the main library
+
+Next we have to let CMake know that ``mysqrt.cxx`` depends on the generated
+file ``Table.h``. This is done by adding the generated ``Table.h`` to the list
+of sources for the library MathFunctions.
+
+.. literalinclude:: Step7/MathFunctions/CMakeLists.txt
+ :caption: MathFunctions/CMakeLists.txt
+ :language: cmake
+ :start-after: # add the main library
+ :end-before: # state that anybody linking
+
+We also have to add the current binary directory to the list of include
+directories so that ``Table.h`` can be found and included by ``mysqrt.cxx``.
+
+.. literalinclude:: Step7/MathFunctions/CMakeLists.txt
+ :caption: MathFunctions/CMakeLists.txt
+ :language: cmake
+ :start-after: # state that we depend on our bin
+ :end-before: # install rules
+
+Now let's use the generated table. First, modify ``mysqrt.cxx`` to include
+``Table.h``. Next, we can rewrite the ``mysqrt`` function to use the table:
+
+.. literalinclude:: Step7/MathFunctions/mysqrt.cxx
+ :caption: MathFunctions/mysqrt.cxx
+ :language: c++
+ :start-after: // a hack square root calculation using simple operations
+
+Run the :manual:`cmake <cmake(1)>` executable or the
+:manual:`cmake-gui <cmake-gui(1)>` to configure the project and then build it
+with your chosen build tool.
+
+When this project is built it will first build the ``MakeTable`` executable.
+It will then run ``MakeTable`` to produce ``Table.h``. Finally, it will
+compile ``mysqrt.cxx`` which includes ``Table.h`` to produce the
+``MathFunctions`` library.
+
+Run the Tutorial executable and verify that it is using the table.
diff --git a/Help/guide/tutorial/Adding a Library.rst b/Help/guide/tutorial/Adding a Library.rst
new file mode 100644
index 0000000..02f7ed1
--- /dev/null
+++ b/Help/guide/tutorial/Adding a Library.rst
@@ -0,0 +1,123 @@
+Step 2: Adding a Library
+========================
+
+Now we will add a library to our project. This library will contain our own
+implementation for computing the square root of a number. The executable can
+then use this library instead of the standard square root function provided by
+the compiler.
+
+For this tutorial we will put the library into a subdirectory
+called ``MathFunctions``. This directory already contains a header file,
+``MathFunctions.h``, and a source file ``mysqrt.cxx``. The source file has one
+function called ``mysqrt`` that provides similar functionality to the
+compiler's ``sqrt`` function.
+
+Add the following one line ``CMakeLists.txt`` file to the ``MathFunctions``
+directory:
+
+.. literalinclude:: Step3/MathFunctions/CMakeLists.txt
+ :caption: MathFunctions/CMakeLists.txt
+ :language: cmake
+
+To make use of the new library we will add an :command:`add_subdirectory`
+call in the top-level ``CMakeLists.txt`` file so that the library will get
+built. We add the new library to the executable, and add ``MathFunctions`` as
+an include directory so that the ``mysqrt.h`` header file can be found. The
+last few lines of the top-level ``CMakeLists.txt`` file should now look like:
+
+.. code-block:: cmake
+ :caption: CMakeLists.txt
+
+ # add the MathFunctions library
+ add_subdirectory(MathFunctions)
+
+ # add the executable
+ add_executable(Tutorial tutorial.cxx)
+
+ target_link_libraries(Tutorial PUBLIC MathFunctions)
+
+ # add the binary tree to the search path for include files
+ # so that we will find TutorialConfig.h
+ target_include_directories(Tutorial PUBLIC
+ "${PROJECT_BINARY_DIR}"
+ "${PROJECT_SOURCE_DIR}/MathFunctions"
+ )
+
+Now let us make the ``MathFunctions`` library optional. While for the tutorial
+there really isn't any need to do so, for larger projects this is a common
+occurrence. The first step is to add an option to the top-level
+``CMakeLists.txt`` file.
+
+.. literalinclude:: Step3/CMakeLists.txt
+ :caption: CMakeLists.txt
+ :language: cmake
+ :start-after: # should we use our own math functions
+ :end-before: # add the MathFunctions library
+
+This option will be displayed in the :manual:`cmake-gui <cmake-gui(1)>` and
+:manual:`ccmake <ccmake(1)>`
+with a default value of ``ON`` that can be changed by the user. This setting
+will be stored in the cache so that the user does not need to set the value
+each time they run CMake on a build directory.
+
+The next change is to make building and linking the ``MathFunctions`` library
+conditional. To do this we change the end of the top-level ``CMakeLists.txt``
+file to look like the following:
+
+.. literalinclude:: Step3/CMakeLists.txt
+ :caption: CMakeLists.txt
+ :language: cmake
+ :start-after: # add the MathFunctions library
+
+Note the use of the variable ``EXTRA_LIBS`` to collect up any optional
+libraries to later be linked into the executable. The variable
+``EXTRA_INCLUDES`` is used similarly for optional header files. This is a
+classic approach when dealing with many optional components, we will cover
+the modern approach in the next step.
+
+The corresponding changes to the source code are fairly straightforward.
+First, in ``tutorial.cxx``, include the ``MathFunctions.h`` header if we
+need it:
+
+.. literalinclude:: Step3/tutorial.cxx
+ :caption: tutorial.cxx
+ :language: c++
+ :start-after: // should we include the MathFunctions header
+ :end-before: int main
+
+Then, in the same file, make ``USE_MYMATH`` control which square root
+function is used:
+
+.. literalinclude:: Step3/tutorial.cxx
+ :caption: tutorial.cxx
+ :language: c++
+ :start-after: // which square root function should we use?
+ :end-before: std::cout << "The square root of
+
+Since the source code now requires ``USE_MYMATH`` we can add it to
+``TutorialConfig.h.in`` with the following line:
+
+.. literalinclude:: Step3/TutorialConfig.h.in
+ :caption: TutorialConfig.h.in
+ :language: c++
+ :lines: 4
+
+**Exercise**: Why is it important that we configure ``TutorialConfig.h.in``
+after the option for ``USE_MYMATH``? What would happen if we inverted the two?
+
+Run the :manual:`cmake <cmake(1)>` executable or the
+:manual:`cmake-gui <cmake-gui(1)>` to configure the project and then build it
+with your chosen build tool. Then run the built Tutorial executable.
+
+Now let's update the value of ``USE_MYMATH``. The easiest way is to use the
+:manual:`cmake-gui <cmake-gui(1)>` or :manual:`ccmake <ccmake(1)>` if you're
+in the terminal. Or, alternatively, if you want to change the option from the
+command-line, try:
+
+.. code-block:: console
+
+ cmake ../Step2 -DUSE_MYMATH=OFF
+
+Rebuild and run the tutorial again.
+
+Which function gives better results, ``sqrt`` or ``mysqrt``?
diff --git a/Help/guide/tutorial/Installing and Testing.rst b/Help/guide/tutorial/Installing and Testing.rst
new file mode 100644
index 0000000..53f0363
--- /dev/null
+++ b/Help/guide/tutorial/Installing and Testing.rst
@@ -0,0 +1,90 @@
+Step 4: Installing and Testing
+==============================
+
+Now we can start adding install rules and testing support to our project.
+
+Install Rules
+-------------
+
+The install rules are fairly simple: for ``MathFunctions`` we want to install
+the library and header file and for the application we want to install the
+executable and configured header.
+
+So to the end of ``MathFunctions/CMakeLists.txt`` we add:
+
+.. literalinclude:: Step5/MathFunctions/CMakeLists.txt
+ :caption: MathFunctions/CMakeLists.txt
+ :language: cmake
+ :start-after: # install rules
+
+And to the end of the top-level ``CMakeLists.txt`` we add:
+
+.. literalinclude:: Step5/CMakeLists.txt
+ :caption: CMakeLists.txt
+ :language: cmake
+ :start-after: # add the install targets
+ :end-before: # enable testing
+
+That is all that is needed to create a basic local install of the tutorial.
+
+Now run the :manual:`cmake <cmake(1)>` executable or the
+:manual:`cmake-gui <cmake-gui(1)>` to configure the project and then build it
+with your chosen build tool.
+
+Then run the install step by using the ``install`` option of the
+:manual:`cmake <cmake(1)>` command (introduced in 3.15, older versions of
+CMake must use ``make install``) from the command line. For
+multi-configuration tools, don't forget to use the ``--config`` argument to
+specify the configuration. If using an IDE, simply build the ``INSTALL``
+target. This step will install the appropriate header files, libraries, and
+executables. For example:
+
+.. code-block:: console
+
+ cmake --install .
+
+The CMake variable :variable:`CMAKE_INSTALL_PREFIX` is used to determine the
+root of where the files will be installed. If using the ``cmake --install``
+command, the installation prefix can be overridden via the ``--prefix``
+argument. For example:
+
+.. code-block:: console
+
+ cmake --install . --prefix "/home/myuser/installdir"
+
+Navigate to the install directory and verify that the installed Tutorial runs.
+
+.. _`Tutorial Testing Support`:
+
+Testing Support
+---------------
+
+Next let's test our application. At the end of the top-level ``CMakeLists.txt``
+file we can enable testing and then add a number of basic tests to verify that
+the application is working correctly.
+
+.. literalinclude:: Step5/CMakeLists.txt
+ :caption: CMakeLists.txt
+ :language: cmake
+ :start-after: # enable testing
+
+The first test simply verifies that the application runs, does not segfault or
+otherwise crash, and has a zero return value. This is the basic form of a
+CTest test.
+
+The next test makes use of the :prop_test:`PASS_REGULAR_EXPRESSION` test
+property to verify that the output of the test contains certain strings. In
+this case, verifying that the usage message is printed when an incorrect number
+of arguments are provided.
+
+Lastly, we have a function called ``do_test`` that runs the application and
+verifies that the computed square root is correct for given input. For each
+invocation of ``do_test``, another test is added to the project with a name,
+input, and expected results based on the passed arguments.
+
+Rebuild the application and then cd to the binary directory and run the
+:manual:`ctest <ctest(1)>` executable: ``ctest -N`` and ``ctest -VV``. For
+multi-config generators (e.g. Visual Studio), the configuration type must be
+specified. To run tests in Debug mode, for example, use ``ctest -C Debug -VV``
+from the build directory (not the Debug subdirectory!). Alternatively, build
+the ``RUN_TESTS`` target from the IDE.
diff --git a/Help/guide/tutorial/Packaging Debug and Release.rst b/Help/guide/tutorial/Packaging Debug and Release.rst
new file mode 100644
index 0000000..c2bf1b5
--- /dev/null
+++ b/Help/guide/tutorial/Packaging Debug and Release.rst
@@ -0,0 +1,82 @@
+Step 12: Packaging Debug and Release
+====================================
+
+**Note:** This example is valid for single-configuration generators and will
+not work for multi-configuration generators (e.g. Visual Studio).
+
+By default, CMake's model is that a build directory only contains a single
+configuration, be it Debug, Release, MinSizeRel, or RelWithDebInfo. It is
+possible, however, to setup CPack to bundle multiple build directories and
+construct a package that contains multiple configurations of the same project.
+
+First, we want to ensure that the debug and release builds use different names
+for the executables and libraries that will be installed. Let's use `d` as the
+postfix for the debug executable and libraries.
+
+Set :variable:`CMAKE_DEBUG_POSTFIX` near the beginning of the top-level
+``CMakeLists.txt`` file:
+
+.. literalinclude:: Complete/CMakeLists.txt
+ :caption: CMakeLists.txt
+ :language: cmake
+ :start-after: project(Tutorial VERSION 1.0)
+ :end-before: target_compile_features(tutorial_compiler_flags
+
+And the :prop_tgt:`DEBUG_POSTFIX` property on the tutorial executable:
+
+.. literalinclude:: Complete/CMakeLists.txt
+ :caption: CMakeLists.txt
+ :language: cmake
+ :start-after: # add the executable
+ :end-before: # add the binary tree to the search path for include files
+
+Let's also add version numbering to the ``MathFunctions`` library. In
+``MathFunctions/CMakeLists.txt``, set the :prop_tgt:`VERSION` and
+:prop_tgt:`SOVERSION` properties:
+
+.. literalinclude:: Complete/MathFunctions/CMakeLists.txt
+ :caption: MathFunctions/CMakeLists.txt
+ :language: cmake
+ :start-after: # setup the version numbering
+ :end-before: # install rules
+
+From the ``Step12`` directory, create ``debug`` and ``release``
+subbdirectories. The layout will look like:
+
+.. code-block:: none
+
+ - Step12
+ - debug
+ - release
+
+Now we need to setup debug and release builds. We can use
+:variable:`CMAKE_BUILD_TYPE` to set the configuration type:
+
+.. code-block:: console
+
+ cd debug
+ cmake -DCMAKE_BUILD_TYPE=Debug ..
+ cmake --build .
+ cd ../release
+ cmake -DCMAKE_BUILD_TYPE=Release ..
+ cmake --build .
+
+Now that both the debug and release builds are complete, we can use a custom
+configuration file to package both builds into a single release. In the
+``Step12`` directory, create a file called ``MultiCPackConfig.cmake``. In this
+file, first include the default configuration file that was created by the
+:manual:`cmake <cmake(1)>` executable.
+
+Next, use the ``CPACK_INSTALL_CMAKE_PROJECTS`` variable to specify which
+projects to install. In this case, we want to install both debug and release.
+
+.. literalinclude:: Complete/MultiCPackConfig.cmake
+ :caption: MultiCPackConfig.cmake
+ :language: cmake
+
+From the ``Step12`` directory, run :manual:`cpack <cpack(1)>` specifying our
+custom configuration file with the ``config`` option:
+
+.. code-block:: console
+
+ cpack --config MultiCPackConfig.cmake
diff --git a/Help/guide/tutorial/Packaging an Installer.rst b/Help/guide/tutorial/Packaging an Installer.rst
new file mode 100644
index 0000000..f3a5e12
--- /dev/null
+++ b/Help/guide/tutorial/Packaging an Installer.rst
@@ -0,0 +1,56 @@
+Step 7: Packaging an Installer
+==============================
+
+Next suppose that we want to distribute our project to other people so that
+they can use it. We want to provide both binary and source distributions on a
+variety of platforms. This is a little different from the install we did
+previously in :guide:`tutorial/Installing and Testing`, where we were
+installing the binaries that we had built from the source code. In this
+example we will be building installation packages that support binary
+installations and package management features. To accomplish this we will use
+CPack to create platform specific installers. Specifically we need to add a
+few lines to the bottom of our top-level ``CMakeLists.txt`` file.
+
+.. literalinclude:: Step8/CMakeLists.txt
+ :caption: CMakeLists.txt
+ :language: cmake
+ :start-after: # setup installer
+
+That is all there is to it. We start by including
+:module:`InstallRequiredSystemLibraries`. This module will include any runtime
+libraries that are needed by the project for the current platform. Next we set
+some CPack variables to where we have stored the license and version
+information for this project. The version information was set earlier in this
+tutorial and the ``license.txt`` has been included in the top-level source
+directory for this step.
+
+Finally we include the :module:`CPack module <CPack>` which will use these
+variables and some other properties of the current system to setup an
+installer.
+
+The next step is to build the project in the usual manner and then run the
+:manual:`cpack <cpack(1)>` executable. To build a binary distribution, from the
+binary directory run:
+
+.. code-block:: console
+
+ cpack
+
+To specify the generator, use the ``-G`` option. For multi-config builds, use
+``-C`` to specify the configuration. For example:
+
+.. code-block:: console
+
+ cpack -G ZIP -C Debug
+
+To create a source distribution you would type:
+
+.. code-block:: console
+
+ cpack --config CPackSourceConfig.cmake
+
+Alternatively, run ``make package`` or right click the ``Package`` target and
+``Build Project`` from an IDE.
+
+Run the installer found in the binary directory. Then run the installed
+executable and verify that it works.
diff --git a/Help/guide/tutorial/Selecting Static or Shared Libraries.rst b/Help/guide/tutorial/Selecting Static or Shared Libraries.rst
new file mode 100644
index 0000000..85dcbf5
--- /dev/null
+++ b/Help/guide/tutorial/Selecting Static or Shared Libraries.rst
@@ -0,0 +1,72 @@
+Step 9: Selecting Static or Shared Libraries
+============================================
+
+In this section we will show how the :variable:`BUILD_SHARED_LIBS` variable can
+be used to control the default behavior of :command:`add_library`,
+and allow control over how libraries without an explicit type (``STATIC``,
+``SHARED``, ``MODULE`` or ``OBJECT``) are built.
+
+To accomplish this we need to add :variable:`BUILD_SHARED_LIBS` to the
+top-level ``CMakeLists.txt``. We use the :command:`option` command as it allows
+users to optionally select if the value should be ``ON`` or ``OFF``.
+
+Next we are going to refactor ``MathFunctions`` to become a real library that
+encapsulates using ``mysqrt`` or ``sqrt``, instead of requiring the calling
+code to do this logic. This will also mean that ``USE_MYMATH`` will not control
+building ``MathFunctions``, but instead will control the behavior of this
+library.
+
+The first step is to update the starting section of the top-level
+``CMakeLists.txt`` to look like:
+
+.. literalinclude:: Step10/CMakeLists.txt
+ :caption: CMakeLists.txt
+ :language: cmake
+ :end-before: # add the binary tree
+
+Now that we have made ``MathFunctions`` always be used, we will need to update
+the logic of that library. So, in ``MathFunctions/CMakeLists.txt`` we need to
+create a SqrtLibrary that will conditionally be built and installed when
+``USE_MYMATH`` is enabled. Now, since this is a tutorial, we are going to
+explicitly require that SqrtLibrary is built statically.
+
+The end result is that ``MathFunctions/CMakeLists.txt`` should look like:
+
+.. literalinclude:: Step10/MathFunctions/CMakeLists.txt
+ :caption: MathFunctions/CMakeLists.txt
+ :language: cmake
+ :lines: 1-36,42-
+
+Next, update ``MathFunctions/mysqrt.cxx`` to use the ``mathfunctions`` and
+``detail`` namespaces:
+
+.. literalinclude:: Step10/MathFunctions/mysqrt.cxx
+ :caption: MathFunctions/mysqrt.cxx
+ :language: c++
+
+We also need to make some changes in ``tutorial.cxx``, so that it no longer
+uses ``USE_MYMATH``:
+
+#. Always include ``MathFunctions.h``
+#. Always use ``mathfunctions::sqrt``
+#. Don't include ``cmath``
+
+Finally, update ``MathFunctions/MathFunctions.h`` to use dll export defines:
+
+.. literalinclude:: Step10/MathFunctions/MathFunctions.h
+ :caption: MathFunctions/MathFunctions.h
+ :language: c++
+
+At this point, if you build everything, you may notice that linking fails
+as we are combining a static library without position independent code with a
+library that has position independent code. The solution to this is to
+explicitly set the :prop_tgt:`POSITION_INDEPENDENT_CODE` target property of
+SqrtLibrary to be ``True`` no matter the build type.
+
+.. literalinclude:: Step10/MathFunctions/CMakeLists.txt
+ :caption: MathFunctions/CMakeLists.txt
+ :language: cmake
+ :lines: 37-42
+
+**Exercise**: We modified ``MathFunctions.h`` to use dll export defines.
+Using CMake documentation can you find a helper module to simplify this?
diff --git a/Help/guide/tutorial/index.rst b/Help/guide/tutorial/index.rst
index 94753d5..8b20a2d 100644
--- a/Help/guide/tutorial/index.rst
+++ b/Help/guide/tutorial/index.rst
@@ -1,946 +1,43 @@
CMake Tutorial
**************
-.. only:: html
-
- .. contents::
-
Introduction
============
The CMake tutorial provides a step-by-step guide that covers common build
system issues that CMake helps address. Seeing how various topics all
-work together in an example project can be very helpful. The tutorial
-documentation and source code for examples can be found in the
-``Help/guide/tutorial`` directory of the CMake source code tree. Each step has
-its own subdirectory containing code that may be used as a starting point. The
-tutorial examples are progressive so that each step provides the complete
-solution for the previous step.
-
-A Basic Starting Point (Step 1)
-===============================
-
-The most basic project is an executable built from source code files.
-For simple projects, a three line ``CMakeLists.txt`` file is all that is
-required. This will be the starting point for our tutorial. Create a
-``CMakeLists.txt`` file in the ``Step1`` directory that looks like:
-
-.. code-block:: cmake
-
- cmake_minimum_required(VERSION 3.10)
-
- # set the project name
- project(Tutorial)
-
- # add the executable
- add_executable(Tutorial tutorial.cxx)
-
-
-Note that this example uses lower case commands in the ``CMakeLists.txt`` file.
-Upper, lower, and mixed case commands are supported by CMake. The source
-code for ``tutorial.cxx`` is provided in the ``Step1`` directory and can be
-used to compute the square root of a number.
-
-Adding a Version Number and Configured Header File
---------------------------------------------------
-
-The first feature we will add is to provide our executable and project with a
-version number. While we could do this exclusively in the source code, using
-``CMakeLists.txt`` provides more flexibility.
-
-First, modify the ``CMakeLists.txt`` file to use the :command:`project` command
-to set the project name and version number.
-
-.. literalinclude:: Step2/CMakeLists.txt
- :language: cmake
- :end-before: # specify the C++ standard
-
-Then, configure a header file to pass the version number to the source
-code:
-
-.. literalinclude:: Step2/CMakeLists.txt
- :language: cmake
- :start-after: # to the source code
- :end-before: # add the executable
-
-Since the configured file will be written into the binary tree, we
-must add that directory to the list of paths to search for include
-files. Add the following lines to the end of the ``CMakeLists.txt`` file:
-
-.. literalinclude:: Step2/CMakeLists.txt
- :language: cmake
- :start-after: # so that we will find TutorialConfig.h
-
-Using your favorite editor, create ``TutorialConfig.h.in`` in the source
-directory with the following contents:
-
-.. literalinclude:: Step2/TutorialConfig.h.in
- :language: cmake
-
-When CMake configures this header file the values for
-``@Tutorial_VERSION_MAJOR@`` and ``@Tutorial_VERSION_MINOR@`` will be
-replaced.
-
-Next modify ``tutorial.cxx`` to include the configured header file,
-``TutorialConfig.h``.
-
-Finally, let's print out the executable name and version number by updating
-``tutorial.cxx`` as follows:
-
-.. literalinclude:: Step2/tutorial.cxx
- :language: c++
- :start-after: {
- :end-before: // convert input to double
-
-Specify the C++ Standard
--------------------------
-
-Next let's add some C++11 features to our project by replacing ``atof`` with
-``std::stod`` in ``tutorial.cxx``. At the same time, remove
-``#include <cstdlib>``.
-
-.. literalinclude:: Step2/tutorial.cxx
- :language: c++
- :start-after: // convert input to double
- :end-before: // calculate square root
-
-We will need to explicitly state in the CMake code that it should use the
-correct flags. The easiest way to enable support for a specific C++ standard
-in CMake is by using the :variable:`CMAKE_CXX_STANDARD` variable. For this
-tutorial, set the :variable:`CMAKE_CXX_STANDARD` variable in the
-``CMakeLists.txt`` file to 11 and :variable:`CMAKE_CXX_STANDARD_REQUIRED` to
-True. Make sure to add the ``CMAKE_CXX_STANDARD`` declarations above the call
-to ``add_executable``.
-
-.. literalinclude:: Step2/CMakeLists.txt
- :language: cmake
- :end-before: # configure a header file to pass some of the CMake settings
-
-Build and Test
---------------
-
-Run the :manual:`cmake <cmake(1)>` executable or the
-:manual:`cmake-gui <cmake-gui(1)>` to configure the project and then build it
-with your chosen build tool.
-
-For example, from the command line we could navigate to the
-``Help/guide/tutorial`` directory of the CMake source code tree and create a
-build directory:
-
-.. code-block:: console
-
- mkdir Step1_build
-
-Next, navigate to the build directory and run CMake to configure the project
-and generate a native build system:
-
-.. code-block:: console
-
- cd Step1_build
- cmake ../Step1
-
-Then call that build system to actually compile/link the project:
-
-.. code-block:: console
-
- cmake --build .
-
-Finally, try to use the newly built ``Tutorial`` with these commands:
-
-.. code-block:: console
-
- Tutorial 4294967296
- Tutorial 10
- Tutorial
-
-Adding a Library (Step 2)
-=========================
-
-Now we will add a library to our project. This library will contain our own
-implementation for computing the square root of a number. The executable can
-then use this library instead of the standard square root function provided by
-the compiler.
-
-For this tutorial we will put the library into a subdirectory
-called ``MathFunctions``. This directory already contains a header file,
-``MathFunctions.h``, and a source file ``mysqrt.cxx``. The source file has one
-function called ``mysqrt`` that provides similar functionality to the
-compiler's ``sqrt`` function.
-
-Add the following one line ``CMakeLists.txt`` file to the ``MathFunctions``
-directory:
-
-.. literalinclude:: Step3/MathFunctions/CMakeLists.txt
- :language: cmake
-
-To make use of the new library we will add an :command:`add_subdirectory`
-call in the top-level ``CMakeLists.txt`` file so that the library will get
-built. We add the new library to the executable, and add ``MathFunctions`` as
-an include directory so that the ``mysqrt.h`` header file can be found. The
-last few lines of the top-level ``CMakeLists.txt`` file should now look like:
-
-.. code-block:: cmake
-
- # add the MathFunctions library
- add_subdirectory(MathFunctions)
-
- # add the executable
- add_executable(Tutorial tutorial.cxx)
-
- target_link_libraries(Tutorial PUBLIC MathFunctions)
-
- # add the binary tree to the search path for include files
- # so that we will find TutorialConfig.h
- target_include_directories(Tutorial PUBLIC
- "${PROJECT_BINARY_DIR}"
- "${PROJECT_SOURCE_DIR}/MathFunctions"
- )
-
-Now let us make the MathFunctions library optional. While for the tutorial
-there really isn't any need to do so, for larger projects this is a common
-occurrence. The first step is to add an option to the top-level
-``CMakeLists.txt`` file.
-
-.. literalinclude:: Step3/CMakeLists.txt
- :language: cmake
- :start-after: # should we use our own math functions
- :end-before: # add the MathFunctions library
-
-This option will be displayed in the :manual:`cmake-gui <cmake-gui(1)>` and
-:manual:`ccmake <ccmake(1)>`
-with a default value of ON that can be changed by the user. This setting will
-be stored in the cache so that the user does not need to set the value each
-time they run CMake on a build directory.
-
-The next change is to make building and linking the MathFunctions library
-conditional. To do this we change the end of the top-level ``CMakeLists.txt``
-file to look like the following:
-
-.. literalinclude:: Step3/CMakeLists.txt
- :language: cmake
- :start-after: # add the MathFunctions library
-
-Note the use of the variable ``EXTRA_LIBS`` to collect up any optional
-libraries to later be linked into the executable. The variable
-``EXTRA_INCLUDES`` is used similarly for optional header files. This is a
-classic approach when dealing with many optional components, we will cover
-the modern approach in the next step.
-
-The corresponding changes to the source code are fairly straightforward.
-First, in ``tutorial.cxx``, include the ``MathFunctions.h`` header if we
-need it:
-
-.. literalinclude:: Step3/tutorial.cxx
- :language: c++
- :start-after: // should we include the MathFunctions header
- :end-before: int main
-
-Then, in the same file, make ``USE_MYMATH`` control which square root
-function is used:
-
-.. literalinclude:: Step3/tutorial.cxx
- :language: c++
- :start-after: // which square root function should we use?
- :end-before: std::cout << "The square root of
-
-Since the source code now requires ``USE_MYMATH`` we can add it to
-``TutorialConfig.h.in`` with the following line:
-
-.. literalinclude:: Step3/TutorialConfig.h.in
- :language: c
- :lines: 4
-
-**Exercise**: Why is it important that we configure ``TutorialConfig.h.in``
-after the option for ``USE_MYMATH``? What would happen if we inverted the two?
-
-Run the :manual:`cmake <cmake(1)>` executable or the
-:manual:`cmake-gui <cmake-gui(1)>` to configure the project and then build it
-with your chosen build tool. Then run the built Tutorial executable.
-
-Now let's update the value of ``USE_MYMATH``. The easiest way is to use the
-:manual:`cmake-gui <cmake-gui(1)>` or :manual:`ccmake <ccmake(1)>` if you're
-in the terminal. Or, alternatively, if you want to change the option from the
-command-line, try:
-
-.. code-block:: console
-
- cmake ../Step2 -DUSE_MYMATH=OFF
-
-Rebuild and run the tutorial again.
-
-Which function gives better results, sqrt or mysqrt?
-
-Adding Usage Requirements for Library (Step 3)
-==============================================
-
-Usage requirements allow for far better control over a library or executable's
-link and include line while also giving more control over the transitive
-property of targets inside CMake. The primary commands that leverage usage
-requirements are:
-
- - :command:`target_compile_definitions`
- - :command:`target_compile_options`
- - :command:`target_include_directories`
- - :command:`target_link_libraries`
-
-Let's refactor our code from `Adding a Library (Step 2)`_ to use the modern
-CMake approach of usage requirements. We first state that anybody linking to
-MathFunctions needs to include the current source directory, while
-MathFunctions itself doesn't. So this can become an ``INTERFACE`` usage
-requirement.
-
-Remember ``INTERFACE`` means things that consumers require but the producer
-doesn't. Add the following lines to the end of
-``MathFunctions/CMakeLists.txt``:
-
-.. literalinclude:: Step4/MathFunctions/CMakeLists.txt
- :language: cmake
- :start-after: # to find MathFunctions.h
-
-Now that we've specified usage requirements for MathFunctions we can safely
-remove our uses of the ``EXTRA_INCLUDES`` variable from the top-level
-``CMakeLists.txt``, here:
-
-.. literalinclude:: Step4/CMakeLists.txt
- :language: cmake
- :start-after: # add the MathFunctions library
- :end-before: # add the executable
-
-And here:
-
-.. literalinclude:: Step4/CMakeLists.txt
- :language: cmake
- :start-after: # so that we will find TutorialConfig.h
-
-Once this is done, run the :manual:`cmake <cmake(1)>` executable or the
-:manual:`cmake-gui <cmake-gui(1)>` to configure the project and then build it
-with your chosen build tool or by using ``cmake --build .`` from the build
-directory.
-
-Installing and Testing (Step 4)
-===============================
-
-Now we can start adding install rules and testing support to our project.
-
-Install Rules
--------------
-
-The install rules are fairly simple: for MathFunctions we want to install the
-library and header file and for the application we want to install the
-executable and configured header.
-
-So to the end of ``MathFunctions/CMakeLists.txt`` we add:
-
-.. literalinclude:: Step5/MathFunctions/CMakeLists.txt
- :language: cmake
- :start-after: # install rules
-
-And to the end of the top-level ``CMakeLists.txt`` we add:
-
-.. literalinclude:: Step5/CMakeLists.txt
- :language: cmake
- :start-after: # add the install targets
- :end-before: # enable testing
-
-That is all that is needed to create a basic local install of the tutorial.
-
-Now run the :manual:`cmake <cmake(1)>` executable or the
-:manual:`cmake-gui <cmake-gui(1)>` to configure the project and then build it
-with your chosen build tool.
-
-Then run the install step by using the ``install`` option of the
-:manual:`cmake <cmake(1)>` command (introduced in 3.15, older versions of
-CMake must use ``make install``) from the command line. For
-multi-configuration tools, don't forget to use the ``--config`` argument to
-specify the configuration. If using an IDE, simply build the ``INSTALL``
-target. This step will install the appropriate header files, libraries, and
-executables. For example:
-
-.. code-block:: console
-
- cmake --install .
-
-The CMake variable :variable:`CMAKE_INSTALL_PREFIX` is used to determine the
-root of where the files will be installed. If using the ``cmake --install``
-command, the installation prefix can be overridden via the ``--prefix``
-argument. For example:
-
-.. code-block:: console
-
- cmake --install . --prefix "/home/myuser/installdir"
-
-Navigate to the install directory and verify that the installed Tutorial runs.
-
-Testing Support
----------------
-
-Next let's test our application. At the end of the top-level ``CMakeLists.txt``
-file we can enable testing and then add a number of basic tests to verify that
-the application is working correctly.
-
-.. literalinclude:: Step5/CMakeLists.txt
- :language: cmake
- :start-after: # enable testing
-
-The first test simply verifies that the application runs, does not segfault or
-otherwise crash, and has a zero return value. This is the basic form of a
-CTest test.
-
-The next test makes use of the :prop_test:`PASS_REGULAR_EXPRESSION` test
-property to verify that the output of the test contains certain strings. In
-this case, verifying that the usage message is printed when an incorrect number
-of arguments are provided.
-
-Lastly, we have a function called ``do_test`` that runs the application and
-verifies that the computed square root is correct for given input. For each
-invocation of ``do_test``, another test is added to the project with a name,
-input, and expected results based on the passed arguments.
-
-Rebuild the application and then cd to the binary directory and run the
-:manual:`ctest <ctest(1)>` executable: ``ctest -N`` and ``ctest -VV``. For
-multi-config generators (e.g. Visual Studio), the configuration type must be
-specified. To run tests in Debug mode, for example, use ``ctest -C Debug -VV``
-from the build directory (not the Debug subdirectory!). Alternatively, build
-the ``RUN_TESTS`` target from the IDE.
-
-Adding System Introspection (Step 5)
-====================================
-
-Let us consider adding some code to our project that depends on features the
-target platform may not have. For this example, we will add some code that
-depends on whether or not the target platform has the ``log`` and ``exp``
-functions. Of course almost every platform has these functions but for this
-tutorial assume that they are not common.
-
-If the platform has ``log`` and ``exp`` then we will use them to compute the
-square root in the ``mysqrt`` function. We first test for the availability of
-these functions using the :module:`CheckSymbolExists` module in
-``MathFunctions/CMakeLists.txt``. On some platforms, we will need to link to
-the m library. If ``log`` and ``exp`` are not initially found, require the m
-library and try again.
-
-.. literalinclude:: Step6/MathFunctions/CMakeLists.txt
- :language: cmake
- :start-after: # does this system provide the log and exp functions?
- :end-before: # add compile definitions
-
-If available, use :command:`target_compile_definitions` to specify
-``HAVE_LOG`` and ``HAVE_EXP`` as ``PRIVATE`` compile definitions.
-
-.. literalinclude:: Step6/MathFunctions/CMakeLists.txt
- :language: cmake
- :start-after: # add compile definitions
- :end-before: # install rules
-
-If ``log`` and ``exp`` are available on the system, then we will use them to
-compute the square root in the ``mysqrt`` function. Add the following code to
-the ``mysqrt`` function in ``MathFunctions/mysqrt.cxx`` (don't forget the
-``#endif`` before returning the result!):
-
-.. literalinclude:: Step6/MathFunctions/mysqrt.cxx
- :language: c++
- :start-after: // if we have both log and exp then use them
- :end-before: // do ten iterations
-
-We will also need to modify ``mysqrt.cxx`` to include ``cmath``.
-
-.. literalinclude:: Step6/MathFunctions/mysqrt.cxx
- :language: c++
- :end-before: #include <iostream>
-
-Run the :manual:`cmake <cmake(1)>` executable or the
-:manual:`cmake-gui <cmake-gui(1)>` to configure the project and then build it
-with your chosen build tool and run the Tutorial executable.
-
-Which function gives better results now, sqrt or mysqrt?
-
-Adding a Custom Command and Generated File (Step 6)
-===================================================
-
-Suppose, for the purpose of this tutorial, we decide that we never want to use
-the platform ``log`` and ``exp`` functions and instead would like to
-generate a table of precomputed values to use in the ``mysqrt`` function.
-In this section, we will create the table as part of the build process,
-and then compile that table into our application.
-
-First, let's remove the check for the ``log`` and ``exp`` functions in
-``MathFunctions/CMakeLists.txt``. Then remove the check for ``HAVE_LOG`` and
-``HAVE_EXP`` from ``mysqrt.cxx``. At the same time, we can remove
-:code:`#include <cmath>`.
-
-In the ``MathFunctions`` subdirectory, a new source file named
-``MakeTable.cxx`` has been provided to generate the table.
-
-After reviewing the file, we can see that the table is produced as valid C++
-code and that the output filename is passed in as an argument.
-
-The next step is to add the appropriate commands to the
-``MathFunctions/CMakeLists.txt`` file to build the MakeTable executable and
-then run it as part of the build process. A few commands are needed to
-accomplish this.
-
-First, at the top of ``MathFunctions/CMakeLists.txt``, the executable for
-``MakeTable`` is added as any other executable would be added.
-
-.. literalinclude:: Step7/MathFunctions/CMakeLists.txt
- :language: cmake
- :start-after: # first we add the executable that generates the table
- :end-before: # add the command to generate the source code
-
-Then we add a custom command that specifies how to produce ``Table.h``
-by running MakeTable.
-
-.. literalinclude:: Step7/MathFunctions/CMakeLists.txt
- :language: cmake
- :start-after: # add the command to generate the source code
- :end-before: # add the main library
-
-Next we have to let CMake know that ``mysqrt.cxx`` depends on the generated
-file ``Table.h``. This is done by adding the generated ``Table.h`` to the list
-of sources for the library MathFunctions.
-
-.. literalinclude:: Step7/MathFunctions/CMakeLists.txt
- :language: cmake
- :start-after: # add the main library
- :end-before: # state that anybody linking
-
-We also have to add the current binary directory to the list of include
-directories so that ``Table.h`` can be found and included by ``mysqrt.cxx``.
-
-.. literalinclude:: Step7/MathFunctions/CMakeLists.txt
- :language: cmake
- :start-after: # state that we depend on our bin
- :end-before: # install rules
-
-Now let's use the generated table. First, modify ``mysqrt.cxx`` to include
-``Table.h``. Next, we can rewrite the mysqrt function to use the table:
-
-.. literalinclude:: Step7/MathFunctions/mysqrt.cxx
- :language: c++
- :start-after: // a hack square root calculation using simple operations
-
-Run the :manual:`cmake <cmake(1)>` executable or the
-:manual:`cmake-gui <cmake-gui(1)>` to configure the project and then build it
-with your chosen build tool.
-
-When this project is built it will first build the ``MakeTable`` executable.
-It will then run ``MakeTable`` to produce ``Table.h``. Finally, it will
-compile ``mysqrt.cxx`` which includes ``Table.h`` to produce the MathFunctions
-library.
-
-Run the Tutorial executable and verify that it is using the table.
-
-Building an Installer (Step 7)
-==============================
-
-Next suppose that we want to distribute our project to other people so that
-they can use it. We want to provide both binary and source distributions on a
-variety of platforms. This is a little different from the install we did
-previously in `Installing and Testing (Step 4)`_ , where we were
-installing the binaries that we had built from the source code. In this
-example we will be building installation packages that support binary
-installations and package management features. To accomplish this we will use
-CPack to create platform specific installers. Specifically we need to add a
-few lines to the bottom of our top-level ``CMakeLists.txt`` file.
-
-.. literalinclude:: Step8/CMakeLists.txt
- :language: cmake
- :start-after: # setup installer
-
-That is all there is to it. We start by including
-:module:`InstallRequiredSystemLibraries`. This module will include any runtime
-libraries that are needed by the project for the current platform. Next we set
-some CPack variables to where we have stored the license and version
-information for this project. The version information was set earlier in this
-tutorial and the ``license.txt`` has been included in the top-level source
-directory for this step.
-
-Finally we include the :module:`CPack module <CPack>` which will use these
-variables and some other properties of the current system to setup an
-installer.
-
-The next step is to build the project in the usual manner and then run the
-:manual:`cpack <cpack(1)>` executable. To build a binary distribution, from the
-binary directory run:
-
-.. code-block:: console
-
- cpack
-
-To specify the generator, use the ``-G`` option. For multi-config builds, use
-``-C`` to specify the configuration. For example:
-
-.. code-block:: console
-
- cpack -G ZIP -C Debug
-
-To create a source distribution you would type:
-
-.. code-block:: console
-
- cpack --config CPackSourceConfig.cmake
-
-Alternatively, run ``make package`` or right click the ``Package`` target and
-``Build Project`` from an IDE.
-
-Run the installer found in the binary directory. Then run the installed
-executable and verify that it works.
-
-Adding Support for a Dashboard (Step 8)
-=======================================
-
-Adding support for submitting our test results to a dashboard is simple. We
-already defined a number of tests for our project in `Testing Support`_. Now we
-just have to run those tests and submit them to a dashboard. To include support
-for dashboards we include the :module:`CTest` module in our top-level
-``CMakeLists.txt``.
-
-Replace:
-
-.. code-block:: cmake
-
- # enable testing
- enable_testing()
-
-With:
-
-.. code-block:: cmake
-
- # enable dashboard scripting
- include(CTest)
-
-The :module:`CTest` module will automatically call ``enable_testing()``, so we
-can remove it from our CMake files.
-
-We will also need to create a ``CTestConfig.cmake`` file in the top-level
-directory where we can specify the name of the project and where to submit the
-dashboard.
-
-.. literalinclude:: Step9/CTestConfig.cmake
- :language: cmake
-
-The :manual:`ctest <ctest(1)>` executable will read in this file when it runs.
-To create a simple dashboard you can run the :manual:`cmake <cmake(1)>`
-executable or the :manual:`cmake-gui <cmake-gui(1)>` to configure the project,
-but do not build it yet. Instead, change directory to the binary tree, and then
-run:
-
- ctest [-VV] -D Experimental
-
-Remember, for multi-config generators (e.g. Visual Studio), the configuration
-type must be specified::
-
- ctest [-VV] -C Debug -D Experimental
-
-Or, from an IDE, build the ``Experimental`` target.
-
-The :manual:`ctest <ctest(1)>` executable will build and test the project and
-submit the results to Kitware's public dashboard:
-https://my.cdash.org/index.php?project=CMakeTutorial.
-
-Mixing Static and Shared (Step 9)
-=================================
-
-In this section we will show how the :variable:`BUILD_SHARED_LIBS` variable can
-be used to control the default behavior of :command:`add_library`,
-and allow control over how libraries without an explicit type (``STATIC``,
-``SHARED``, ``MODULE`` or ``OBJECT``) are built.
-
-To accomplish this we need to add :variable:`BUILD_SHARED_LIBS` to the
-top-level ``CMakeLists.txt``. We use the :command:`option` command as it allows
-users to optionally select if the value should be ON or OFF.
-
-Next we are going to refactor MathFunctions to become a real library that
-encapsulates using ``mysqrt`` or ``sqrt``, instead of requiring the calling
-code to do this logic. This will also mean that ``USE_MYMATH`` will not control
-building MathFunctions, but instead will control the behavior of this library.
-
-The first step is to update the starting section of the top-level
-``CMakeLists.txt`` to look like:
-
-.. literalinclude:: Step10/CMakeLists.txt
- :language: cmake
- :end-before: # add the binary tree
-
-Now that we have made MathFunctions always be used, we will need to update
-the logic of that library. So, in ``MathFunctions/CMakeLists.txt`` we need to
-create a SqrtLibrary that will conditionally be built and installed when
-``USE_MYMATH`` is enabled. Now, since this is a tutorial, we are going to
-explicitly require that SqrtLibrary is built statically.
-
-The end result is that ``MathFunctions/CMakeLists.txt`` should look like:
-
-.. literalinclude:: Step10/MathFunctions/CMakeLists.txt
- :language: cmake
- :lines: 1-36,42-
-
-Next, update ``MathFunctions/mysqrt.cxx`` to use the ``mathfunctions`` and
-``detail`` namespaces:
-
-.. literalinclude:: Step10/MathFunctions/mysqrt.cxx
- :language: c++
-
-We also need to make some changes in ``tutorial.cxx``, so that it no longer
-uses ``USE_MYMATH``:
-
-#. Always include ``MathFunctions.h``
-#. Always use ``mathfunctions::sqrt``
-#. Don't include cmath
-
-Finally, update ``MathFunctions/MathFunctions.h`` to use dll export defines:
-
-.. literalinclude:: Step10/MathFunctions/MathFunctions.h
- :language: c++
-
-At this point, if you build everything, you may notice that linking fails
-as we are combining a static library without position independent code with a
-library that has position independent code. The solution to this is to
-explicitly set the :prop_tgt:`POSITION_INDEPENDENT_CODE` target property of
-SqrtLibrary to be True no matter the build type.
-
-.. literalinclude:: Step10/MathFunctions/CMakeLists.txt
- :language: cmake
- :lines: 37-42
-
-**Exercise**: We modified ``MathFunctions.h`` to use dll export defines.
-Using CMake documentation can you find a helper module to simplify this?
-
-
-Adding Generator Expressions (Step 10)
-======================================
-
-:manual:`Generator expressions <cmake-generator-expressions(7)>` are evaluated
-during build system generation to produce information specific to each build
-configuration.
-
-:manual:`Generator expressions <cmake-generator-expressions(7)>` are allowed in
-the context of many target properties, such as :prop_tgt:`LINK_LIBRARIES`,
-:prop_tgt:`INCLUDE_DIRECTORIES`, :prop_tgt:`COMPILE_DEFINITIONS` and others.
-They may also be used when using commands to populate those properties, such as
-:command:`target_link_libraries`, :command:`target_include_directories`,
-:command:`target_compile_definitions` and others.
-
-:manual:`Generator expressions <cmake-generator-expressions(7)>` may be used
-to enable conditional linking, conditional definitions used when compiling,
-conditional include directories and more. The conditions may be based on the
-build configuration, target properties, platform information or any other
-queryable information.
-
-There are different types of
-:manual:`generator expressions <cmake-generator-expressions(7)>` including
-Logical, Informational, and Output expressions.
-
-Logical expressions are used to create conditional output. The basic
-expressions are the 0 and 1 expressions. A ``$<0:...>`` results in the empty
-string, and ``<1:...>`` results in the content of "...". They can also be
-nested.
-
-A common usage of
-:manual:`generator expressions <cmake-generator-expressions(7)>` is to
-conditionally add compiler flags, such as those for language levels or
-warnings. A nice pattern is to associate this information to an ``INTERFACE``
-target allowing this information to propagate. Let's start by constructing an
-``INTERFACE`` target and specifying the required C++ standard level of ``11``
-instead of using :variable:`CMAKE_CXX_STANDARD`.
-
-So the following code:
-
-.. literalinclude:: Step10/CMakeLists.txt
- :language: cmake
- :start-after: project(Tutorial VERSION 1.0)
- :end-before: # control where the static and shared libraries are built so that on windows
-
-Would be replaced with:
-
-.. literalinclude:: Step11/CMakeLists.txt
- :language: cmake
- :start-after: project(Tutorial VERSION 1.0)
- :end-before: # add compiler warning flags just when building this project via
-
-
-Next we add the desired compiler warning flags that we want for our project. As
-warning flags vary based on the compiler we use the ``COMPILE_LANG_AND_ID``
-generator expression to control which flags to apply given a language and a set
-of compiler ids as seen below:
-
-.. literalinclude:: Step11/CMakeLists.txt
- :language: cmake
- :start-after: # the BUILD_INTERFACE genex
- :end-before: # control where the static and shared libraries are built so that on windows
-
-Looking at this we see that the warning flags are encapsulated inside a
-``BUILD_INTERFACE`` condition. This is done so that consumers of our installed
-project will not inherit our warning flags.
-
-
-**Exercise**: Modify ``MathFunctions/CMakeLists.txt`` so that all targets have
-a :command:`target_link_libraries` call to ``tutorial_compiler_flags``.
-
-
-Adding Export Configuration (Step 11)
-=====================================
-
-During `Installing and Testing (Step 4)`_ of the tutorial we added the ability
-for CMake to install the library and headers of the project. During
-`Building an Installer (Step 7)`_ we added the ability to package up this
-information so it could be distributed to other people.
-
-The next step is to add the necessary information so that other CMake projects
-can use our project, be it from a build directory, a local install or when
-packaged.
-
-The first step is to update our :command:`install(TARGETS)` commands to not
-only specify a ``DESTINATION`` but also an ``EXPORT``. The ``EXPORT`` keyword
-generates and installs a CMake file containing code to import all targets
-listed in the install command from the installation tree. So let's go ahead and
-explicitly ``EXPORT`` the MathFunctions library by updating the ``install``
-command in ``MathFunctions/CMakeLists.txt`` to look like:
-
-.. literalinclude:: Complete/MathFunctions/CMakeLists.txt
- :language: cmake
- :start-after: # install rules
-
-Now that we have MathFunctions being exported, we also need to explicitly
-install the generated ``MathFunctionsTargets.cmake`` file. This is done by
-adding the following to the bottom of the top-level ``CMakeLists.txt``:
-
-.. literalinclude:: Complete/CMakeLists.txt
- :language: cmake
- :start-after: # install the configuration targets
- :end-before: include(CMakePackageConfigHelpers)
-
-At this point you should try and run CMake. If everything is setup properly
-you will see that CMake will generate an error that looks like:
-
-.. code-block:: console
-
- Target "MathFunctions" INTERFACE_INCLUDE_DIRECTORIES property contains
- path:
-
- "/Users/robert/Documents/CMakeClass/Tutorial/Step11/MathFunctions"
-
- which is prefixed in the source directory.
-
-What CMake is trying to say is that during generating the export information
-it will export a path that is intrinsically tied to the current machine and
-will not be valid on other machines. The solution to this is to update the
-MathFunctions :command:`target_include_directories` to understand that it needs
-different ``INTERFACE`` locations when being used from within the build
-directory and from an install / package. This means converting the
-:command:`target_include_directories` call for MathFunctions to look like:
-
-.. literalinclude:: Step12/MathFunctions/CMakeLists.txt
- :language: cmake
- :start-after: # to find MathFunctions.h, while we don't.
- :end-before: # should we use our own math functions
-
-Once this has been updated, we can re-run CMake and verify that it doesn't
-warn anymore.
-
-At this point, we have CMake properly packaging the target information that is
-required but we will still need to generate a ``MathFunctionsConfig.cmake`` so
-that the CMake :command:`find_package` command can find our project. So let's go
-ahead and add a new file to the top-level of the project called
-``Config.cmake.in`` with the following contents:
-
-.. literalinclude:: Step12/Config.cmake.in
-
-Then, to properly configure and install that file, add the following to the
-bottom of the top-level ``CMakeLists.txt``:
-
-.. literalinclude:: Step12/CMakeLists.txt
- :language: cmake
- :start-after: # install the configuration targets
- :end-before: # generate the export
-
-At this point, we have generated a relocatable CMake Configuration for our
-project that can be used after the project has been installed or packaged. If
-we want our project to also be used from a build directory we only have to add
-the following to the bottom of the top level ``CMakeLists.txt``:
-
-.. literalinclude:: Step12/CMakeLists.txt
- :language: cmake
- :start-after: # needs to be after the install(TARGETS ) command
-
-With this export call we now generate a ``Targets.cmake``, allowing the
-configured ``MathFunctionsConfig.cmake`` in the build directory to be used by
-other projects, without needing it to be installed.
-
-Packaging Debug and Release (Step 12)
-=====================================
-
-**Note:** This example is valid for single-configuration generators and will
-not work for multi-configuration generators (e.g. Visual Studio).
-
-By default, CMake's model is that a build directory only contains a single
-configuration, be it Debug, Release, MinSizeRel, or RelWithDebInfo. It is
-possible, however, to setup CPack to bundle multiple build directories and
-construct a package that contains multiple configurations of the same project.
-
-First, we want to ensure that the debug and release builds use different names
-for the executables and libraries that will be installed. Let's use `d` as the
-postfix for the debug executable and libraries.
-
-Set :variable:`CMAKE_DEBUG_POSTFIX` near the beginning of the top-level
-``CMakeLists.txt`` file:
-
-.. literalinclude:: Complete/CMakeLists.txt
- :language: cmake
- :start-after: project(Tutorial VERSION 1.0)
- :end-before: target_compile_features(tutorial_compiler_flags
-
-And the :prop_tgt:`DEBUG_POSTFIX` property on the tutorial executable:
-
-.. literalinclude:: Complete/CMakeLists.txt
- :language: cmake
- :start-after: # add the executable
- :end-before: # add the binary tree to the search path for include files
-
-Let's also add version numbering to the MathFunctions library. In
-``MathFunctions/CMakeLists.txt``, set the :prop_tgt:`VERSION` and
-:prop_tgt:`SOVERSION` properties:
-
-.. literalinclude:: Complete/MathFunctions/CMakeLists.txt
- :language: cmake
- :start-after: # setup the version numbering
- :end-before: # install rules
-
-From the ``Step12`` directory, create ``debug`` and ``release``
-subbdirectories. The layout will look like:
-
-.. code-block:: none
-
- - Step12
- - debug
- - release
-
-Now we need to setup debug and release builds. We can use
-:variable:`CMAKE_BUILD_TYPE` to set the configuration type:
-
-.. code-block:: console
-
- cd debug
- cmake -DCMAKE_BUILD_TYPE=Debug ..
- cmake --build .
- cd ../release
- cmake -DCMAKE_BUILD_TYPE=Release ..
- cmake --build .
-
-Now that both the debug and release builds are complete, we can use a custom
-configuration file to package both builds into a single release. In the
-``Step12`` directory, create a file called ``MultiCPackConfig.cmake``. In this
-file, first include the default configuration file that was created by the
-:manual:`cmake <cmake(1)>` executable.
-
-Next, use the ``CPACK_INSTALL_CMAKE_PROJECTS`` variable to specify which
-projects to install. In this case, we want to install both debug and release.
-
-.. literalinclude:: Complete/MultiCPackConfig.cmake
- :language: cmake
-
-From the ``Step12`` directory, run :manual:`cpack <cpack(1)>` specifying our
-custom configuration file with the ``config`` option:
-
-.. code-block:: console
-
- cpack --config MultiCPackConfig.cmake
+work together in an example project can be very helpful.
+
+Steps
+=====
+
+The tutorial documentation and source code for examples can be found in
+the ``Help/guide/tutorial`` directory of the CMake source code tree.
+Each step has its own subdirectory containing code that may be used as a
+starting point. The tutorial examples are progressive so that each step
+provides the complete solution for the previous step.
+
+.. toctree::
+ :maxdepth: 2
+
+ A Basic Starting Point
+ Adding a Library
+ Adding Usage Requirements for a Library
+ Installing and Testing
+ Adding System Introspection
+ Adding a Custom Command and Generated File
+ Packaging an Installer
+ Adding Support for a Testing Dashboard
+ Selecting Static or Shared Libraries
+ Adding Generator Expressions
+ Adding Export Configuration
+ Packaging Debug and Release
+
+..
+ Whenever a step above is renamed or removed, leave forwarding text in
+ its original document file, and list it below to preserve old links
+ to cmake.org/cmake/help/latest/ URLs.
+
+.. toctree::
+ :maxdepth: 1
+ :hidden:
diff --git a/Help/release/3.21.rst b/Help/release/3.21.rst
new file mode 100644
index 0000000..04354db
--- /dev/null
+++ b/Help/release/3.21.rst
@@ -0,0 +1,291 @@
+CMake 3.21 Release Notes
+************************
+
+.. only:: html
+
+ .. contents::
+
+Changes made since CMake 3.20 include the following.
+
+New Features
+============
+
+Presets
+-------
+
+* :manual:`cmake-presets(7)` gained support for specifying the install prefix
+ in a configure preset.
+
+* :manual:`cmake-presets(7)` gained support for conditional enabling of presets.
+
+* :manual:`cmake-presets(7)` gained support for a ``${hostSystemName}`` macro.
+
+* :manual:`cmake-presets(7)` gained support for omitting the ``generator`` and
+ ``binaryDir`` fields.
+
+Generators
+----------
+
+* The :ref:`Makefile Generators` and the :generator:`Ninja` generator
+ learned to add linker launcher tools along with the linker for ``C``,
+ ``CXX``, ``OBJC``, and ``OBJCXX`` languages.
+ See the :variable:`CMAKE_<LANG>_LINKER_LAUNCHER` variable
+ and :prop_tgt:`<LANG>_LINKER_LAUNCHER` target property for details.
+
+Languages
+---------
+
+* CMake learned to support ``HIP`` as a first-class language that can be
+ enabled via the :command:`project` and :command:`enable_language` commands.
+
+* :prop_tgt:`C_STANDARD`, :prop_tgt:`OBJC_STANDARD`, and the
+ :manual:`Compile Features <cmake-compile-features(7)>` functionality gained
+ support for C17 and C23.
+
+* Source file extensions ``.ixx`` and ``.cppm`` are now treated as C++.
+
+Command-Line
+------------
+
+* :manual:`cmake(1)` gained the ``--install-prefix <dir>``
+ command-line option to specify the location of the install prefix.
+
+* :manual:`cmake(1)` gained the ``--toolchain <path/to/file>``
+ command-line option to specify a toolchain file.
+
+* :manual:`cmake(1)` ``-E capabilities`` output now contains for each
+ generator a ``supportedPlatforms`` field listing platforms known to
+ be supported in :variable:`CMAKE_GENERATOR_PLATFORM`.
+
+* Messages printed to a terminal now may be colored by message type.
+
+Compilers
+---------
+
+* The Fujitsu compiler is now supported using compiler id ``Fujitsu``
+ in traditional (``Trad``) mode, and compiler id ``FujitsuClang``
+ in ``Clang`` mode.
+
+Platforms
+---------
+
+* CMake now supports the MSYS runtime environment, much like CYGWIN.
+
+File-Based API
+--------------
+
+* The :manual:`cmake-file-api(7)` "codemodel" version 2 ``version`` field
+ has been updated to 2.3.
+
+* The :manual:`cmake-file-api(7)` "codemodel" version 2 gained a
+ new "directory" object containing directory-level information.
+ This includes a list of installers generated by the :command:`install`
+ command.
+
+Commands
+--------
+
+* The :command:`add_custom_command` command ``DEPFILE`` option:
+
+ * may now use
+ :manual:`generator expressions <cmake-generator-expressions(7)>`,
+
+ * is now supported by :ref:`Visual Studio Generators` for VS 2012
+ and above, and
+
+ * is now supported by the :generator:`Xcode` generator.
+
+* The :command:`add_custom_command(TARGET)` command
+ (for :ref:`Build Events <add_custom_command(TARGET)>`)
+ gained support for resolving target-dependent generator expressions.
+
+* The :command:`build_command` command gained a ``PARALLEL_LEVEL`` option.
+
+* The :command:`file(COPY_FILE)` command was added to copy a single file.
+
+* The :command:`file(GET_RUNTIME_DEPENDENCIES)` command gained new
+ ``POST_INCLUDE_FILES`` and ``POST_EXCLUDE_FILES`` arguments.
+
+* The :command:`file(REAL_PATH)` command gained the option ``EXPAND_TILDE`` to
+ replace any leading tilde with the path to the user's home directory.
+
+* The :command:`file(RENAME)` command learned to optionally capture
+ failure in a result variable. It also gained a ``NO_REPLACE``
+ option to fail if the destination exists.
+
+* The :command:`install` command gained a new ``IMPORTED_RUNTIME_ARTIFACTS``
+ mode, which can be used to install the runtime artifacts of imported targets.
+
+* The :command:`install` command gained a new ``RUNTIME_DEPENDENCY_SET`` mode,
+ which can be used to install runtime dependencies using
+ :command:`file(GET_RUNTIME_DEPENDENCIES)`.
+
+* The :command:`install(TARGETS)` command gained new ``RUNTIME_DEPENDENCIES``
+ and ``RUNTIME_DEPENDENCY_SET`` arguments, which can be used to install
+ runtime dependencies using :command:`file(GET_RUNTIME_DEPENDENCIES)`.
+
+* The :command:`install(SCRIPT|CODE)` command
+ supports a new option ``ALL_COMPONENTS`` which allows
+ the corresponding code to run for every component of
+ a per component installation.
+
+* The :command:`project` command now sets variables
+ :variable:`PROJECT_IS_TOP_LEVEL` and :variable:`<PROJECT-NAME>_IS_TOP_LEVEL`
+ to indicate whether it was called in a top-level ``CMakeLists.txt`` file.
+
+Variables
+---------
+
+* The :envvar:`CMAKE_TOOLCHAIN_FILE` environment variable was added to
+ provide a default value for the :variable:`CMAKE_TOOLCHAIN_FILE` variable.
+
+Properties
+----------
+
+* The :prop_dir:`IMPORTED_TARGETS` directory property was added to
+ get a list of :ref:`Imported Targets` created in the current
+ directory.
+
+* The :prop_tgt:`XCODE_EMBED_APP_EXTENSIONS <XCODE_EMBED_<type>>` target property
+ was added to tell the :generator:`Xcode` generator to embed app extensions
+ such as iMessage sticker packs.
+ Aspects of the embedding can be customized with the
+ :prop_tgt:`XCODE_EMBED_APP_EXTENSIONS_PATH <XCODE_EMBED_<type>>`,
+ :prop_tgt:`XCODE_EMBED_APP_EXTENSIONS_CODE_SIGN_ON_COPY <XCODE_EMBED_<type>_CODE_SIGN_ON_COPY>` and
+ :prop_tgt:`XCODE_EMBED_APP_EXTENSIONS_REMOVE_HEADERS_ON_COPY <XCODE_EMBED_<type>_REMOVE_HEADERS_ON_COPY>`
+ properties.
+
+Modules
+-------
+
+* The :module:`FindBLAS` and :module:`FindLAPACK` modules learned to support
+ the serial ``Fujitsu_SSL2`` and parallel ``Fujitsu_SSL2BLAMP`` libraries.
+
+* The :module:`FindDevIL` module now provides imported targets.
+
+* The :module:`FindIconv` module now has version support.
+
+* The :module:`FindIntl` module now has version support.
+
+* The :module:`FindMPI` module learned to support ``Fujitsu`` and
+ ``FujitsuClang`` in both host and cross compiling modes.
+
+* The :module:`FindMsys` module was added to find MSYS installations.
+ Like :module:`FindCygwin`, it is used automatically by some other
+ find modules to locate UNIX-style tools on Windows.
+
+* The :module:`FindOpenMP` module learned to support ``Fujitsu`` and
+ ``FujitsuClang``.
+
+* The :module:`FindVulkan` module gained imported targets
+ ``Vulkan::Headers`` and ``Vulkan::glslangValidator``.
+
+* The :module:`UseJava` module command ``add_jar`` gained a ``RESOURCES``
+ option to allow explicit naming of resources with non-optional namespace.
+
+* The :module:`UseSWIG` module use now standard library naming conventions
+ for the ``CSharp`` language. See policy :policy:`CMP0122`.
+
+* The :module:`UseSWIG` module now supports using the ``swig`` tool to
+ generate implicit dependencies with the :generator:`Xcode` generator.
+
+Generator Expressions
+---------------------
+
+* A new :genex:`TARGET_RUNTIME_DLLS` generator expression was added.
+
+CTest
+-----
+
+* :manual:`ctest(1)` gained documentation for its ability to capture
+ :ref:`Additional Test Measurements`.
+
+* :manual:`ctest(1)` learned to recognize files attached to a test at run time.
+ Previously it was only possible to attach files to tests at configure time
+ by using the :prop_test:`ATTACHED_FILES` or
+ :prop_test:`ATTACHED_FILES_ON_FAIL` test properties.
+ See :ref:`Additional Test Measurements` for more information.
+
+* :manual:`ctest(1)` gained a ``--output-junit`` option to write test results
+ to a JUnit XML file.
+
+* The :command:`ctest_build` command gained a ``PARALLEL_LEVEL`` option.
+
+CPack
+-----
+
+* The :cpack_gen:`CPack DragNDrop Generator` gained option
+ :variable:`CPACK_DMG_FILESYSTEM` to control the ``.dmg`` filesystem.
+
+* The :cpack_gen:`CPack IFW Generator` now supports hyphens in names
+ given to :command:`cpack_ifw_configure_component` or
+ :command:`cpack_ifw_configure_component_group` as ``DEPENDS`` or
+ ``DEPENDENCIES`` arguments. This requires QtIFW 3.1 or later.
+
+* The :cpack_gen:`CPack NSIS Generator` gained a new
+ :variable:`CPACK_NSIS_EXECUTABLE` variable to specify the ``makensis``
+ executable to use instead of the default one.
+
+* The :variable:`CPACK_CUSTOM_INSTALL_VARIABLES` variable was added to set
+ variables in ``cmake_install.cmake`` script invocations made by CPack.
+
+Deprecated and Removed Features
+===============================
+
+* Undocumented :variable:`CMAKE_SYSTEM_NAME` version-stripping behavior has
+ been removed entirely. If it is set by a ``-D`` flag or by a
+ :manual:`toolchain file <cmake-toolchains(7)>`, it is left unaltered,
+ even if it still contains a version number.
+ Similar :variable:`CMAKE_HOST_SYSTEM_NAME` version-stripping behavior,
+ also undocumented, has been moved earlier, before :command:`project` or
+ :command:`enable_language` is called.
+
+* ``ARMClang`` cpu/arch compile and link flags are no longer added
+ automatically based on the :variable:`CMAKE_SYSTEM_PROCESSOR`
+ variable or the undocumented ``CMAKE_SYSTEM_ARCH`` variable.
+ They must be specified explicitly. See policy :policy:`CMP0123`.
+
+Other Changes
+=============
+
+* The :command:`find_file`, :command:`find_path`, :command:`find_program`,
+ and :command:`find_library` commands handle cache variables in the same way
+ regardless how they are defined. See policy :policy:`CMP0125` for details.
+
+* The :command:`find_file`, :command:`find_path`, :command:`find_program`,
+ and :command:`find_library` commands gained the option ``NO_CACHE`` to store
+ find result in normal variable.
+
+* The :command:`foreach` command now isolates loop variables in the loop scope.
+ See policy :policy:`CMP0124` for details.
+
+* The :command:`list` command's ``GET``, ``INSERT``, ``SUBLIST``, and
+ ``REMOVE_AT`` subcommands now error with invalid (i.e., non-integer) values
+ are given as any of their index arguments based on the setting of policy
+ :policy:`CMP0121`.
+
+* The :command:`set(CACHE)` command no longer removes a normal variable
+ of the same name, if any. See policy :policy:`CMP0126`.
+
+* :command:`target_link_libraries` calls referencing object libraries
+ via the :genex:`TARGET_OBJECTS` generator expression now place the
+ object files before all libraries on the link line, regardless of
+ their specified order. See documentation on
+ :ref:`Linking Object Libraries via \$\<TARGET_OBJECTS\>` for details.
+
+* The :ref:`Ninja Generators` now pass source files and include directories
+ to the compiler using absolute paths. This makes diagnostic messages and
+ debug symbols more consistent, and matches the :ref:`Makefile Generators`.
+
+* The :generator:`NMake Makefiles` generator now encodes the generated
+ makefiles as UTF-8 with a BOM when using ``nmake`` from VS 9 or above.
+
+* The :ref:`Visual Studio Generators` for VS 2010 and above now place
+ per-source preprocessor definitions after target-wide preprocssor
+ definitions. This makes VS consistent with the :ref:`Ninja Generators`
+ and the :ref:`Makefile Generators`.
+
+* The precompiled binaries provided on
+ `cmake.org <https://cmake.org/download/>`_ now support
+ ``liblzma`` multi-threading. See the :variable:`CPACK_THREADS` and
+ :variable:`CPACK_ARCHIVE_THREADS` variables.
diff --git a/Help/release/dev/0-sample-topic.rst b/Help/release/dev/0-sample-topic.rst
deleted file mode 100644
index e4cc01e..0000000
--- a/Help/release/dev/0-sample-topic.rst
+++ /dev/null
@@ -1,7 +0,0 @@
-0-sample-topic
---------------
-
-* This is a sample release note for the change in a topic.
- Developers should add similar notes for each topic branch
- making a noteworthy change. Each document should be named
- and titled to match the topic name to avoid merge conflicts.
diff --git a/Help/release/dev/ARMClang-cpu-arch-flags.rst b/Help/release/dev/ARMClang-cpu-arch-flags.rst
deleted file mode 100644
index 5e885fe..0000000
--- a/Help/release/dev/ARMClang-cpu-arch-flags.rst
+++ /dev/null
@@ -1,7 +0,0 @@
-ARMClang-cpu-arch-flags
------------------------
-
-* ``ARMClang`` cpu/arch compile and link flags are no longer added
- automatically based on the :variable:`CMAKE_SYSTEM_PROCESSOR`
- variable or the undocumented ``CMAKE_SYSTEM_ARCH`` variable.
- They must be specified explicitly. See policy :policy:`CMP0123`.
diff --git a/Help/release/dev/FindDevIL-imported-targets.rst b/Help/release/dev/FindDevIL-imported-targets.rst
deleted file mode 100644
index aa0929e..0000000
--- a/Help/release/dev/FindDevIL-imported-targets.rst
+++ /dev/null
@@ -1,4 +0,0 @@
-FindDevIL
----------
-
-* The :module:`FindDevIL` module now provides imported targets.
diff --git a/Help/release/dev/FindIconv-version.rst b/Help/release/dev/FindIconv-version.rst
deleted file mode 100644
index 3546d86..0000000
--- a/Help/release/dev/FindIconv-version.rst
+++ /dev/null
@@ -1,4 +0,0 @@
-FindIconv-version
------------------
-
-* The :module:`FindIconv` module now has version support.
diff --git a/Help/release/dev/FindIntl-version.rst b/Help/release/dev/FindIntl-version.rst
deleted file mode 100644
index 5365cf1..0000000
--- a/Help/release/dev/FindIntl-version.rst
+++ /dev/null
@@ -1,4 +0,0 @@
-FindIntl-version
-----------------
-
-* The :module:`FindIntl` module now has version support.
diff --git a/Help/release/dev/FindMsys.rst b/Help/release/dev/FindMsys.rst
deleted file mode 100644
index d237c4e..0000000
--- a/Help/release/dev/FindMsys.rst
+++ /dev/null
@@ -1,6 +0,0 @@
-FindMsys
---------
-
-* The :module:`FindMsys` module was added to find MSYS installations.
- Like :module:`FindCygwin`, it is used automatically by some other
- find modules to locate UNIX-style tools on Windows.
diff --git a/Help/release/dev/FindVulkan-add-Headers-glslangValidator-targets.rst b/Help/release/dev/FindVulkan-add-Headers-glslangValidator-targets.rst
deleted file mode 100644
index 4f224cc..0000000
--- a/Help/release/dev/FindVulkan-add-Headers-glslangValidator-targets.rst
+++ /dev/null
@@ -1,5 +0,0 @@
-FindVulkan-add-Headers-glslangValidator-targets
------------------------------------------------
-
-* The :module:`FindVulkan` module gained imported targets
- ``Vulkan::Headers`` and ``Vulkan::glslangValidator``.
diff --git a/Help/release/dev/UseJava-RESOURCES-NAMESPACE.rst b/Help/release/dev/UseJava-RESOURCES-NAMESPACE.rst
deleted file mode 100644
index caa07e7..0000000
--- a/Help/release/dev/UseJava-RESOURCES-NAMESPACE.rst
+++ /dev/null
@@ -1,5 +0,0 @@
-UseJava-RESOURCES-NAMESPACE
----------------------------
-
-* The :module:`UseJava` module command ``add_jar`` gained option RESOURCES
- allow explicit naming of resources with non-optional namespace.
diff --git a/Help/release/dev/UseSWIG-csharp.rst b/Help/release/dev/UseSWIG-csharp.rst
deleted file mode 100644
index dbbeaf1..0000000
--- a/Help/release/dev/UseSWIG-csharp.rst
+++ /dev/null
@@ -1,5 +0,0 @@
-UseSWIG-csharp
---------------
-
-* The :module:`UseSWIG` module use now standard library name conventions for
- ``CSharp`` language. See policy :policy:`CMP0122`.
diff --git a/Help/release/dev/UseSWIG-dependencies.rst b/Help/release/dev/UseSWIG-dependencies.rst
deleted file mode 100644
index b5a38c3..0000000
--- a/Help/release/dev/UseSWIG-dependencies.rst
+++ /dev/null
@@ -1,6 +0,0 @@
-UseSWIG-dependencies
---------------------
-
-* :module:`UseSWIG` module gained the capability, for
- :generator:`Xcode` generator, to use `swig` tool to generate implicit
- dependencies.
diff --git a/Help/release/dev/add_custom_command-DEPFILE-genex.rst b/Help/release/dev/add_custom_command-DEPFILE-genex.rst
deleted file mode 100644
index 52e5e9f..0000000
--- a/Help/release/dev/add_custom_command-DEPFILE-genex.rst
+++ /dev/null
@@ -1,5 +0,0 @@
-add_custom_command-DEPFILE-genex
---------------------------------
-
-* The :command:`add_custom_command` command ``DEPFILE`` option learned to
- support :manual:`generator expressions <cmake-generator-expressions(7)>`.
diff --git a/Help/release/dev/add_custom_command-DEPFILE.rst b/Help/release/dev/add_custom_command-DEPFILE.rst
deleted file mode 100644
index 893c374..0000000
--- a/Help/release/dev/add_custom_command-DEPFILE.rst
+++ /dev/null
@@ -1,6 +0,0 @@
-add_custom_command-DEPFILE
---------------------------
-
-* The :command:`add_custom_command` command gained ``DEPFILE`` support on
- the :generator:`Xcode` generator, and on :ref:`Visual Studio Generators`
- for VS 2012 and above.
diff --git a/Help/release/dev/add_custom_command-TARGET-genex.rst b/Help/release/dev/add_custom_command-TARGET-genex.rst
deleted file mode 100644
index 86f8b36..0000000
--- a/Help/release/dev/add_custom_command-TARGET-genex.rst
+++ /dev/null
@@ -1,5 +0,0 @@
-add_custom_command-TARGET-genex
--------------------------------
-
-* The :ref:`add_custom_command(TARGET) <add_custom_command(TARGET)>` command
- gained support for resolving target-dependent generator expressions.
diff --git a/Help/release/dev/c-std.rst b/Help/release/dev/c-std.rst
deleted file mode 100644
index 44daa85..0000000
--- a/Help/release/dev/c-std.rst
+++ /dev/null
@@ -1,6 +0,0 @@
-c-std
------
-
-* :prop_tgt:`C_STANDARD` and the
- :manual:`Compile Features <cmake-compile-features(7)>` functionality gained
- support for C17 and C23.
diff --git a/Help/release/dev/capabilties-generator-platforms.rst b/Help/release/dev/capabilties-generator-platforms.rst
deleted file mode 100644
index 5de2b67..0000000
--- a/Help/release/dev/capabilties-generator-platforms.rst
+++ /dev/null
@@ -1,6 +0,0 @@
-capabilties-generator-platforms
--------------------------------
-
-* The :manual:`cmake(1)` ``-E capabilities`` output now contains for each
- generator a ``supportedPlatforms`` field listing platform known to
- be supported in :variable:`CMAKE_GENERATOR_PLATFORM`.
diff --git a/Help/release/dev/cmake-install-prefix-command.rst b/Help/release/dev/cmake-install-prefix-command.rst
deleted file mode 100644
index 2de5d91..0000000
--- a/Help/release/dev/cmake-install-prefix-command.rst
+++ /dev/null
@@ -1,8 +0,0 @@
-cmake-install-prefix-command
-----------------------------
-
-* The :manual:`cmake(1)` command gained the ``--install-prefix <dir>``
- command line option to specify the location of the install prefix.
-
-* :manual:`cmake-presets(7)` configure preset gained support for specifying
- the install prefix.
diff --git a/Help/release/dev/cmake-presets-condition.rst b/Help/release/dev/cmake-presets-condition.rst
deleted file mode 100644
index aa01bc1..0000000
--- a/Help/release/dev/cmake-presets-condition.rst
+++ /dev/null
@@ -1,4 +0,0 @@
-cmake-presets-condition
------------------------
-
-* :manual:`cmake-presets(7)` now support conditional enabling of presets.
diff --git a/Help/release/dev/cmake-presets-host-system-name.rst b/Help/release/dev/cmake-presets-host-system-name.rst
deleted file mode 100644
index 8036939..0000000
--- a/Help/release/dev/cmake-presets-host-system-name.rst
+++ /dev/null
@@ -1,5 +0,0 @@
-cmake-presets-host-system-name
-------------------------------
-
-* :manual:`cmake-presets(7)` gained support for a new ``${hostSystemName}``
- macro.
diff --git a/Help/release/dev/cmake-presets-optional-generator-and-binarydir.rst b/Help/release/dev/cmake-presets-optional-generator-and-binarydir.rst
deleted file mode 100644
index 7973489..0000000
--- a/Help/release/dev/cmake-presets-optional-generator-and-binarydir.rst
+++ /dev/null
@@ -1,5 +0,0 @@
-cmake-presets-optional-generator-and-binarydir
-----------------------------------------------
-
-* :manual:`cmake-presets(7)` now support omitting the ``generator`` and
- ``binaryDir`` fields.
diff --git a/Help/release/dev/cmake-system-name-version.rst b/Help/release/dev/cmake-system-name-version.rst
deleted file mode 100644
index 9cfe401..0000000
--- a/Help/release/dev/cmake-system-name-version.rst
+++ /dev/null
@@ -1,10 +0,0 @@
-cmake-system-name-version
--------------------------
-
-* :variable:`CMAKE_HOST_SYSTEM_NAME`'s undocumented version-stripping behavior
- has been moved earlier, before :command:`project` or
- :command:`enable_language` is called.
-* :variable:`CMAKE_SYSTEM_NAME`'s undocumented version-stripping behavior has
- been removed entirely. If it is set by a ``-D`` flag or by a
- :manual:`toolchain file <cmake-toolchains(7)>`, it is left unaltered, even if
- it still contains a version number.
diff --git a/Help/release/dev/cmake-toolchain-command.rst b/Help/release/dev/cmake-toolchain-command.rst
deleted file mode 100644
index 111ca49..0000000
--- a/Help/release/dev/cmake-toolchain-command.rst
+++ /dev/null
@@ -1,5 +0,0 @@
-cmake-toolchain-command
-----------------------------
-
-* The :manual:`cmake(1)` command gained the ``--toolchain <path/to/file>``
- command line option to specify a toolchain file.
diff --git a/Help/release/dev/compile-options-order.rst b/Help/release/dev/compile-options-order.rst
deleted file mode 100644
index 2e182cd..0000000
--- a/Help/release/dev/compile-options-order.rst
+++ /dev/null
@@ -1,7 +0,0 @@
-compile-options-order
----------------------
-
-* The :ref:`Visual Studio Generators` for VS 2010 and above now place
- per-source preprocessor definitions after target-wide preprocssor
- definitions. This makes VS consistent with the :ref:`Ninja Generators`
- and the :ref:`Makefile Generators`.
diff --git a/Help/release/dev/cpack-dmg-filesystem.rst b/Help/release/dev/cpack-dmg-filesystem.rst
deleted file mode 100644
index e2a4742..0000000
--- a/Help/release/dev/cpack-dmg-filesystem.rst
+++ /dev/null
@@ -1,5 +0,0 @@
-cpack-dmg-filesystem
---------------------
-
-* The :cpack_gen:`CPack DragNDrop Generator` gained option
- :variable:`CPACK_DMG_FILESYSTEM` to control the ``.dmg`` filesystem.
diff --git a/Help/release/dev/cpack-install-opts.rst b/Help/release/dev/cpack-install-opts.rst
deleted file mode 100644
index 970f9a9..0000000
--- a/Help/release/dev/cpack-install-opts.rst
+++ /dev/null
@@ -1,6 +0,0 @@
-cpack-install-opts
-------------------
-
-* The new :variable:`CPACK_CUSTOM_INSTALL_VARIABLES`
- can be used to set variables in CPack ``cmake_install.cmake``
- invocations.
diff --git a/Help/release/dev/cpack-nsis-executable-name.rst b/Help/release/dev/cpack-nsis-executable-name.rst
deleted file mode 100644
index a3818db..0000000
--- a/Help/release/dev/cpack-nsis-executable-name.rst
+++ /dev/null
@@ -1,6 +0,0 @@
-cpack-nsis-executable-name
---------------------------
-
-* The :cpack_gen:`CPack NSIS Generator` gained a new variable
- :variable:`CPACK_NSIS_EXECUTABLE` to specify the makensis
- executable to use instead of the default one.
diff --git a/Help/release/dev/ctest-measurements-docs.rst b/Help/release/dev/ctest-measurements-docs.rst
deleted file mode 100644
index e47582e..0000000
--- a/Help/release/dev/ctest-measurements-docs.rst
+++ /dev/null
@@ -1,5 +0,0 @@
-ctest-measurements-docs
------------------------
-
-* :manual:`ctest(1)` gained documentation for its ability to capture
- :ref:`Additional Test Measurements`.
diff --git a/Help/release/dev/ctest-output-junit.rst b/Help/release/dev/ctest-output-junit.rst
deleted file mode 100644
index 66df19d..0000000
--- a/Help/release/dev/ctest-output-junit.rst
+++ /dev/null
@@ -1,5 +0,0 @@
-ctest-output-junit
-------------------
-
-* :manual:`ctest(1)` gained a ``--output-junit`` option to write test results
- to a JUnit XML file.
diff --git a/Help/release/dev/ctest-runtime-files.rst b/Help/release/dev/ctest-runtime-files.rst
deleted file mode 100644
index f13baa4..0000000
--- a/Help/release/dev/ctest-runtime-files.rst
+++ /dev/null
@@ -1,8 +0,0 @@
-ctest-runtime-files
--------------------
-
-* :manual:`ctest(1)` learned to recognize files attached to a test at run time.
- Previously it was only possible to attach files to tests at configure time
- by using the :prop_test:`ATTACHED_FILES` or
- :prop_test:`ATTACHED_FILES_ON_FAIL` test properties.
- See :ref:`Additional Test Measurements` for more information.
diff --git a/Help/release/dev/cxx-module-extensions.rst b/Help/release/dev/cxx-module-extensions.rst
deleted file mode 100644
index b9d0a8a..0000000
--- a/Help/release/dev/cxx-module-extensions.rst
+++ /dev/null
@@ -1,4 +0,0 @@
-cxx-module-extensions
----------------------
-
-* Source file extensions ``.ixx`` and ``.cppm`` are now treated as C++.
diff --git a/Help/release/dev/dir-IMPORTED_TARGETS.rst b/Help/release/dev/dir-IMPORTED_TARGETS.rst
deleted file mode 100644
index a2797ec..0000000
--- a/Help/release/dev/dir-IMPORTED_TARGETS.rst
+++ /dev/null
@@ -1,6 +0,0 @@
-dir-IMPORTED_TARGETS
---------------------
-
-* The :prop_dir:`IMPORTED_TARGETS` directory property was added to
- get a list of :ref:`Imported Targets` created in the current
- directory.
diff --git a/Help/release/dev/env-toolchain-file.rst b/Help/release/dev/env-toolchain-file.rst
deleted file mode 100644
index 0bcd493..0000000
--- a/Help/release/dev/env-toolchain-file.rst
+++ /dev/null
@@ -1,5 +0,0 @@
-env-toolchain-file
-------------------
-
-* The :envvar:`CMAKE_TOOLCHAIN_FILE` environment variable was added to
- provide a default value for the :variable:`CMAKE_TOOLCHAIN_FILE` variable.
diff --git a/Help/release/dev/file-COPY_FILE.rst b/Help/release/dev/file-COPY_FILE.rst
deleted file mode 100644
index 2f0cdf0..0000000
--- a/Help/release/dev/file-COPY_FILE.rst
+++ /dev/null
@@ -1,4 +0,0 @@
-file-COPY_ONLY
---------------
-
-* The :command:`file(COPY_FILE)` command was added to copy a file to another.
diff --git a/Help/release/dev/file-REAL_PATH-EXPAND_TILDE.rst b/Help/release/dev/file-REAL_PATH-EXPAND_TILDE.rst
deleted file mode 100644
index cdf1efa..0000000
--- a/Help/release/dev/file-REAL_PATH-EXPAND_TILDE.rst
+++ /dev/null
@@ -1,5 +0,0 @@
-file-REAL_PATH-EXPAND_TILDE
----------------------------
-
-* The :command:`file(REAL_PATH)` command gained the option ``EXPAND_TILDE`` to
- replace any leading tilde with the path to the user's home directory.
diff --git a/Help/release/dev/file-RENAME.rst b/Help/release/dev/file-RENAME.rst
deleted file mode 100644
index 6c1314d..0000000
--- a/Help/release/dev/file-RENAME.rst
+++ /dev/null
@@ -1,6 +0,0 @@
-file-RENAME
------------
-
-* The :command:`file(RENAME)` command learned to optionally capture
- failure in a result variable. It also gained a ``NO_REPLACE``
- option to fail if the destination exists.
diff --git a/Help/release/dev/fileapi-codemodel-directory.rst b/Help/release/dev/fileapi-codemodel-directory.rst
deleted file mode 100644
index f6515fd..0000000
--- a/Help/release/dev/fileapi-codemodel-directory.rst
+++ /dev/null
@@ -1,10 +0,0 @@
-fileapi-codemodel-directory
----------------------------
-
-* The :manual:`cmake-file-api(7)` "codemodel" version 2 ``version`` field has
- component been updated to 2.3.
-
-* The :manual:`cmake-file-api(7)` "codemodel" version 2 gained a
- new "directory" object containing directory-level information.
- This includes a list of installers generated by the :command:`install`
- command.
diff --git a/Help/release/dev/find_item-NO_CACHE.rst b/Help/release/dev/find_item-NO_CACHE.rst
deleted file mode 100644
index be5258c..0000000
--- a/Help/release/dev/find_item-NO_CACHE.rst
+++ /dev/null
@@ -1,6 +0,0 @@
-find_item-NO_CACHE
-------------------
-
-* The :command:`find_file`, :command:`find_path`, :command:`find_program`,
- and :command:`find_library` commands gained the option ``NO_CACHE`` to store
- find result in normal variable.
diff --git a/Help/release/dev/find_item-consistent-behavior.rst b/Help/release/dev/find_item-consistent-behavior.rst
deleted file mode 100644
index 43905e7..0000000
--- a/Help/release/dev/find_item-consistent-behavior.rst
+++ /dev/null
@@ -1,6 +0,0 @@
-find_item-consistent-behavior
------------------------------
-
-* The :command:`find_file`, :command:`find_path`, :command:`find_program`,
- and :command:`find_library` commands handle cache variables in the same way
- regardless how they are defined. See policy :policy:`CMP0125` for details.
diff --git a/Help/release/dev/foreach-variable-scope.rst b/Help/release/dev/foreach-variable-scope.rst
deleted file mode 100644
index 29a57bb..0000000
--- a/Help/release/dev/foreach-variable-scope.rst
+++ /dev/null
@@ -1,5 +0,0 @@
-foreach-variable-scope
-----------------------
-
-* The :command:`foreach` command restrict loop variables to the loop scope.
- See policy :policy:`CMP0124` for details.
diff --git a/Help/release/dev/fujitsu-compiler-support.rst b/Help/release/dev/fujitsu-compiler-support.rst
deleted file mode 100644
index c6f8cfb..0000000
--- a/Help/release/dev/fujitsu-compiler-support.rst
+++ /dev/null
@@ -1,11 +0,0 @@
-fujitsu-compiler-support
-------------------------
-
-* Addition of the ``Fujitsu`` compiler ID operating in traditional ``Trad``
- mode and ``FujitsuClang`` operating in ``Clang`` mode.
-* The :module:`FindOpenMP` module learned to support ``Fujitsu`` and
- ``FujitsuClang``.
-* The :module:`FindMPI` module learned to support ``Fujitsu`` and
- ``FujitsuClang`` in both host and cross compiling modes.
-* The :module:`FindBLAS` and :module:`FindLAPACK` modules learned to support
- the serial ``Fujitsu SSL2`` and parallel ``Fujitsu SSL2BLAMP`` libraries.
diff --git a/Help/release/dev/generate-cmake-build-command-parallel.rst b/Help/release/dev/generate-cmake-build-command-parallel.rst
deleted file mode 100644
index 1b8dd40..0000000
--- a/Help/release/dev/generate-cmake-build-command-parallel.rst
+++ /dev/null
@@ -1,6 +0,0 @@
-generate-cmake-build-command-parallel
--------------------------------------
-
-* The :command:`build_command` command gained a ``PARALLEL_LEVEL`` option.
-
-* The :command:`ctest_build` command gained a ``PARALLEL_LEVEL`` option.
diff --git a/Help/release/dev/get-runtime-dependencies-file-filter.rst b/Help/release/dev/get-runtime-dependencies-file-filter.rst
deleted file mode 100644
index 3fc17ac..0000000
--- a/Help/release/dev/get-runtime-dependencies-file-filter.rst
+++ /dev/null
@@ -1,5 +0,0 @@
-get-runtime-dependencies-file-filter
-------------------------------------
-
-* The :command:`file(GET_RUNTIME_DEPENDENCIES)` command gained new
- ``POST_INCLUDE_FILES`` and ``POST_EXCLUDE_FILES`` arguments.
diff --git a/Help/release/dev/hip.rst b/Help/release/dev/hip.rst
deleted file mode 100644
index abf9a35..0000000
--- a/Help/release/dev/hip.rst
+++ /dev/null
@@ -1,5 +0,0 @@
-hip
----
-
-* CMake learned to support ``HIP`` as a first-class language that can be
- enabled via the :command:`project` and :command:`enable_language` commands.
diff --git a/Help/release/dev/ifw-default-version-operator.rst b/Help/release/dev/ifw-default-version-operator.rst
deleted file mode 100644
index 4aeace2..0000000
--- a/Help/release/dev/ifw-default-version-operator.rst
+++ /dev/null
@@ -1,7 +0,0 @@
-ifw-default-version-operator
-----------------------------
-
-* Names given as ``DEPENDS`` or ``DEPENDENCIES`` arguments to
- :command:`cpack_ifw_configure_component` or
- :command:`cpack_ifw_configure_component_group` may now contain hyphens.
- This requires QtIFW 3.1 or later.
diff --git a/Help/release/dev/install-imported-runtime-artifacts.rst b/Help/release/dev/install-imported-runtime-artifacts.rst
deleted file mode 100644
index e2821c1..0000000
--- a/Help/release/dev/install-imported-runtime-artifacts.rst
+++ /dev/null
@@ -1,5 +0,0 @@
-install-imported-runtime-artifacts
-----------------------------------
-
-* The :command:`install` command gained a new ``IMPORTED_RUNTIME_ARTIFACTS``
- mode, which can be used to install the runtime artifacts of imported targets.
diff --git a/Help/release/dev/install-runtime-dependencies.rst b/Help/release/dev/install-runtime-dependencies.rst
deleted file mode 100644
index 58c92e6..0000000
--- a/Help/release/dev/install-runtime-dependencies.rst
+++ /dev/null
@@ -1,9 +0,0 @@
-install-runtime-dependencies
-----------------------------
-
-* The :command:`install(TARGETS)` command gained new ``RUNTIME_DEPENDENCIES``
- and ``RUNTIME_DEPENDENCY_SET`` arguments, which can be used to install
- runtime dependencies using :command:`file(GET_RUNTIME_DEPENDENCIES)`.
-* The :command:`install` command gained a new ``RUNTIME_DEPENDENCY_SET`` mode,
- which can be used to install runtime dependencies using
- :command:`file(GET_RUNTIME_DEPENDENCIES)`.
diff --git a/Help/release/dev/install-script-all-components.rst b/Help/release/dev/install-script-all-components.rst
deleted file mode 100644
index e421d3d..0000000
--- a/Help/release/dev/install-script-all-components.rst
+++ /dev/null
@@ -1,7 +0,0 @@
-install-script-all-components
------------------------------
-
-* The :command:`install(SCRIPT|CODE)` command
- supports a new option ``ALL_COMPONENTS`` which allows
- the corresponding code to run for every component of
- a per component installation.
diff --git a/Help/release/dev/link-objects-first.rst b/Help/release/dev/link-objects-first.rst
deleted file mode 100644
index 0c622e7..0000000
--- a/Help/release/dev/link-objects-first.rst
+++ /dev/null
@@ -1,8 +0,0 @@
-link-objects-first
-------------------
-
-* :command:`target_link_libraries` calls referencing object libraries
- via the :genex:`TARGET_OBJECTS` generator expression now place the
- object files before all libraries on the link line, regardless of
- their specified order. See documentation on
- :ref:`Linking Object Libraries via \$\<TARGET_OBJECTS\>` for details.
diff --git a/Help/release/dev/linker-launcher.rst b/Help/release/dev/linker-launcher.rst
deleted file mode 100644
index 6563347..0000000
--- a/Help/release/dev/linker-launcher.rst
+++ /dev/null
@@ -1,7 +0,0 @@
-linker-launcher
----------------
-
-* The :ref:`Makefile Generators` and the :generator:`Ninja` generator learned to
- add linker launcher tools along with the linker for ``C``, ``CXX``, ``OBJC``, and
- ``OBJCXX`` languages. See the :variable:`CMAKE_<LANG>_LINKER_LAUNCHER` variable
- and :prop_tgt:`<LANG>_LINKER_LAUNCHER` target property for details.
diff --git a/Help/release/dev/list-index-arg-parsing.rst b/Help/release/dev/list-index-arg-parsing.rst
deleted file mode 100644
index 2ea525b..0000000
--- a/Help/release/dev/list-index-arg-parsing.rst
+++ /dev/null
@@ -1,7 +0,0 @@
-list-index-arg-parsing
-----------------------
-
-* The :command:`list` command's ``GET``, ``INSERT``, ``SUBLIST``, and
- ``REMOVE_AT`` subcommands now error with invalid (i.e., non-integer) values
- are given as any of their index arguments based on the setting of policy
- :policy:`CMP0121`.
diff --git a/Help/release/dev/lzma-threads.rst b/Help/release/dev/lzma-threads.rst
deleted file mode 100644
index a481cfa..0000000
--- a/Help/release/dev/lzma-threads.rst
+++ /dev/null
@@ -1,7 +0,0 @@
-lzma-threads
-------------
-
-* The precompiled binaries provided on
- `cmake.org <https://cmake.org/download/>`_ now support
- ``liblzma`` multi-threading. See the :variable:`CPACK_THREADS` and
- :variable:`CPACK_ARCHIVE_THREADS` variables.
diff --git a/Help/release/dev/message-color.rst b/Help/release/dev/message-color.rst
deleted file mode 100644
index 4acf15e..0000000
--- a/Help/release/dev/message-color.rst
+++ /dev/null
@@ -1,4 +0,0 @@
-message-color
--------------
-
-* Messages printed to a terminal now may be colored by message type.
diff --git a/Help/release/dev/msys.rst b/Help/release/dev/msys.rst
deleted file mode 100644
index ece5de7..0000000
--- a/Help/release/dev/msys.rst
+++ /dev/null
@@ -1,4 +0,0 @@
-msys
-----
-
-* CMake now supports the MSYS runtime environment, much like CYGWIN.
diff --git a/Help/release/dev/ninja-absolute-paths.rst b/Help/release/dev/ninja-absolute-paths.rst
deleted file mode 100644
index 2dfc1b7..0000000
--- a/Help/release/dev/ninja-absolute-paths.rst
+++ /dev/null
@@ -1,6 +0,0 @@
-ninja-absolute-paths
---------------------
-
-* The :ref:`Ninja Generators` now pass source files and include directories
- to the compiler using absolute paths. This makes diagnostic messages and
- debug symbols more consistent, and matches the :ref:`Makefile Generators`.
diff --git a/Help/release/dev/nmake-utf8.rst b/Help/release/dev/nmake-utf8.rst
deleted file mode 100644
index ebbb45b..0000000
--- a/Help/release/dev/nmake-utf8.rst
+++ /dev/null
@@ -1,5 +0,0 @@
-nmake-utf8
-----------
-
-* The :generator:`NMake Makefiles` generator now encodes the generated
- makefiles as UTF-8 with a BOM when using ``nmake`` from VS 9 or above.
diff --git a/Help/release/dev/objc-std-17-23.rst b/Help/release/dev/objc-std-17-23.rst
deleted file mode 100644
index 5aba395..0000000
--- a/Help/release/dev/objc-std-17-23.rst
+++ /dev/null
@@ -1,4 +0,0 @@
-objc-std-17-23
---------------
-
-* :prop_tgt:`OBJC_STANDARD` gained support for C17 and C23.
diff --git a/Help/release/dev/project-is-top-level.rst b/Help/release/dev/project-is-top-level.rst
deleted file mode 100644
index 568afe0..0000000
--- a/Help/release/dev/project-is-top-level.rst
+++ /dev/null
@@ -1,6 +0,0 @@
-project-is-top-level
---------------------
-
-* :command:`project` now sets variables :variable:`PROJECT_IS_TOP_LEVEL` and
- :variable:`<PROJECT-NAME>_IS_TOP_LEVEL` to indicate whether it was called
- in a top level ``CMakeLists.txt`` file.
diff --git a/Help/release/dev/runtime-dll-deps.rst b/Help/release/dev/runtime-dll-deps.rst
deleted file mode 100644
index 831410f..0000000
--- a/Help/release/dev/runtime-dll-deps.rst
+++ /dev/null
@@ -1,4 +0,0 @@
-runtime-dll-deps
-----------------
-
-* A new :genex:`TARGET_RUNTIME_DLLS` generator expression was added.
diff --git a/Help/release/dev/set-cache-variable.rst b/Help/release/dev/set-cache-variable.rst
deleted file mode 100644
index a96242c..0000000
--- a/Help/release/dev/set-cache-variable.rst
+++ /dev/null
@@ -1,5 +0,0 @@
-set-cache-variable
-------------------
-
-* The :command:`set(CACHE)` command no longer removes a normal variable of the
- same name, if any. See policy :policy:`CMP0126`.
diff --git a/Help/release/dev/xcode_app_extensions.rst b/Help/release/dev/xcode_app_extensions.rst
deleted file mode 100644
index 7be7d82..0000000
--- a/Help/release/dev/xcode_app_extensions.rst
+++ /dev/null
@@ -1,11 +0,0 @@
-xcode_app_extensions
---------------------
-
-* The :prop_tgt:`XCODE_EMBED_APP_EXTENSIONS <XCODE_EMBED_<type>>` target property
- was added to tell the :generator:`Xcode` generator to embed app extensions
- such as iMessage sticker packs.
- Aspects of the embedding can be customized with the
- :prop_tgt:`XCODE_EMBED_APP_EXTENSIONS_PATH <XCODE_EMBED_<type>>`,
- :prop_tgt:`XCODE_EMBED_APP_EXTENSIONS_CODE_SIGN_ON_COPY <XCODE_EMBED_<type>_CODE_SIGN_ON_COPY>` and
- :prop_tgt:`XCODE_EMBED_APP_EXTENSIONS_REMOVE_HEADERS_ON_COPY <XCODE_EMBED_<type>_REMOVE_HEADERS_ON_COPY>`
- properties.
diff --git a/Help/release/index.rst b/Help/release/index.rst
index 5dfca05..75667e5 100644
--- a/Help/release/index.rst
+++ b/Help/release/index.rst
@@ -7,14 +7,13 @@ CMake Release Notes
This file should include the adjacent "dev.txt" file
in development versions but not in release versions.
-.. include:: dev.txt
-
Releases
========
.. toctree::
:maxdepth: 1
+ 3.21 <3.21>
3.20 <3.20>
3.19 <3.19>
3.18 <3.18>
diff --git a/Help/variable/CPACK_CUSTOM_INSTALL_VARIABLES.rst b/Help/variable/CPACK_CUSTOM_INSTALL_VARIABLES.rst
index 534e2ad..1c070b8 100644
--- a/Help/variable/CPACK_CUSTOM_INSTALL_VARIABLES.rst
+++ b/Help/variable/CPACK_CUSTOM_INSTALL_VARIABLES.rst
@@ -1,6 +1,8 @@
CPACK_CUSTOM_INSTALL_VARIABLES
------------------------------
+.. versionadded:: 3.21
+
CPack variables (set via e.g. ``cpack -D``, ``CPackConfig.cmake`` or
:variable:`CPACK_PROJECT_CONFIG_FILE` scripts) are not directly visible in
installation scripts. Instead, one can pass a list of ``varName=value``
diff --git a/Modules/Internal/CheckCompilerFlag.cmake b/Modules/Internal/CheckCompilerFlag.cmake
index 9eb1bf0..693e28b 100644
--- a/Modules/Internal/CheckCompilerFlag.cmake
+++ b/Modules/Internal/CheckCompilerFlag.cmake
@@ -13,10 +13,12 @@ function(CMAKE_CHECK_COMPILER_FLAG _lang _flag _var)
if(_lang STREQUAL "C")
set(_lang_src "int main(void) { return 0; }")
- set(_lang_fail_regex FAIL_REGEX "command[ -]line option .* is valid for .* but not for C")
+ set(_lang_fail_regex FAIL_REGEX "command[ -]line option .* is valid for .* but not for C"
+ FAIL_REGEX "-Werror=.* argument .* is not valid for C")
elseif(_lang STREQUAL "CXX")
set(_lang_src "int main() { return 0; }")
- set(_lang_fail_regex FAIL_REGEX "command[ -]line option .* is valid for .* but not for C\\+\\+")
+ set(_lang_fail_regex FAIL_REGEX "command[ -]line option .* is valid for .* but not for C\\+\\+"
+ FAIL_REGEX "-Werror=.* argument .* is not valid for C\\+\\+")
elseif(_lang STREQUAL "CUDA")
set(_lang_src "__host__ int main() { return 0; }")
set(_lang_fail_regex FAIL_REGEX "command[ -]line option .* is valid for .* but not for C\\+\\+" # Host GNU
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 46e94f1..ad174a7 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,8 +1,8 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
-set(CMake_VERSION_MINOR 20)
-set(CMake_VERSION_PATCH 20210617)
-#set(CMake_VERSION_RC 0)
+set(CMake_VERSION_MINOR 21)
+set(CMake_VERSION_PATCH 0)
+set(CMake_VERSION_RC 0)
set(CMake_VERSION_IS_DIRTY 0)
# Start with the full version number used in tags. It has no dev info.
diff --git a/Utilities/Sphinx/cmake.py b/Utilities/Sphinx/cmake.py
index 9fa56cd..9215e14 100644
--- a/Utilities/Sphinx/cmake.py
+++ b/Utilities/Sphinx/cmake.py
@@ -260,6 +260,8 @@ class CMakeTransform(Transform):
# Insert the object link target.
if objtype == 'command':
targetname = title.lower()
+ elif objtype == 'guide' and not tail.endswith('/index'):
+ targetname = tail
else:
if objtype == 'genex':
m = CMakeXRefRole._re_genex.match(title)
@@ -312,6 +314,7 @@ class CMakeXRefRole(XRefRole):
_re = re.compile(r'^(.+?)(\s*)(?<!\x00)<(.*?)>$', re.DOTALL)
_re_sub = re.compile(r'^([^()\s]+)\s*\(([^()]*)\)$', re.DOTALL)
_re_genex = re.compile(r'^\$<([^<>:]+)(:[^<>]+)?>$', re.DOTALL)
+ _re_guide = re.compile(r'^([^<>/]+)/([^<>]*)$', re.DOTALL)
def __call__(self, typ, rawtext, text, *args, **keys):
# Translate CMake command cross-references of the form:
@@ -326,6 +329,10 @@ class CMakeXRefRole(XRefRole):
m = CMakeXRefRole._re_genex.match(text)
if m:
text = '%s <%s>' % (text, m.group(1))
+ elif typ == 'cmake:guide':
+ m = CMakeXRefRole._re_guide.match(text)
+ if m:
+ text = '%s <%s>' % (m.group(2), text)
# CMake cross-reference targets frequently contain '<' so escape
# any explicit `<target>` with '<' not preceded by whitespace.
while True:
@@ -369,6 +376,10 @@ class CMakeXRefTransform(Transform):
continue
objname = ref['reftarget']
+ if objtype == 'guide' and CMakeXRefRole._re_guide.match(objname):
+ # Do not index cross-references to guide sections.
+ continue
+
targetnum = env.new_serialno('index-%s:%s' % (objtype, objname))
targetid = 'index-%s-%s:%s' % (targetnum, objtype, objname)