Merge topic 'check-curses-min-cmake' into release-3.26
d70582eed8 ccmake: Update minimum required version of CMake for curses check
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !8272
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 87a75e8..768a902 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -16,7 +16,6 @@
- build
- test
- test-ext
- - package
- upload
################################################################################
@@ -37,7 +36,6 @@
# Job prefixes:
# - `b:` build
-# - `k:` package
# - `l:` lint
# - `p:` prep
# - `t:` test
@@ -914,7 +912,7 @@
b:macos-package:
extends:
- .macos_package
- - .cmake_build_macos_package
+ - .cmake_build_macos
- .cmake_release_artifacts
- .macos_x86_64_tags_package
- .run_only_for_package
@@ -937,7 +935,7 @@
b:macos10.10-package:
extends:
- .macos10.10_package
- - .cmake_build_macos_package
+ - .cmake_build_macos
- .cmake_release_artifacts
- .macos_x86_64_tags_package
- .run_only_for_package
@@ -1239,27 +1237,13 @@
extends:
- .windows_x86_64_package
- .cmake_build_windows
- - .cmake_build_package_artifacts
- - .windows_x86_64_tags_nonconcurrent_vs2022
- - .run_only_for_package
- dependencies:
- - p:doc-package
- needs:
- - p:doc-package
- variables:
- CMAKE_CI_ARTIFACTS_NAME: "artifacts-windows-x86_64-build"
-
-k:windows-x86_64-package:
- extends:
- - .windows_x86_64_package
- - .cmake_package_windows
- .cmake_release_artifacts
- .windows_x86_64_tags_nonconcurrent_vs2022
- .run_only_for_package
dependencies:
- - b:windows-x86_64-package
+ - p:doc-package
needs:
- - b:windows-x86_64-package
+ - p:doc-package
variables:
CMAKE_CI_ARTIFACTS_NAME: "artifacts-windows-x86_64"
@@ -1268,35 +1252,21 @@
- .rsync_upload_package
- .run_only_for_package
dependencies:
- - k:windows-x86_64-package
+ - b:windows-x86_64-package
needs:
- - k:windows-x86_64-package
+ - b:windows-x86_64-package
b:windows-i386-package:
extends:
- .windows_i386_package
- .cmake_build_windows
- - .cmake_build_package_artifacts
- - .windows_x86_64_tags_nonconcurrent_vs2022
- - .run_only_for_package
- dependencies:
- - p:doc-package
- needs:
- - p:doc-package
- variables:
- CMAKE_CI_ARTIFACTS_NAME: "artifacts-windows-i386-build"
-
-k:windows-i386-package:
- extends:
- - .windows_i386_package
- - .cmake_package_windows
- .cmake_release_artifacts
- .windows_x86_64_tags_nonconcurrent_vs2022
- .run_only_for_package
dependencies:
- - b:windows-i386-package
+ - p:doc-package
needs:
- - b:windows-i386-package
+ - p:doc-package
variables:
CMAKE_CI_ARTIFACTS_NAME: "artifacts-windows-i386"
@@ -1305,35 +1275,21 @@
- .rsync_upload_package
- .run_only_for_package
dependencies:
- - k:windows-i386-package
+ - b:windows-i386-package
needs:
- - k:windows-i386-package
+ - b:windows-i386-package
b:windows-arm64-package:
extends:
- .windows_arm64_package
- .cmake_build_windows
- - .cmake_build_package_artifacts
- - .windows_x86_64_tags_nonconcurrent_vs2022_arm64
- - .run_only_for_package
- dependencies:
- - p:doc-package
- needs:
- - p:doc-package
- variables:
- CMAKE_CI_ARTIFACTS_NAME: "artifacts-windows-arm64-build"
-
-k:windows-arm64-package:
- extends:
- - .windows_arm64_package
- - .cmake_package_windows
- .cmake_release_artifacts
- .windows_x86_64_tags_nonconcurrent_vs2022_arm64
- .run_only_for_package
dependencies:
- - b:windows-arm64-package
+ - p:doc-package
needs:
- - b:windows-arm64-package
+ - p:doc-package
variables:
CMAKE_CI_ARTIFACTS_NAME: "artifacts-windows-arm64"
@@ -1342,6 +1298,6 @@
- .rsync_upload_package
- .run_only_for_package
dependencies:
- - k:windows-arm64-package
+ - b:windows-arm64-package
needs:
- - k:windows-arm64-package
+ - b:windows-arm64-package
diff --git a/.gitlab/artifacts.yml b/.gitlab/artifacts.yml
index 1b5384f..41f24ed 100644
--- a/.gitlab/artifacts.yml
+++ b/.gitlab/artifacts.yml
@@ -63,35 +63,6 @@
- build/DartConfiguation.tcl
- build/CTestCustom.cmake
-.cmake_build_package_artifacts:
- artifacts:
- expire_in: 1d
- name: "$CMAKE_CI_ARTIFACTS_NAME"
- paths:
- # Allow CPack to find CMAKE_ROOT.
- - build/CMakeFiles/CMakeSourceDir.txt
-
- # Install rules.
- - build/**/cmake_install.cmake
-
- # We need the main binaries.
- - build/bin/
-
- # Pass through the documentation.
- - build/install-doc/
-
- # CPack configuration.
- - build/CPackConfig.cmake
- - build/CMakeCPackOptions.cmake
- - build/Source/QtDialog/QtDialogCPack.cmake
-
- # CPack/IFW packaging files.
- - build/CMake*.qs
-
- # CPack/WIX packaging files.
- - build/Utilities/Release/WiX/custom_action_dll*.wxs
- - build/Utilities/Release/WiX/CustomAction/CMakeWiXCustomActions.*
-
.cmake_release_artifacts:
artifacts:
expire_in: 5d
@@ -109,6 +80,8 @@
# Any source packages made.
- build/cmake-*.tar.gz
- build/cmake-*.zip
+ # Any unsigned packages made.
+ - build/unsigned/cmake-*
.cmake_junit_artifacts:
artifacts:
diff --git a/.gitlab/ci/CMakeCPack.cmake b/.gitlab/ci/CMakeCPack.cmake
new file mode 100644
index 0000000..971fe54
--- /dev/null
+++ b/.gitlab/ci/CMakeCPack.cmake
@@ -0,0 +1,3 @@
+if(NOT "$ENV{CMAKE_CI_PACKAGE}" MATCHES "^(dev)?$")
+ configure_file(${CMAKE_CURRENT_LIST_DIR}/package_info.cmake.in ${CMake_BINARY_DIR}/ci_package_info.cmake @ONLY)
+endif()
diff --git a/.gitlab/ci/configure_windows_package_common.cmake b/.gitlab/ci/configure_windows_package_common.cmake
index 46c0a3e..b3929a4 100644
--- a/.gitlab/ci/configure_windows_package_common.cmake
+++ b/.gitlab/ci/configure_windows_package_common.cmake
@@ -19,4 +19,6 @@
set(CMake_TEST_Qt6 OFF CACHE BOOL "")
set(Python_FIND_REGISTRY NEVER CACHE STRING "")
+set(CMake_CPACK_CUSTOM_SCRIPT "${CMAKE_CURRENT_LIST_DIR}/CMakeCPack.cmake" CACHE FILEPATH "")
+
include("${CMAKE_CURRENT_LIST_DIR}/configure_common.cmake")
diff --git a/.gitlab/ci/package_info.cmake.in b/.gitlab/ci/package_info.cmake.in
new file mode 100644
index 0000000..f9a5bb7
--- /dev/null
+++ b/.gitlab/ci/package_info.cmake.in
@@ -0,0 +1 @@
+set(CPACK_PACKAGE_FILE_NAME "@CPACK_PACKAGE_FILE_NAME@")
diff --git a/.gitlab/ci/package_macos.sh b/.gitlab/ci/package_macos.sh
new file mode 100644
index 0000000..7625c5d
--- /dev/null
+++ b/.gitlab/ci/package_macos.sh
@@ -0,0 +1,12 @@
+cd build
+cpack -G TGZ
+cpack -G DragNDrop
+
+case "$CMAKE_CI_PACKAGE" in
+ dev)
+ ;;
+ *)
+ mkdir -p unsigned
+ mv cmake-*-macos*-universal.* unsigned/
+ ;;
+esac
diff --git a/.gitlab/ci/package_windows.ps1 b/.gitlab/ci/package_windows.ps1
new file mode 100755
index 0000000..9ec2942
--- /dev/null
+++ b/.gitlab/ci/package_windows.ps1
@@ -0,0 +1,7 @@
+if (Test-Path -Path "build/ci_package_info.cmake" -PathType Leaf) {
+ cmake -P .gitlab/ci/package_windows_build.cmake
+} else {
+ cd build
+ cpack -G ZIP
+ cpack -G WIX
+}
diff --git a/.gitlab/ci/package_windows_build.cmake b/.gitlab/ci/package_windows_build.cmake
new file mode 100644
index 0000000..feb379c
--- /dev/null
+++ b/.gitlab/ci/package_windows_build.cmake
@@ -0,0 +1,41 @@
+cmake_minimum_required(VERSION 3.24)
+include(build/ci_package_info.cmake)
+
+set(build "${CMAKE_CURRENT_BINARY_DIR}/build")
+
+file(GLOB paths RELATIVE "${CMAKE_CURRENT_BINARY_DIR}"
+ # Allow CPack to find CMAKE_ROOT.
+ "${build}/CMakeFiles/CMakeSourceDir.txt"
+
+ # We need the main binaries.
+ "${build}/bin"
+
+ # Pass through the documentation.
+ "${build}/install-doc"
+
+ # CPack configuration.
+ "${build}/CPackConfig.cmake"
+ "${build}/CMakeCPackOptions.cmake"
+ "${build}/Source/QtDialog/QtDialogCPack.cmake"
+
+ # CPack/IFW packaging files.
+ "${build}/CMake*.qs"
+
+ # CPack/WIX packaging files.
+ "${build}/Utilities/Release/WiX/custom_action_dll*.wxs"
+ "${build}/Utilities/Release/WiX/CustomAction/CMakeWiXCustomActions.*"
+ )
+
+file(GLOB_RECURSE paths_recurse RELATIVE "${CMAKE_CURRENT_BINARY_DIR}"
+ # Install rules.
+ "${build}/cmake_install.cmake"
+ "${build}/*/cmake_install.cmake"
+ )
+
+# Create a "package" containing the build-tree files needed to build a package.
+file(MAKE_DIRECTORY build/unsigned)
+file(ARCHIVE_CREATE
+ OUTPUT build/unsigned/${CPACK_PACKAGE_FILE_NAME}.build.zip
+ PATHS ${paths} ${paths_recurse}
+ FORMAT zip
+ )
diff --git a/.gitlab/ci/post_build.ps1 b/.gitlab/ci/post_build.ps1
new file mode 100755
index 0000000..fbd8ae8
--- /dev/null
+++ b/.gitlab/ci/post_build.ps1
@@ -0,0 +1,4 @@
+$pwsh = [System.Diagnostics.Process]::GetCurrentProcess().MainModule.FileName
+if (Test-Path -Path ".gitlab/ci/post_build_$env:CMAKE_CONFIGURATION.ps1" -PathType Leaf) {
+ . ".gitlab/ci/post_build_$env:CMAKE_CONFIGURATION.ps1"
+}
diff --git a/.gitlab/ci/post_build_macos10.10_package.sh b/.gitlab/ci/post_build_macos10.10_package.sh
new file mode 100644
index 0000000..3b7bc72
--- /dev/null
+++ b/.gitlab/ci/post_build_macos10.10_package.sh
@@ -0,0 +1 @@
+. .gitlab/ci/package_macos.sh
diff --git a/.gitlab/ci/post_build_macos_package.sh b/.gitlab/ci/post_build_macos_package.sh
new file mode 100644
index 0000000..3b7bc72
--- /dev/null
+++ b/.gitlab/ci/post_build_macos_package.sh
@@ -0,0 +1 @@
+. .gitlab/ci/package_macos.sh
diff --git a/.gitlab/ci/post_build_windows_arm64_package.ps1 b/.gitlab/ci/post_build_windows_arm64_package.ps1
new file mode 100755
index 0000000..f98d995
--- /dev/null
+++ b/.gitlab/ci/post_build_windows_arm64_package.ps1
@@ -0,0 +1 @@
+. .gitlab/ci/package_windows.ps1
diff --git a/.gitlab/ci/post_build_windows_i386_package.ps1 b/.gitlab/ci/post_build_windows_i386_package.ps1
new file mode 100755
index 0000000..f98d995
--- /dev/null
+++ b/.gitlab/ci/post_build_windows_i386_package.ps1
@@ -0,0 +1 @@
+. .gitlab/ci/package_windows.ps1
diff --git a/.gitlab/ci/post_build_windows_x86_64_package.ps1 b/.gitlab/ci/post_build_windows_x86_64_package.ps1
new file mode 100755
index 0000000..f98d995
--- /dev/null
+++ b/.gitlab/ci/post_build_windows_x86_64_package.ps1
@@ -0,0 +1 @@
+. .gitlab/ci/package_windows.ps1
diff --git a/.gitlab/ci/pre_build.ps1 b/.gitlab/ci/pre_build.ps1
new file mode 100755
index 0000000..3a56687
--- /dev/null
+++ b/.gitlab/ci/pre_build.ps1
@@ -0,0 +1,4 @@
+$pwsh = [System.Diagnostics.Process]::GetCurrentProcess().MainModule.FileName
+if (Test-Path -Path ".gitlab/ci/pre_build_$env:CMAKE_CONFIGURATION.ps1" -PathType Leaf) {
+ . ".gitlab/ci/pre_build_$env:CMAKE_CONFIGURATION.ps1"
+}
diff --git a/.gitlab/os-macos.yml b/.gitlab/os-macos.yml
index 9cdc8d4..652a67a 100644
--- a/.gitlab/os-macos.yml
+++ b/.gitlab/os-macos.yml
@@ -154,25 +154,14 @@
# Allow the server to already be running.
- "sccache --start-server || :"
- sccache --show-stats
+ - .gitlab/ci/pre_build.sh
- ctest -VV -S .gitlab/ci/ctest_configure.cmake
- ctest -VV -S .gitlab/ci/ctest_build.cmake
+ - .gitlab/ci/post_build.sh
- sccache --show-stats
interruptible: true
-.cmake_build_macos_package:
- stage: build
-
- script:
- - *before_script_macos
- - ctest -VV -S .gitlab/ci/ctest_configure.cmake
- - ctest -VV -S .gitlab/ci/ctest_build.cmake
- - cd build
- - cpack -G TGZ
- - cpack -G DragNDrop
-
- interruptible: true
-
.cmake_test_macos:
stage: test
diff --git a/.gitlab/os-windows.yml b/.gitlab/os-windows.yml
index 24db802..ded3e65 100644
--- a/.gitlab/os-windows.yml
+++ b/.gitlab/os-windows.yml
@@ -358,25 +358,15 @@
- Invoke-Expression -Command .gitlab/ci/vcvarsall.ps1
- sccache --start-server
- sccache --show-stats
+ - (& "$pwsh" -File ".gitlab/ci/pre_build.ps1")
- ctest -VV -S .gitlab/ci/ctest_configure.cmake
- ctest -VV -S .gitlab/ci/ctest_build.cmake
+ - (& "$pwsh" -File ".gitlab/ci/post_build.ps1")
- sccache --show-stats
- sccache --stop-server
interruptible: true
-.cmake_package_windows:
- stage: package
-
- script:
- - *before_script_windows
- - Invoke-Expression -Command .gitlab/ci/vcvarsall.ps1
- - cd build
- - cpack -G ZIP
- - cpack -G WIX
-
- interruptible: true
-
.cmake_test_windows:
stage: test
diff --git a/.gitlab/rules.yml b/.gitlab/rules.yml
index 8fc40a7f..b85b728 100644
--- a/.gitlab/rules.yml
+++ b/.gitlab/rules.yml
@@ -66,11 +66,15 @@
rules:
- if: '$CMAKE_CI_PACKAGE == "dev"'
variables:
- RSYNC_DESTINATION: "dev"
+ RSYNC_DESTINATION: "kitware@cmake.org:dev/"
when: on_success
- if: '$CMAKE_CI_PACKAGE != null && $CI_JOB_STAGE == "prep"'
when: manual
- - if: '$CMAKE_CI_PACKAGE != null && $CI_JOB_STAGE != "package" && $CI_JOB_STAGE != "upload"'
+ - if: '$CMAKE_CI_PACKAGE != null && $CI_JOB_STAGE != "upload"'
+ when: on_success
+ - if: '$CMAKE_CI_PACKAGE != null && $CI_JOB_STAGE == "upload" && $CMAKE_CI_PACKAGE_URL != null'
+ variables:
+ RSYNC_DESTINATION: "$CMAKE_CI_PACKAGE_URL"
when: on_success
- when: never
@@ -78,19 +82,19 @@
rules:
- if: '$CMAKE_CI_PACKAGE =~ /v[0-9]+\.[0-9]+/'
variables:
- RSYNC_DESTINATION: "$CMAKE_CI_PACKAGE"
+ RSYNC_DESTINATION: "kitware@cmake.org:$CMAKE_CI_PACKAGE/"
CMAKE_CI_SPHINX_QTHELP: "ON"
CMAKE_CI_VERSION_NO_GIT: "ON"
when: manual
- if: '$CMAKE_CI_PROJECT_MAIN_BRANCH != null && $CI_COMMIT_BRANCH != null && $CMAKE_CI_PROJECT_MAIN_BRANCH == $CI_COMMIT_BRANCH'
variables:
- RSYNC_DESTINATION: "git-master"
+ RSYNC_DESTINATION: "kitware@cmake.org:git-master/"
CMAKE_CI_SPHINX_QTHELP: "OFF"
CMAKE_CI_VERSION_NO_GIT: "OFF"
when: on_success
- if: '$CMAKE_CI_PROJECT_CONTINUOUS_BRANCH != null && $CI_COMMIT_BRANCH != null && $CMAKE_CI_PROJECT_CONTINUOUS_BRANCH == $CI_COMMIT_BRANCH'
variables:
- RSYNC_DESTINATION: "git-stage"
+ RSYNC_DESTINATION: "kitware@cmake.org:git-stage/"
CMAKE_CI_SPHINX_QTHELP: "OFF"
CMAKE_CI_VERSION_NO_GIT: "OFF"
when: on_success
diff --git a/.gitlab/upload.yml b/.gitlab/upload.yml
index 745b078..114808f 100644
--- a/.gitlab/upload.yml
+++ b/.gitlab/upload.yml
@@ -17,7 +17,7 @@
- chmod 400 $RSYNC_BINARY_KEY
- ssh-keygen -y -f $RSYNC_BINARY_KEY > $RSYNC_BINARY_KEY.pub
- test -n "$RSYNC_DESTINATION"
- - rsync -tv --recursive -e "ssh -i $RSYNC_BINARY_KEY -o StrictHostKeyChecking=no -o LogLevel=ERROR" build/ kitware@cmake.org:$RSYNC_DESTINATION/
+ - rsync -tv --recursive -e "ssh -i $RSYNC_BINARY_KEY -o StrictHostKeyChecking=no -o LogLevel=ERROR" build/ "$RSYNC_DESTINATION"
.rsync_upload_help:
stage: upload
@@ -36,4 +36,4 @@
- chmod 400 $RSYNC_HELP_KEY
- ssh-keygen -y -f $RSYNC_HELP_KEY > $RSYNC_HELP_KEY.pub
- test -n "$RSYNC_DESTINATION"
- - rsync -tv --recursive --delete -e "ssh -i $RSYNC_HELP_KEY -o StrictHostKeyChecking=no -o LogLevel=ERROR" build/html/ kitware@cmake.org:$RSYNC_DESTINATION/
+ - rsync -tv --recursive --delete -e "ssh -i $RSYNC_HELP_KEY -o StrictHostKeyChecking=no -o LogLevel=ERROR" build/html/ "$RSYNC_DESTINATION"
diff --git a/CMakeCPack.cmake b/CMakeCPack.cmake
index 38fec3f..798affd 100644
--- a/CMakeCPack.cmake
+++ b/CMakeCPack.cmake
@@ -264,5 +264,9 @@
"~$"
)
+if(CMake_CPACK_CUSTOM_SCRIPT)
+ include(${CMake_CPACK_CUSTOM_SCRIPT})
+endif()
+
# include CPack model once all variables are set
include(CPack)
diff --git a/Help/command/try_compile.rst b/Help/command/try_compile.rst
index 21b063f..8abb6e0 100644
--- a/Help/command/try_compile.rst
+++ b/Help/command/try_compile.rst
@@ -14,7 +14,7 @@
.. code-block:: cmake
- try_compile(<resultVar> PROJECT <projectName>
+ try_compile(<compileResultVar> PROJECT <projectName>
SOURCE_DIR <srcdir>
[BINARY_DIR <bindir>]
[TARGET <targetName>]
@@ -26,8 +26,8 @@
.. versionadded:: 3.25
-Try building a project. The success or failure of the ``try_compile``,
-i.e. ``TRUE`` or ``FALSE`` respectively, is returned in ``<resultVar>``.
+Try building a project. Build success returns ``TRUE`` and build failure
+returns ``FALSE`` in ``<compileResultVar>``.
In this form, ``<srcdir>`` should contain a complete CMake project with a
``CMakeLists.txt`` file and all sources. The ``<bindir>`` and ``<srcdir>``
@@ -47,16 +47,13 @@
:ref:`configure-log try_compile event <try_compile configure-log event>`
if the ``NO_LOG`` option is not specified.
-This command also supports an alternate signature
-which was present in older versions of CMake:
+This command supports an alternate signature for CMake older than 3.25.
+The signature above is recommended for clarity.
.. code-block:: cmake
- try_compile(<resultVar> <bindir> <srcdir>
+ try_compile(<compileResultVar> <bindir> <srcdir>
<projectName> [<targetName>]
- [LOG_DESCRIPTION <text>]
- [NO_CACHE]
- [NO_LOG]
[CMAKE_FLAGS <flags>...]
[OUTPUT_VARIABLE <var>])
@@ -67,7 +64,7 @@
.. code-block:: cmake
- try_compile(<resultVar>
+ try_compile(<compileResultVar>
<SOURCES <srcfile...> |
SOURCE_FROM_CONTENT <name> <content> |
SOURCE_FROM_VAR <name> <var> |
@@ -90,8 +87,8 @@
Try building an executable or static library from one or more source files
(which one is determined by the :variable:`CMAKE_TRY_COMPILE_TARGET_TYPE`
-variable). The success or failure of the ``try_compile``, i.e. ``TRUE`` or
-``FALSE`` respectively, is returned in ``<resultVar>``.
+variable). Build success returns ``TRUE`` and build failure returns ``FALSE``
+in ``<compileResultVar>``.
In this form, one or more source files must be provided. Additionally, one of
``SOURCES`` and/or ``SOURCE_FROM_*`` must precede other keywords.
@@ -120,15 +117,12 @@
Such directories from previous runs are also unconditionally cleaned at the
beginning of any :program:`cmake` execution.
-This command also supports an alternate signature
-which was present in older versions of CMake:
+This command supports an alternate signature for CMake older than 3.25.
+The signature above is recommended for clarity.
.. code-block:: cmake
- try_compile(<resultVar> <bindir> <srcfile|SOURCES srcfile...>
- [LOG_DESCRIPTION <text>]
- [NO_CACHE]
- [NO_LOG]
+ try_compile(<compileResultVar> <bindir> <srcfile|SOURCES srcfile...>
[CMAKE_FLAGS <flags>...]
[COMPILE_DEFINITIONS <defs>...]
[LINK_OPTIONS <options>...]
@@ -300,8 +294,13 @@
The current settings of :policy:`CMP0065` and :policy:`CMP0083` are propagated
through to the generated test project.
-Set the :variable:`CMAKE_TRY_COMPILE_CONFIGURATION` variable to choose
-a build configuration.
+Set variable :variable:`CMAKE_TRY_COMPILE_CONFIGURATION` to choose a build
+configuration:
+
+* For multi-config generators, this selects which configuration to build.
+
+* For single-config generators, this sets :variable:`CMAKE_BUILD_TYPE` in
+ the test project.
.. versionadded:: 3.6
Set the :variable:`CMAKE_TRY_COMPILE_TARGET_TYPE` variable to specify
diff --git a/Help/command/try_run.rst b/Help/command/try_run.rst
index 7566264..3a4e203 100644
--- a/Help/command/try_run.rst
+++ b/Help/command/try_run.rst
@@ -32,20 +32,20 @@
[RUN_OUTPUT_VARIABLE <var>]
[RUN_OUTPUT_STDOUT_VARIABLE <var>]
[RUN_OUTPUT_STDERR_VARIABLE <var>]
- [OUTPUT_VARIABLE <var>]
[WORKING_DIRECTORY <var>]
[ARGS <args>...]
)
.. versionadded:: 3.25
-Try compiling a ``<srcfile>``. Returns ``TRUE`` or ``FALSE`` for success
-or failure in ``<compileResultVar>``. If the compile succeeded, runs the
-executable and returns its exit code in ``<runResultVar>``. If the
-executable was built, but failed to run, then ``<runResultVar>`` will be
-set to ``FAILED_TO_RUN``. See the :command:`try_compile` command for
-documentation of options common to both commands, and for information on how
-the test project is constructed to build the source file.
+Try building an executable from one or more source files. Build success
+returns ``TRUE`` and build failure returns ``FALSE`` in ``<compileResultVar>``.
+If the build succeeds, this runs the executable and stores the exit code in
+``<runResultVar>``. If the executable was built, but failed to run, then
+``<runResultVar>`` will be set to ``FAILED_TO_RUN``. See command
+:command:`try_compile` for documentation of options common to both commands,
+and for information on how the test project is constructed to build the source
+file.
One or more source files must be provided. Additionally, one of ``SOURCES``
and/or ``SOURCE_FROM_*`` must precede other keywords.
@@ -55,16 +55,13 @@
:ref:`configure-log try_run event <try_run configure-log event>`
if the ``NO_LOG`` option is not specified.
-This command also supports an alternate signature
-which was present in older versions of CMake:
+This command supports an alternate signature for CMake older than 3.25.
+The signature above is recommended for clarity.
.. code-block:: cmake
try_run(<runResultVar> <compileResultVar>
<bindir> <srcfile|SOURCES srcfile...>
- [LOG_DESCRIPTION <text>]
- [NO_CACHE]
- [NO_LOG]
[CMAKE_FLAGS <flags>...]
[COMPILE_DEFINITIONS <defs>...]
[LINK_OPTIONS <options>...]
@@ -75,8 +72,6 @@
[<LANG>_STANDARD_REQUIRED <bool>]
[<LANG>_EXTENSIONS <bool>]
[RUN_OUTPUT_VARIABLE <var>]
- [RUN_OUTPUT_STDOUT_VARIABLE <var>]
- [RUN_OUTPUT_STDERR_VARIABLE <var>]
[OUTPUT_VARIABLE <var>]
[WORKING_DIRECTORY <var>]
[ARGS <args>...]
@@ -119,15 +114,19 @@
Other Behavior Settings
^^^^^^^^^^^^^^^^^^^^^^^
-Set the :variable:`CMAKE_TRY_COMPILE_CONFIGURATION` variable to choose
-a build configuration.
+Set variable :variable:`CMAKE_TRY_COMPILE_CONFIGURATION` to choose a build
+configuration:
+
+* For multi-config generators, this selects which configuration to build.
+
+* For single-config generators, this sets :variable:`CMAKE_BUILD_TYPE` in
+ the test project.
Behavior when Cross Compiling
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. versionadded:: 3.3
- Use ``CMAKE_CROSSCOMPILING_EMULATOR`` when running cross-compiled
- binaries.
+ Use ``CMAKE_CROSSCOMPILING_EMULATOR`` when running cross-compiled binaries.
When cross compiling, the executable compiled in the first step
usually cannot be run on the build host. The ``try_run`` command checks
diff --git a/Modules/FindPython/Support.cmake b/Modules/FindPython/Support.cmake
index 1b3056f..f1be0f4 100644
--- a/Modules/FindPython/Support.cmake
+++ b/Modules/FindPython/Support.cmake
@@ -492,7 +492,7 @@
list (REMOVE_DUPLICATES _values)
elseif (NAME STREQUAL "SOABI")
# clean-up: remove prefix character and suffix
- if (_values MATCHES "^(\\.${CMAKE_SHARED_LIBRARY_SUFFIX}|\\.so|\\.pyd)$")
+ if (_values MATCHES "^(${CMAKE_SHARED_LIBRARY_SUFFIX}|\\.so|\\.pyd)$")
set(_values "")
else()
string (REGEX REPLACE "^[.-](.+)(${CMAKE_SHARED_LIBRARY_SUFFIX}|\\.(so|pyd))$" "\\1" _values "${_values}")
@@ -543,7 +543,7 @@
else()
if (_values)
# clean-up: remove prefix character and suffix
- if (_values MATCHES "^(\\.${CMAKE_SHARED_LIBRARY_SUFFIX}|\\.so|\\.pyd)$")
+ if (_values MATCHES "^(${CMAKE_SHARED_LIBRARY_SUFFIX}|\\.so|\\.pyd)$")
set(_values "")
else()
string (REGEX REPLACE "^[.-](.+)(${CMAKE_SHARED_LIBRARY_SUFFIX}|\\.(so|pyd))$" "\\1" _values "${_values}")
@@ -570,7 +570,7 @@
endforeach()
if (_values)
# clean-up: remove prefix character and suffix
- if (_values MATCHES "^(\\.${CMAKE_SHARED_LIBRARY_SUFFIX}|\\.so|\\.pyd)$")
+ if (_values MATCHES "^(${CMAKE_SHARED_LIBRARY_SUFFIX}|\\.so|\\.pyd)$")
set(_values "")
else()
string (REGEX REPLACE "^[.-](.+)(${CMAKE_SHARED_LIBRARY_SUFFIX}|\\.(so|pyd))$" "\\1" _values "${_values}")