summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitlab-ci.yml8
-rw-r--r--.gitlab/ci/intel.ps124
-rw-r--r--.gitlab/os-windows.yml24
-rw-r--r--Help/command/cmake_language.rst5
-rw-r--r--Help/command/file.rst8
-rw-r--r--Help/command/find_package.rst30
-rw-r--r--Help/command/try_compile.rst11
-rw-r--r--Help/manual/cmake-properties.7.rst1
-rw-r--r--Help/manual/cmake.1.rst36
-rw-r--r--Help/prop_gbl/PROPAGATE_TOP_LEVEL_INCLUDES_TO_TRY_COMPILE.rst19
-rw-r--r--Help/release/dev/dep-provider-try_compile.rst9
-rw-r--r--Help/variable/CMAKE_PROJECT_TOP_LEVEL_INCLUDES.rst11
-rw-r--r--Modules/CPack.cmake21
-rw-r--r--Modules/ExternalProject/mkdirs.cmake.in7
-rw-r--r--Modules/FetchContent.cmake7
-rw-r--r--Modules/FindMPI.cmake3
-rw-r--r--Modules/Internal/CPack/CPackDeb.cmake101
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/QtDialog/CMakeLists.txt5
-rw-r--r--Source/cmCoreTryCompile.cxx11
-rw-r--r--Source/cmFileCommand.cxx25
-rw-r--r--Source/kwsys/SystemTools.cxx69
-rw-r--r--Source/kwsys/SystemTools.hxx.in46
-rw-r--r--Tests/BuildDepends/CMakeLists.txt35
-rw-r--r--Tests/CMakeGUI/CMakeLists.txt5
-rw-r--r--Tests/CMakeLists.txt10
-rw-r--r--Tests/CMakeTests/FileTest.cmake.in4
-rw-r--r--Tests/CPackComponentsDEB/CMakeLists.txt31
-rw-r--r--Tests/CPackComponentsDEB/MyLibCPackConfig-shlibdeps-with-ORIGIN-RPATH-failure.cmake.in23
-rw-r--r--Tests/CPackComponentsDEB/MyLibCPackConfig-shlibdeps-with-ORIGIN-RPATH-success.cmake.in22
-rw-r--r--Tests/CPackComponentsDEB/RunCPackVerifyResult-shlibdeps-with-ORIGIN-RPATH-failure.cmake19
-rw-r--r--Tests/CPackComponentsDEB/RunCPackVerifyResult-shlibdeps-with-ORIGIN-RPATH-success.cmake75
-rw-r--r--Tests/CPackComponentsDEB/mylibapp.cpp17
-rw-r--r--Tests/CPackComponentsDEB/subdir/CMakeLists.txt5
-rw-r--r--Tests/CPackComponentsDEB/subdir/myotherlib.cpp8
-rw-r--r--Tests/CPackComponentsDEB/subdir/myotherlib.h1
-rw-r--r--Tests/RunCMake/ExternalProject/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/ExternalProject/SourceDirExisting.cmake16
-rw-r--r--Tests/RunCMake/FetchContent/DisableSourceChanges.cmake18
-rw-r--r--Tests/RunCMake/FetchContent/RunCMakeTest.cmake2
-rw-r--r--Tests/RunCMake/file/LOCK-error-no-path-stderr.txt2
-rw-r--r--Tests/RunCMake/file/TOUCH-result.txt1
-rw-r--r--Tests/RunCMake/file/TOUCH-stderr.txt9
-rw-r--r--Tests/RunCMake/file/TOUCH.cmake1
-rw-r--r--Tests/RunCMake/try_compile/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/try_compile/TopIncludes-config.txt85
-rw-r--r--Tests/RunCMake/try_compile/TopIncludes.cmake34
-rw-r--r--Tests/RunCMake/try_compile/include_error.cmake1
-rw-r--r--Tests/RunCMake/try_compile/include_pass1.cmake1
-rw-r--r--Tests/RunCMake/try_compile/include_pass2.cmake1
-rw-r--r--Tests/RunCMake/try_compile/proj/CMakeLists.txt2
51 files changed, 803 insertions, 110 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index e2e0959..d52beda 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1253,7 +1253,7 @@ t:windows-intel2021.9.0-ninja:
extends:
- .windows_intelclassic_ninja
- .cmake_test_windows_external
- - .windows_x86_64_tags_concurrent
+ - .windows_x86_64_tags_concurrent_vs2022
- .cmake_junit_artifacts
- .run_dependent
dependencies:
@@ -1264,11 +1264,11 @@ t:windows-intel2021.9.0-ninja:
CMAKE_CI_BUILD_NAME: windows_intel2021.9.0_ninja
CMAKE_CI_JOB_NIGHTLY: "true"
-t:windows-oneapi2023.1.0-ninja:
+t:windows-oneapi2024.1.0-ninja:
extends:
- .windows_inteloneapi_ninja
- .cmake_test_windows_external
- - .windows_x86_64_tags_concurrent
+ - .windows_x86_64_tags_concurrent_vs2022
- .cmake_junit_artifacts
- .run_dependent
dependencies:
@@ -1276,7 +1276,7 @@ t:windows-oneapi2023.1.0-ninja:
needs:
- t:windows-vs2022-x64-ninja
variables:
- CMAKE_CI_BUILD_NAME: windows_oneapi2023.1.0_ninja
+ CMAKE_CI_BUILD_NAME: windows_oneapi2024.1.0_ninja
CMAKE_CI_JOB_NIGHTLY: "true"
t:mingw_osdn_io-mingw_makefiles:
diff --git a/.gitlab/ci/intel.ps1 b/.gitlab/ci/intel.ps1
index 2262669..171e6a7 100644
--- a/.gitlab/ci/intel.ps1
+++ b/.gitlab/ci/intel.ps1
@@ -1,8 +1,19 @@
$erroractionpreference = "stop"
-if ("$env:CMAKE_CI_BUILD_NAME" -match "(^|_)(oneapi2023\.1\.0|intel2021\.9\.0)(_|$)") {
+if ("$env:CMAKE_CI_BUILD_NAME" -match "(^|_)(oneapi2024\.1\.0)(_|$)") {
+ # Intel oneAPI 2024.1.0
+ $version = "2024.1.0"
+ $version_dir = "2024.1"
+ $bin_dir = "bin"
+ $llvm_dir = "bin\compiler"
+ $filename = "intel-oneapi-$version-windows-1"
+ $sha256sum = "CB6857C08CD815722913358EC495AA575C2EED730646098A6CF7178E55FA7323"
+} elseif ("$env:CMAKE_CI_BUILD_NAME" -match "(^|_)(intel2021\.9\.0)(_|$)") {
# Intel oneAPI 2023.1.0
$version = "2023.1.0"
+ $version_dir = "2023.1.0"
+ $bin_dir = "windows\bin"
+ $llvm_dir = "windows\bin-llvm"
$filename = "intel-oneapi-$version-windows-1"
$sha256sum = "5AFCA9E0B03894565209B1295476163ABEBB1F1388E0F3EF5B4D0F9189E65BDC"
} else {
@@ -26,12 +37,12 @@ Move-Item -Path "$outdir\$filename" -Destination "$outdir\intel"
Remove-Item "$outdir\$tarball"
$compiler = "$outdir\intel\compiler"
-$bin = "$compiler\$version\windows\bin"
-$null = New-Item -ItemType Junction -Path "$compiler\latest" -Target "$compiler\$version"
+$bin = "$compiler\$version_dir\$bin_dir"
+$null = New-Item -ItemType Junction -Path "$compiler\latest" -Target "$compiler\$version_dir"
$null = New-Item -ItemType HardLink -Path "$bin\icx-cl.exe" -Target "$bin\icx.exe"
$null = New-Item -ItemType HardLink -Path "$bin\icx-cc.exe" -Target "$bin\icx.exe"
$null = New-Item -ItemType HardLink -Path "$bin\icpx.exe" -Target "$bin\icx.exe"
-$bin = "$compiler\$version\windows\bin-llvm"
+$bin = "$compiler\$version_dir\$llvm_dir"
$null = New-Item -ItemType HardLink -Path "$bin\clang-cl.exe" -Target "$bin\clang.exe"
$null = New-Item -ItemType HardLink -Path "$bin\clang-cpp.exe" -Target "$bin\clang.exe"
$null = New-Item -ItemType HardLink -Path "$bin\clang++.exe" -Target "$bin\clang.exe"
@@ -40,3 +51,8 @@ $null = New-Item -ItemType HardLink -Path "$bin\ld.lld.exe" -Target "$bin\lld
$null = New-Item -ItemType HardLink -Path "$bin\llvm-lib.exe" -Target "$bin\llvm-ar.exe"
Clear-Variable -Name bin
Clear-Variable -Name compiler
+
+Clear-Variable -Name llvm_dir
+Clear-Variable -Name bin_dir
+Clear-Variable -Name version_dir
+Clear-Variable -Name version
diff --git a/.gitlab/os-windows.yml b/.gitlab/os-windows.yml
index 1372136..33d0d57 100644
--- a/.gitlab/os-windows.yml
+++ b/.gitlab/os-windows.yml
@@ -35,25 +35,25 @@
variables:
VCVARSALL: "${VS170COMNTOOLS}\\..\\..\\VC\\Auxiliary\\Build\\vcvarsall.bat"
VCVARSPLATFORM: "x64"
- VCVARSVERSION: "14.36.32532"
+ VCVARSVERSION: "14.40.33807"
.windows_vcvarsall_vs2022_x86:
variables:
VCVARSALL: "${VS170COMNTOOLS}\\..\\..\\VC\\Auxiliary\\Build\\vcvarsall.bat"
VCVARSPLATFORM: "x86"
- VCVARSVERSION: "14.36.32532"
+ VCVARSVERSION: "14.40.33807"
.windows_vcvarsall_vs2022_x64_arm64:
variables:
VCVARSALL: "${VS170COMNTOOLS}\\..\\..\\VC\\Auxiliary\\Build\\vcvarsall.bat"
VCVARSPLATFORM: "x64_arm64"
- VCVARSVERSION: "14.36.32532"
+ VCVARSVERSION: "14.40.33807"
.windows_arm64_vcvarsall_vs2022:
variables:
VCVARSALL: "${VS170COMNTOOLS}\\..\\..\\VC\\Auxiliary\\Build\\vcvarsall.bat"
VCVARSPLATFORM: "arm64"
- VCVARSVERSION: "14.36.32532"
+ VCVARSVERSION: "14.40.33807"
.windows_vs2022_x64_pch:
extends:
@@ -119,7 +119,7 @@
CMAKE_CONFIGURATION: windows_vs2022_x64
CMAKE_GENERATOR: "Visual Studio 17 2022"
CMAKE_GENERATOR_PLATFORM: "x64"
- CMAKE_GENERATOR_TOOLSET: "v143,version=14.36.32532"
+ CMAKE_GENERATOR_TOOLSET: "v143,version=14.40.33807"
CMAKE_CI_NIGHTLY_IGNORE_DEPS: "true"
.windows_vs2019_x64:
@@ -282,7 +282,7 @@
CMAKE_CONFIGURATION: windows_arm64_vs2022
CMAKE_GENERATOR: "Visual Studio 17 2022"
CMAKE_GENERATOR_PLATFORM: "ARM64"
- CMAKE_GENERATOR_TOOLSET: "v143,version=14.36.32532"
+ CMAKE_GENERATOR_TOOLSET: "v143,version=14.40.33807"
CMAKE_CI_NIGHTLY_IGNORE_DEPS: "true"
.mingw_osdn_io:
@@ -316,7 +316,7 @@
- windows-x86_64
- shell
- vs2022
- - msvc-19.36
+ - msvc-14.40
- nonconcurrent
.windows_x86_64_tags_nonconcurrent_vs2022_arm64:
@@ -325,7 +325,7 @@
- windows-x86_64
- shell
- vs2022
- - msvc-19.36-arm64
+ - msvc-14.40-arm64
- nonconcurrent
.windows_x86_64_tags_concurrent_vs2022:
@@ -334,7 +334,7 @@
- windows-x86_64
- shell
- vs2022
- - msvc-19.36
+ - msvc-14.40
- concurrent
.windows_x86_64_tags_concurrent_vs2022_android:
@@ -344,7 +344,7 @@
- shell
- vs2022
- vs17-android
- - msvc-19.36
+ - msvc-14.40
- concurrent
.windows_x86_64_tags_concurrent_vs2019_android:
@@ -370,7 +370,7 @@
- windows-arm64
- shell
- vs2022
- - msvc-19.36
+ - msvc-14.40
- nonconcurrent
.windows_arm64_tags_concurrent_vs2022:
@@ -379,7 +379,7 @@
- windows-arm64
- shell
- vs2022
- - msvc-19.36
+ - msvc-14.40
- concurrent
## Windows-specific scripts
diff --git a/Help/command/cmake_language.rst b/Help/command/cmake_language.rst
index 38d06bb..a9c7653 100644
--- a/Help/command/cmake_language.rst
+++ b/Help/command/cmake_language.rst
@@ -271,6 +271,11 @@ Dependency Providers
:command:`project`. Calling ``cmake_language(SET_DEPENDENCY_PROVIDER)``
outside of that context will result in an error.
+ .. versionadded:: 3.30
+ The :prop_gbl:`PROPAGATE_TOP_LEVEL_INCLUDES_TO_TRY_COMPILE` global
+ property can be set if the dependency provider also wants to be enabled
+ in whole-project calls to :command:`try_compile`.
+
.. note::
The choice of dependency provider should always be under the user's control.
As a convenience, a project may choose to provide a file that users can
diff --git a/Help/command/file.rst b/Help/command/file.rst
index ef49faa..5b9dfac 100644
--- a/Help/command/file.rst
+++ b/Help/command/file.rst
@@ -192,6 +192,10 @@ Writing
With ``TOUCH`` and ``TOUCH_NOCREATE``, the contents of an existing file
will not be modified.
+ .. versionchanged:: 3.30
+ ``<files>`` can be an empty list. CMake 3.29 and earlier required
+ at least one file to be given.
+
.. signature::
file(GENERATE [...])
@@ -398,6 +402,10 @@ Filesystem
Create the given directories and their parents as needed.
+ .. versionchanged:: 3.30
+ ``<directories>`` can be an empty list. CMake 3.29 and earlier required
+ at least one directory to be given.
+
.. signature::
file(REMOVE <files>...)
file(REMOVE_RECURSE <files>...)
diff --git a/Help/command/find_package.rst b/Help/command/find_package.rst
index 9a007fa..f555fe4 100644
--- a/Help/command/find_package.rst
+++ b/Help/command/find_package.rst
@@ -21,6 +21,30 @@ Find a package (usually provided by something external to the project),
and load its package-specific details. Calls to this command can also
be intercepted by :ref:`dependency providers <dependency_providers>`.
+Typical Usage
+^^^^^^^^^^^^^
+
+Most calls to ``find_package()`` typically have the following form:
+
+.. parsed-literal::
+
+ find_package(<PackageName> [<version>] [REQUIRED] [COMPONENTS <components>...])
+
+The ``<PackageName>`` is the only mandatory argument. The ``<version>`` is
+often omitted, and ``REQUIRED`` should be given if the project cannot be
+configured successfully without the package. Some more complicated packages
+support components which can be selected with the ``COMPONENTS`` keyword, but
+most packages don't have that level of complexity.
+
+The above is a reduced form of the `basic signature`_. Where possible,
+projects should find packages using this form. This reduces complexity and
+maximizes the ways in which the package can be found or provided.
+
+Understanding the `basic signature`_ should be enough for general usage of
+``find_package()``. Project maintainers who intend to provide a config
+package should understand the bigger picture, as explained in
+:ref:`Full Signature` and all subsequent sections on this page.
+
Search Modes
^^^^^^^^^^^^
@@ -86,12 +110,6 @@ first before falling back to Module mode. The basic signature can also be
forced to use only Module mode with a ``MODULE`` keyword. If the
`full signature`_ is used, the command only searches in Config mode.
-Where possible, user code should generally look for packages using the
-`basic signature`_, since that allows the package to be found with any mode.
-Project maintainers wishing to provide a config package should understand
-the bigger picture, as explained in :ref:`Full Signature` and all subsequent
-sections on this page.
-
.. _`basic signature`:
Basic Signature
diff --git a/Help/command/try_compile.rst b/Help/command/try_compile.rst
index 9ee1d01..30ab41a 100644
--- a/Help/command/try_compile.rst
+++ b/Help/command/try_compile.rst
@@ -47,6 +47,11 @@ below for the meaning of other options.
:ref:`configure-log try_compile event <try_compile configure-log event>`
if the ``NO_LOG`` option is not specified.
+.. versionadded:: 3.30
+ If the :prop_gbl:`PROPAGATE_TOP_LEVEL_INCLUDES_TO_TRY_COMPILE` global
+ property is set to true, :variable:`CMAKE_PROJECT_TOP_LEVEL_INCLUDES` is
+ propagated into the project's build configuration.
+
This command supports an alternate signature for CMake older than 3.25.
The signature above is recommended for clarity.
@@ -388,6 +393,12 @@ configuration:
:variable:`CMAKE_MSVC_DEBUG_INFORMATION_FORMAT` to specify the MSVC debug
information format.
+.. versionadded:: 3.30
+ If the :prop_gbl:`PROPAGATE_TOP_LEVEL_INCLUDES_TO_TRY_COMPILE` global
+ property is set to true, :variable:`CMAKE_PROJECT_TOP_LEVEL_INCLUDES` is
+ propagated into the test project's build configuration when using the
+ :ref:`whole-project signature <Try Compiling Whole Projects>`.
+
See Also
^^^^^^^^
diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst
index a7cf774..673bc7c 100644
--- a/Help/manual/cmake-properties.7.rst
+++ b/Help/manual/cmake-properties.7.rst
@@ -46,6 +46,7 @@ Properties of Global Scope
/prop_gbl/PACKAGES_FOUND
/prop_gbl/PACKAGES_NOT_FOUND
/prop_gbl/PREDEFINED_TARGETS_FOLDER
+ /prop_gbl/PROPAGATE_TOP_LEVEL_INCLUDES_TO_TRY_COMPILE
/prop_gbl/REPORT_UNDEFINED_PROPERTIES
/prop_gbl/RULE_LAUNCH_COMPILE
/prop_gbl/RULE_LAUNCH_CUSTOM
diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst
index 621c005..afabb75 100644
--- a/Help/manual/cmake.1.rst
+++ b/Help/manual/cmake.1.rst
@@ -507,27 +507,33 @@ Options
.. option:: --preset <preset>, --preset=<preset>
- Reads a :manual:`preset <cmake-presets(7)>` from
- ``<path-to-source>/CMakePresets.json`` and
- ``<path-to-source>/CMakeUserPresets.json``. The preset may specify the
- generator and the build directory, and a list of variables and other
- arguments to pass to CMake. The current working directory must contain
- CMake preset files. The :manual:`CMake GUI <cmake-gui(1)>` can
- also recognize ``CMakePresets.json`` and ``CMakeUserPresets.json`` files. For
- full details on these files, see :manual:`cmake-presets(7)`.
-
- The presets are read before all other command line options. The options
- specified by the preset (variables, generator, etc.) can all be overridden by
- manually specifying them on the command line. For example, if the preset sets
- a variable called ``MYVAR`` to ``1``, but the user sets it to ``2`` with a
- ``-D`` argument, the value ``2`` is preferred.
+ Reads a :manual:`preset <cmake-presets(7)>` from ``CMakePresets.json`` and
+ ``CMakeUserPresets.json`` files, which must be located in the same directory
+ as the top level ``CMakeLists.txt`` file. The preset may specify the
+ generator, the build directory, a list of variables, and other arguments to
+ pass to CMake. At least one of ``CMakePresets.json`` or
+ ``CMakeUserPresets.json`` must be present.
+ The :manual:`CMake GUI <cmake-gui(1)>` also recognizes and supports
+ ``CMakePresets.json`` and ``CMakeUserPresets.json`` files. For full details
+ on these files, see :manual:`cmake-presets(7)`.
+
+ The presets are read before all other command line options, although the
+ :option:`-S <cmake -S>` option can be used to specify the source directory
+ containing the ``CMakePresets.json`` and ``CMakeUserPresets.json`` files.
+ If :option:`-S <cmake -S>` is not given, the current directory is assumed to
+ be the top level source directory and must contain the presets files. The
+ options specified by the chosen preset (variables, generator, etc.) can all
+ be overridden by manually specifying them on the command line. For example,
+ if the preset sets a variable called ``MYVAR`` to ``1``, but the user sets
+ it to ``2`` with a ``-D`` argument, the value ``2`` is preferred.
.. option:: --list-presets[=<type>]
Lists the available presets of the specified ``<type>``. Valid values for
``<type>`` are ``configure``, ``build``, ``test``, ``package``, or ``all``.
If ``<type>`` is omitted, ``configure`` is assumed. The current working
- directory must contain CMake preset files.
+ directory must contain CMake preset files unless the :option:`-S <cmake -S>`
+ option is used to specify a different top level source directory.
.. option:: --debugger
diff --git a/Help/prop_gbl/PROPAGATE_TOP_LEVEL_INCLUDES_TO_TRY_COMPILE.rst b/Help/prop_gbl/PROPAGATE_TOP_LEVEL_INCLUDES_TO_TRY_COMPILE.rst
new file mode 100644
index 0000000..edfee17
--- /dev/null
+++ b/Help/prop_gbl/PROPAGATE_TOP_LEVEL_INCLUDES_TO_TRY_COMPILE.rst
@@ -0,0 +1,19 @@
+PROPAGATE_TOP_LEVEL_INCLUDES_TO_TRY_COMPILE
+-------------------------------------------
+
+.. versionadded:: 3.30
+
+When this global property is set to true, the
+:variable:`CMAKE_PROJECT_TOP_LEVEL_INCLUDES` variable is propagated into
+:command:`try_compile` calls that use the
+:ref:`whole-project signature <Try Compiling Whole Projects>`.
+Calls to the :ref:`source file signature <Try Compiling Source Files>` are not
+affected by this property.
+``PROPAGATE_TOP_LEVEL_INCLUDES_TO_TRY_COMPILE`` is unset by default.
+
+For :ref:`dependency providers <dependency_providers_overview>` that want to
+be enabled in whole-project :command:`try_compile` calls, set this global
+property to true just before or after registering the provider.
+Note that all files listed in :variable:`CMAKE_PROJECT_TOP_LEVEL_INCLUDES`
+will need to be able to handle being included in such :command:`try_compile`
+calls, and it is the user's responsibility to ensure this.
diff --git a/Help/release/dev/dep-provider-try_compile.rst b/Help/release/dev/dep-provider-try_compile.rst
new file mode 100644
index 0000000..666c9b1
--- /dev/null
+++ b/Help/release/dev/dep-provider-try_compile.rst
@@ -0,0 +1,9 @@
+dep-provider-try_compile
+------------------------
+
+* The :prop_gbl:`PROPAGATE_TOP_LEVEL_INCLUDES_TO_TRY_COMPILE` global property
+ can be used to propagate :variable:`CMAKE_PROJECT_TOP_LEVEL_INCLUDES` into
+ :command:`try_compile` calls that use the
+ :ref:`whole-project signature <Try Compiling Whole Projects>`.
+ This is primarily intended as a way for dependency providers to be enabled
+ in such :command:`try_compile` calls.
diff --git a/Help/variable/CMAKE_PROJECT_TOP_LEVEL_INCLUDES.rst b/Help/variable/CMAKE_PROJECT_TOP_LEVEL_INCLUDES.rst
index 54f530e..805b7ea 100644
--- a/Help/variable/CMAKE_PROJECT_TOP_LEVEL_INCLUDES.rst
+++ b/Help/variable/CMAKE_PROJECT_TOP_LEVEL_INCLUDES.rst
@@ -25,7 +25,10 @@ details (use :variable:`CMAKE_TOOLCHAIN_FILE` for that).
By default, this variable is empty. It is intended to be set by the user.
-See also the :variable:`CMAKE_PROJECT_INCLUDE`,
-:variable:`CMAKE_PROJECT_INCLUDE_BEFORE`,
-:variable:`CMAKE_PROJECT_<PROJECT-NAME>_INCLUDE`, and
-:variable:`CMAKE_PROJECT_<PROJECT-NAME>_INCLUDE_BEFORE` variables.
+See also:
+
+* :variable:`CMAKE_PROJECT_INCLUDE`
+* :variable:`CMAKE_PROJECT_INCLUDE_BEFORE`
+* :variable:`CMAKE_PROJECT_<PROJECT-NAME>_INCLUDE`
+* :variable:`CMAKE_PROJECT_<PROJECT-NAME>_INCLUDE_BEFORE`
+* :prop_gbl:`PROPAGATE_TOP_LEVEL_INCLUDES_TO_TRY_COMPILE`
diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake
index 813ac3c..ed9a7a5 100644
--- a/Modules/CPack.cmake
+++ b/Modules/CPack.cmake
@@ -478,27 +478,30 @@ The following variables are for advanced uses of CPack:
.. versionadded:: 3.25
Specify the ``readelf`` executable path used by CPack.
- The default value will be ``CMAKE_READELF`` when set. Otherwise,
- the default value will be empty and CPack will use :command:`find_program`
- to determine the ``readelf`` path when needed.
+ The default value will be taken from the ``CMAKE_READELF`` variable, if set,
+ which may be populated by an internal CMake module. If ``CMAKE_READELF``
+ is not set, CPack will use :command:`find_program` to determine the
+ ``readelf`` path when needed.
.. variable:: CPACK_OBJCOPY_EXECUTABLE
.. versionadded:: 3.25
Specify the ``objcopy`` executable path used by CPack.
- The default value will be ``CMAKE_OBJCOPY`` when set. Otherwise,
- the default value will be empty and CPack will use :command:`find_program`
- to determine the ``objcopy`` path when needed.
+ The default value will be taken from the ``CMAKE_OBJCOPY`` variable, if set,
+ which may be populated by an internal CMake module. If ``CMAKE_OBJCOPY``
+ is not set, CPack will use :command:`find_program` to determine the
+ ``objcopy`` path when needed.
.. variable:: CPACK_OBJDUMP_EXECUTABLE
.. versionadded:: 3.25
Specify the ``objdump`` executable path used by CPack.
- The default value will be ``CMAKE_OBJDUMP`` when set. Otherwise,
- the default value will be empty and CPack will use :command:`find_program`
- to determine the ``objdump`` path when needed.
+ The default value will be taken from the ``CMAKE_OBJDUMP`` variable, if set,
+ which may be populated by an internal CMake module. If ``CMAKE_OBJDUMP``
+ is not set, CPack will use :command:`find_program` to determine the
+ ``objdump`` path when needed.
#]=======================================================================]
diff --git a/Modules/ExternalProject/mkdirs.cmake.in b/Modules/ExternalProject/mkdirs.cmake.in
index bb835cf..03676a2 100644
--- a/Modules/ExternalProject/mkdirs.cmake.in
+++ b/Modules/ExternalProject/mkdirs.cmake.in
@@ -3,8 +3,13 @@
cmake_minimum_required(VERSION 3.5)
+# If CMAKE_DISABLE_SOURCE_CHANGES is set to true and the source directory is an
+# existing directory in our source tree, calling file(MAKE_DIRECTORY) on it
+# would cause a fatal error, even though it would be a no-op.
+if(NOT EXISTS "@source_dir@")
+ file(MAKE_DIRECTORY "@source_dir@")
+endif()
file(MAKE_DIRECTORY
- "@source_dir@"
"@binary_dir@"
"@install_dir@"
"@tmp_dir@"
diff --git a/Modules/FetchContent.cmake b/Modules/FetchContent.cmake
index 28541ed..01c9877 100644
--- a/Modules/FetchContent.cmake
+++ b/Modules/FetchContent.cmake
@@ -1657,8 +1657,13 @@ function(__FetchContent_populateDirect)
set(_EP_TMP_DIR "${FETCHCONTENT_BASE_DIR}/${contentNameLower}-tmp")
set(_EP_DOWNLOAD_DIR "${_EP_TMP_DIR}")
+ # If CMAKE_DISABLE_SOURCE_CHANGES is set to true and _EP_SOURCE_DIR is an
+ # existing directory in our source tree, calling file(MAKE_DIRECTORY) on it
+ # would cause a fatal error, even though it would be a no-op.
+ if(NOT EXISTS "${_EP_SOURCE_DIR}")
+ file(MAKE_DIRECTORY "${_EP_SOURCE_DIR}")
+ endif()
file(MAKE_DIRECTORY
- "${_EP_SOURCE_DIR}"
"${_EP_BINARY_DIR}"
"${_EP_STAMP_DIR}"
"${_EP_TMP_DIR}"
diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake
index e35697e..aa322ac 100644
--- a/Modules/FindMPI.cmake
+++ b/Modules/FindMPI.cmake
@@ -283,6 +283,9 @@ set(_MPI_Fortran_GENERIC_COMPILER_NAMES mpif95 mpif95_r mpf95 mpf95_r
set(_MPI_Fujitsu_C_COMPILER_NAMES mpifccpx mpifcc)
set(_MPI_Fujitsu_CXX_COMPILER_NAMES mpiFCCpx mpiFCC)
set(_MPI_Fujitsu_Fortran_COMPILER_NAMES mpifrtpx mpifrt)
+set(_MPI_FujitsuClang_C_COMPILER_NAMES mpifccpx mpifcc)
+set(_MPI_FujitsuClang_CXX_COMPILER_NAMES mpiFCCpx mpiFCC)
+set(_MPI_FujitsuClang_Fortran_COMPILER_NAMES mpifrtpx mpifrt)
# GNU compiler names
set(_MPI_GNU_C_COMPILER_NAMES mpigcc mpgcc mpigcc_r mpgcc_r)
diff --git a/Modules/Internal/CPack/CPackDeb.cmake b/Modules/Internal/CPack/CPackDeb.cmake
index 5a78e3f..d4a47e4 100644
--- a/Modules/Internal/CPack/CPackDeb.cmake
+++ b/Modules/Internal/CPack/CPackDeb.cmake
@@ -56,6 +56,65 @@ function(extract_so_info shared_object libname version)
endif()
endfunction()
+#extract RUNPATH and RPATH for given shared object or executable
+function(extract_runpath_and_rpath shared_object_or_executable runpath rpath)
+ if(CPACK_READELF_EXECUTABLE)
+ execute_process(COMMAND "${CPACK_READELF_EXECUTABLE}" -d "${shared_object_or_executable}"
+ WORKING_DIRECTORY "${CPACK_TEMPORARY_DIRECTORY}"
+ RESULT_VARIABLE result
+ OUTPUT_VARIABLE output
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ if(result EQUAL 0)
+ string(REGEX MATCH "\\(?RUNPATH\\)?[^\n]*\\[([^\n]+)\\]" found_runpath "${output}")
+ string(REPLACE ":" ";" found_runpath "${CMAKE_MATCH_1}")
+ list(REMOVE_DUPLICATES found_runpath)
+ string(REGEX MATCH "\\(?RPATH\\)?[^\n]*\\[([^\n]+)\\]" found_rpath "${output}")
+ string(REPLACE ":" ";" found_rpath "${CMAKE_MATCH_1}")
+ list(REMOVE_DUPLICATES found_rpath)
+ set(${runpath} "${found_runpath}" PARENT_SCOPE)
+ set(${rpath} "${found_rpath}" PARENT_SCOPE)
+ else()
+ message(WARNING "Error running readelf for \"${shared_object_or_executable}\"")
+ endif()
+ else()
+ message(FATAL_ERROR "Readelf utility is not available.")
+ endif()
+endfunction()
+
+#sanitizes the given directory name if required
+function(get_sanitized_dirname dirname outvar)
+ # NOTE: This pattern has to stay in sync with the 'prohibited_chars' variable
+ # defined in the C++ function `CPackGenerator::GetSanitizedDirOrFileName`!
+ set(prohibited_chars_pattern "[<]|[>]|[\"]|[/]|[\\]|[|]|[?]|[*]|[`]")
+ if("${dirname}" MATCHES "${prohibited_chars_pattern}")
+ string(MD5 santized_dirname "${dirname}")
+ set(${outvar} "${sanitized_dirname}" PARENT_SCOPE)
+ else()
+ set(${outvar} "${dirname}" PARENT_SCOPE)
+ endif()
+endfunction()
+
+#retrieve packaging directories of components the current component depends on
+# Note: May only be called from within 'cpack_deb_prepare_package_var'!
+function(get_packaging_dirs_of_dependencies outvar)
+ if(CPACK_DEB_PACKAGE_COMPONENT)
+ if(NOT DEFINED WDIR OR NOT DEFINED _local_component_name)
+ message(FATAL_ERROR "CPackDeb: Function '${CMAKE_CURRENT_FUNCTION}' not called from correct function scope!")
+ endif()
+ set(result_list)
+ foreach(dependency_name IN LISTS CPACK_COMPONENT_${_local_component_name}_DEPENDS)
+ get_sanitized_dirname("${dependency_name}" dependency_name)
+ cmake_path(APPEND_STRING WDIR "/../${dependency_name}" OUTPUT_VARIABLE dependency_packaging_dir)
+ cmake_path(NORMAL_PATH dependency_packaging_dir)
+ list(APPEND result_list "${dependency_packaging_dir}")
+ endforeach()
+ set(${outvar} "${result_list}" PARENT_SCOPE) # Set return variable.
+ else()
+ set(${outvar} "" PARENT_SCOPE) # Clear return variable.
+ endif()
+endfunction()
+
function(cpack_deb_check_description SUMMARY LINES RESULT_VARIABLE)
set(_result TRUE)
@@ -310,16 +369,44 @@ function(cpack_deb_prepare_package_vars)
set(IGNORE_MISSING_INFO_FLAG "--ignore-missing-info")
endif()
- if(CPACK_DEBIAN_PACKAGE_SHLIBDEPS_PRIVATE_DIRS)
+ # Add -l option if the tool supports it?
+ if(DEFINED SHLIBDEPS_EXECUTABLE_VERSION AND SHLIBDEPS_EXECUTABLE_VERSION VERSION_GREATER_EQUAL 1.17.0)
unset(PRIVATE_SEARCH_DIR_OPTIONS)
- # Add -l option if the tool supports it
- if(DEFINED SHLIBDEPS_EXECUTABLE_VERSION AND SHLIBDEPS_EXECUTABLE_VERSION VERSION_GREATER_EQUAL 1.17.0)
- foreach(dir IN LISTS CPACK_DEBIAN_PACKAGE_SHLIBDEPS_PRIVATE_DIRS)
- list(APPEND PRIVATE_SEARCH_DIR_OPTIONS "-l${dir}")
+
+ # Use directories provided via CPACK_DEBIAN_PACKAGE_SHLIBDEPS_PRIVATE_DIRS
+ if(NOT "${CPACK_DEBIAN_PACKAGE_SHLIBDEPS_PRIVATE_DIRS}" STREQUAL "")
+ foreach(path IN LISTS CPACK_DEBIAN_PACKAGE_SHLIBDEPS_PRIVATE_DIRS)
+ cmake_path(NORMAL_PATH path) # Required for dpkg-shlibdeps!
+ list(APPEND PRIVATE_SEARCH_DIR_OPTIONS "-l${path}")
endforeach()
- else()
- message(WARNING "CPackDeb: dkpg-shlibdeps is too old. \"CPACK_DEBIAN_PACKAGE_SHLIBDEPS_PRIVATE_DIRS\" is therefore ignored.")
endif()
+
+ # Use directories extracted from RUNPATH/RPATH
+ get_packaging_dirs_of_dependencies(deps_packaging_dirs)
+ foreach(exe IN LISTS CPACK_DEB_BINARY_FILES)
+ cmake_path(GET exe PARENT_PATH exe_dir)
+ extract_runpath_and_rpath(${exe} runpath rpath)
+ # If RUNPATH is available, RPATH will be ignored. Therefore we have to do the same here!
+ if (NOT "${runpath}" STREQUAL "")
+ set(selected_rpath "${runpath}")
+ else()
+ set(selected_rpath "${rpath}")
+ endif()
+ foreach(search_path IN LISTS selected_rpath)
+ if ("${search_path}" MATCHES "^[$]ORIGIN" OR "${search_path}" MATCHES "^[$][{]ORIGIN[}]")
+ foreach(deps_pkgdir IN LISTS deps_packaging_dirs)
+ string(REPLACE "\$ORIGIN" "${deps_pkgdir}/${exe_dir}" path "${search_path}")
+ string(REPLACE "\${ORIGIN}" "${deps_pkgdir}/${exe_dir}" path "${path}")
+ cmake_path(NORMAL_PATH path) # Required for dpkg-shlibdeps!
+ list(APPEND PRIVATE_SEARCH_DIR_OPTIONS "-l${path}")
+ endforeach()
+ endif()
+ endforeach()
+ endforeach()
+
+ list(REMOVE_DUPLICATES PRIVATE_SEARCH_DIR_OPTIONS)
+ elseif(NOT "${CPACK_DEBIAN_PACKAGE_SHLIBDEPS_PRIVATE_DIRS}" STREQUAL "")
+ message(WARNING "CPackDeb: dkpg-shlibdeps is too old. \"CPACK_DEBIAN_PACKAGE_SHLIBDEPS_PRIVATE_DIRS\" is therefore ignored.")
endif()
# Execute dpkg-shlibdeps
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index e4f26ca..58a33eb 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,7 +1,7 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 29)
-set(CMake_VERSION_PATCH 20240530)
+set(CMake_VERSION_PATCH 20240603)
#set(CMake_VERSION_RC 0)
set(CMake_VERSION_IS_DIRTY 0)
diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt
index e6e41ec..e4b53fd 100644
--- a/Source/QtDialog/CMakeLists.txt
+++ b/Source/QtDialog/CMakeLists.txt
@@ -48,6 +48,11 @@ if(WIN32)
endif()
endif()
+if(MSVC)
+ # QTBUG-118993: Qt uses deprecated stdext::checked_array_iterator
+ add_compile_definitions(_SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING)
+endif()
+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt${INSTALLED_QT_VERSION}Widgets_EXECUTABLE_COMPILE_FLAGS}")
if(CMake_QT_STATIC_QXcbIntegrationPlugin_LIBRARIES)
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index 6d3e01c..4d739ff 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -1240,6 +1240,17 @@ cm::optional<cmTryCompileResult> cmCoreTryCompile::TryCompileCode(
}
}
+ if (!this->SrcFileSignature &&
+ this->Makefile->GetState()->GetGlobalPropertyAsBool(
+ "PROPAGATE_TOP_LEVEL_INCLUDES_TO_TRY_COMPILE")) {
+ const std::string var = "CMAKE_PROJECT_TOP_LEVEL_INCLUDES";
+ if (cmValue val = this->Makefile->GetDefinition(var)) {
+ std::string flag = cmStrCat("-D", var, "=\'", *val, '\'');
+ arguments.CMakeFlags.emplace_back(std::move(flag));
+ cmakeVariables.emplace(var, *val);
+ }
+ }
+
if (this->Makefile->GetState()->UseGhsMultiIDE()) {
// Forward the GHS variables to the inner project cache.
for (std::string const& var : ghs_platform_vars) {
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 0369051..77f740b 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -73,6 +73,11 @@ namespace {
bool HandleWriteImpl(std::vector<std::string> const& args, bool append,
cmExecutionStatus& status)
{
+ if (args.size() < 2) {
+ status.SetError(cmStrCat(
+ args[0], " must be called with at least one additional argument."));
+ return false;
+ }
auto i = args.begin();
i++; // Get rid of subcommand
@@ -658,8 +663,11 @@ bool HandleStringsCommand(std::vector<std::string> const& args,
bool HandleGlobImpl(std::vector<std::string> const& args, bool recurse,
cmExecutionStatus& status)
{
- // File commands has at least one argument
- assert(args.size() > 1);
+ if (args.size() < 2) {
+ status.SetError(cmStrCat(
+ args[0], " must be called with at least one additional argument."));
+ return false;
+ }
auto i = args.begin();
@@ -869,8 +877,8 @@ bool HandleGlobRecurseCommand(std::vector<std::string> const& args,
bool HandleMakeDirectoryCommand(std::vector<std::string> const& args,
cmExecutionStatus& status)
{
- // File command has at least one argument
- assert(args.size() > 1);
+ // Projects might pass a dynamically generated list of directories, and it
+ // could be an empty list. We should not assume there is at least one.
std::string expr;
for (std::string const& arg :
@@ -903,8 +911,8 @@ bool HandleMakeDirectoryCommand(std::vector<std::string> const& args,
bool HandleTouchImpl(std::vector<std::string> const& args, bool create,
cmExecutionStatus& status)
{
- // File command has at least one argument
- assert(args.size() > 1);
+ // Projects might pass a dynamically generated list of files, and it
+ // could be an empty list. We should not assume there is at least one.
for (std::string const& arg :
cmMakeRange(args).advance(1)) // Get rid of subcommand
@@ -3918,8 +3926,9 @@ bool HandleChmodRecurseCommand(std::vector<std::string> const& args,
bool cmFileCommand(std::vector<std::string> const& args,
cmExecutionStatus& status)
{
- if (args.size() < 2) {
- status.SetError("must be called with at least two arguments.");
+ if (args.empty()) {
+ status.SetError(
+ "given no arguments, but it requires at least a sub-command.");
return false;
}
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index 11018a6..6356616 100644
--- a/Source/kwsys/SystemTools.cxx
+++ b/Source/kwsys/SystemTools.cxx
@@ -1356,6 +1356,75 @@ bool SystemTools::DeleteRegistryValue(const std::string&, KeyWOW64)
}
#endif
+#ifdef _WIN32
+SystemTools::WindowsFileId::WindowsFileId(unsigned long volumeSerialNumber,
+ unsigned long fileIndexHigh,
+ unsigned long fileIndexLow)
+ : m_volumeSerialNumber(volumeSerialNumber)
+ , m_fileIndexHigh(fileIndexHigh)
+ , m_fileIndexLow(fileIndexLow)
+{
+}
+
+bool SystemTools::WindowsFileId::operator==(const WindowsFileId& o) const
+{
+ return (m_volumeSerialNumber == o.m_volumeSerialNumber &&
+ m_fileIndexHigh == o.m_fileIndexHigh &&
+ m_fileIndexLow == o.m_fileIndexLow);
+}
+
+bool SystemTools::WindowsFileId::operator!=(const WindowsFileId& o) const
+{
+ return !(*this == o);
+}
+#else
+SystemTools::UnixFileId::UnixFileId(dev_t volumeSerialNumber,
+ ino_t fileSerialNumber, off_t fileSize)
+ : m_volumeSerialNumber(volumeSerialNumber)
+ , m_fileSerialNumber(fileSerialNumber)
+ , m_fileSize(fileSize)
+{
+}
+
+bool SystemTools::UnixFileId::operator==(const UnixFileId& o) const
+{
+ return (m_volumeSerialNumber == o.m_volumeSerialNumber &&
+ m_fileSerialNumber == o.m_fileSerialNumber &&
+ m_fileSize == o.m_fileSize);
+}
+
+bool SystemTools::UnixFileId::operator!=(const UnixFileId& o) const
+{
+ return !(*this == o);
+}
+#endif
+
+bool SystemTools::GetFileId(const std::string& file, FileId& id)
+{
+#ifdef _WIN32
+ HANDLE hFile =
+ CreateFileW(Encoding::ToWide(file).c_str(), GENERIC_READ, FILE_SHARE_READ,
+ nullptr, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, nullptr);
+ if (hFile != INVALID_HANDLE_VALUE) {
+ BY_HANDLE_FILE_INFORMATION fiBuf;
+ GetFileInformationByHandle(hFile, &fiBuf);
+ CloseHandle(hFile);
+ id = FileId(fiBuf.dwVolumeSerialNumber, fiBuf.nFileIndexHigh,
+ fiBuf.nFileIndexLow);
+ return true;
+ } else {
+ return false;
+ }
+#else
+ struct stat fileStat;
+ if (stat(file.c_str(), &fileStat) == 0) {
+ id = FileId(fileStat.st_dev, fileStat.st_ino, fileStat.st_size);
+ return true;
+ }
+ return false;
+#endif
+}
+
bool SystemTools::SameFile(const std::string& file1, const std::string& file2)
{
#ifdef _WIN32
diff --git a/Source/kwsys/SystemTools.hxx.in b/Source/kwsys/SystemTools.hxx.in
index 729928e..294ffca 100644
--- a/Source/kwsys/SystemTools.hxx.in
+++ b/Source/kwsys/SystemTools.hxx.in
@@ -617,6 +617,52 @@ public:
std::string const& destination);
/**
+ * Object encapsulating a unique identifier for a file
+ * or directory
+ */
+#ifdef _WIN32
+ class WindowsFileId
+ {
+ public:
+ WindowsFileId() = default;
+ WindowsFileId(unsigned long volumeSerialNumber,
+ unsigned long fileIndexHigh, unsigned long fileIndexLow);
+
+ bool operator==(const WindowsFileId& o) const;
+ bool operator!=(const WindowsFileId& o) const;
+
+ private:
+ unsigned long m_volumeSerialNumber;
+ unsigned long m_fileIndexHigh;
+ unsigned long m_fileIndexLow;
+ };
+ using FileId = WindowsFileId;
+#else
+ class UnixFileId
+ {
+ public:
+ UnixFileId() = default;
+ UnixFileId(dev_t volumeSerialNumber, ino_t fileSerialNumber,
+ off_t fileSize);
+
+ bool operator==(const UnixFileId& o) const;
+ bool operator!=(const UnixFileId& o) const;
+
+ private:
+ dev_t m_volumeSerialNumber;
+ ino_t m_fileSerialNumber;
+ off_t m_fileSize;
+ };
+ using FileId = UnixFileId;
+#endif
+
+ /**
+ * Outputs a FileId for the given file or directory.
+ * Returns true on success, false on failure
+ */
+ static bool GetFileId(const std::string& file, FileId& id);
+
+ /**
* Return true if the two files are the same file
*/
static bool SameFile(const std::string& file1, const std::string& file2);
diff --git a/Tests/BuildDepends/CMakeLists.txt b/Tests/BuildDepends/CMakeLists.txt
index 99418df..2fa2bc5 100644
--- a/Tests/BuildDepends/CMakeLists.txt
+++ b/Tests/BuildDepends/CMakeLists.txt
@@ -12,6 +12,15 @@ project(BuildDepends)
# project is built.
set(CMAKE_SUPPRESS_REGENERATION 1)
+if(CMAKE_GENERATOR MATCHES "Visual Studio" AND CMAKE_VS_PLATFORM_TOOLSET MATCHES "^(v90|v100|v110|v120|v140)$")
+ # These toolsets update 'link_depends_no_shared_lib.lib' during rebuild in Release mode.
+ set(config Debug)
+else()
+ # Some toolsets update 'link_depends_no_shared_lib.pdb' during rebuild in Debug mode.
+ set(config Release)
+endif()
+set(CMAKE_TRY_COMPILE_CONFIGURATION "${config}")
+
# Xcode needs some help with the fancy dependencies in this test.
if(XCODE AND XCODE_VERSION VERSION_LESS 5)
set(HELP_XCODE 1)
@@ -117,10 +126,10 @@ endif()
# find and save the ninjadep executable
set(ninjadep ${BuildDepends_BINARY_DIR}/Project/ninjadep${CMAKE_EXECUTABLE_SUFFIX})
if(EXISTS
- "${BuildDepends_BINARY_DIR}/Project/Debug/ninjadep${CMAKE_EXECUTABLE_SUFFIX}" )
- message("found debug")
+ "${BuildDepends_BINARY_DIR}/Project/${config}/ninjadep${CMAKE_EXECUTABLE_SUFFIX}" )
+ message("found ${config}/ninjadep${CMAKE_EXECUTABLE_SUFFIX}")
set(ninjadep
- "${BuildDepends_BINARY_DIR}/Project/Debug/ninjadep${CMAKE_EXECUTABLE_SUFFIX}")
+ "${BuildDepends_BINARY_DIR}/Project/${config}/ninjadep${CMAKE_EXECUTABLE_SUFFIX}")
endif()
message("Running ${ninjadep} ")
execute_process(COMMAND ${ninjadep} OUTPUT_VARIABLE out RESULT_VARIABLE runResult)
@@ -136,17 +145,17 @@ endif()
set(bar ${BuildDepends_BINARY_DIR}/Project/bar${CMAKE_EXECUTABLE_SUFFIX})
if(EXISTS
- "${BuildDepends_BINARY_DIR}/Project/Debug/bar${CMAKE_EXECUTABLE_SUFFIX}" )
- message("found debug")
+ "${BuildDepends_BINARY_DIR}/Project/${config}/bar${CMAKE_EXECUTABLE_SUFFIX}" )
+ message("found ${config}/bar${CMAKE_EXECUTABLE_SUFFIX}")
set(bar
- "${BuildDepends_BINARY_DIR}/Project/Debug/bar${CMAKE_EXECUTABLE_SUFFIX}")
+ "${BuildDepends_BINARY_DIR}/Project/${config}/bar${CMAKE_EXECUTABLE_SUFFIX}")
endif()
set(zot ${BuildDepends_BINARY_DIR}/Project/zot${CMAKE_EXECUTABLE_SUFFIX})
if(EXISTS
- "${BuildDepends_BINARY_DIR}/Project/Debug/zot${CMAKE_EXECUTABLE_SUFFIX}" )
- message("found debug")
+ "${BuildDepends_BINARY_DIR}/Project/${config}/zot${CMAKE_EXECUTABLE_SUFFIX}" )
+ message("found ${config}/zot${CMAKE_EXECUTABLE_SUFFIX}")
set(zot
- "${BuildDepends_BINARY_DIR}/Project/Debug/zot${CMAKE_EXECUTABLE_SUFFIX}")
+ "${BuildDepends_BINARY_DIR}/Project/${config}/zot${CMAKE_EXECUTABLE_SUFFIX}")
endif()
message("Running ${bar} ")
@@ -305,12 +314,12 @@ if(NOT RESULT)
message(SEND_ERROR "Could not build test project (2)!")
endif()
if(EXISTS
- "${BuildDepends_BINARY_DIR}/Project/Debug/bar${CMAKE_EXECUTABLE_SUFFIX}" )
- message("found debug")
+ "${BuildDepends_BINARY_DIR}/Project/${config}/bar${CMAKE_EXECUTABLE_SUFFIX}" )
+ message("found ${config}/bar${CMAKE_EXECUTABLE_SUFFIX}")
endif()
if(EXISTS
- "${BuildDepends_BINARY_DIR}/Project/Debug/zot${CMAKE_EXECUTABLE_SUFFIX}" )
- message("found debug")
+ "${BuildDepends_BINARY_DIR}/Project/${config}/zot${CMAKE_EXECUTABLE_SUFFIX}" )
+ message("found ${config}/zot${CMAKE_EXECUTABLE_SUFFIX}")
endif()
message("Running ${ninjadep} ")
diff --git a/Tests/CMakeGUI/CMakeLists.txt b/Tests/CMakeGUI/CMakeLists.txt
index 4e8609b..c9f44e9 100644
--- a/Tests/CMakeGUI/CMakeLists.txt
+++ b/Tests/CMakeGUI/CMakeLists.txt
@@ -2,6 +2,11 @@ include(CMakeParseArguments)
find_package(Qt5Test REQUIRED)
+if(MSVC)
+ # QTBUG-118993: Qt uses deprecated stdext::checked_array_iterator
+ add_compile_definitions(_SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING)
+endif()
+
include_directories(
${CMake_SOURCE_DIR}/Source
${CMake_SOURCE_DIR}/Source/QtDialog
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 51e60fe..4048bfe 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -1199,13 +1199,17 @@ if(BUILD_TESTING)
else()
unset(SHLIBDEPS_EXECUTABLE_VERSION)
endif()
+ # Check if distro has symbols or shlibs data
+ file(GLOB SHLIBS_FILES_EXIST "/var/lib/dpkg/info/*.shlibs" "/var/lib/dpkg/info/*.symbols")
if(NOT SHLIBDEPS_EXECUTABLE_VERSION VERSION_LESS 1.19 OR
(NOT SHLIBDEPS_EXECUTABLE_VERSION VERSION_LESS 1.17 AND NOT CMAKE_BINARY_DIR MATCHES ".*[ ].*"))
list(APPEND DEB_CONFIGURATIONS_TO_TEST "shlibdeps-with-private-lib-failure"
- "shlibdeps-with-private-lib-success")
+ "shlibdeps-with-private-lib-success"
+ "shlibdeps-with-ORIGIN-RPATH-failure")
+ if(SHLIBS_FILES_EXIST)
+ list(APPEND DEB_CONFIGURATIONS_TO_TEST "shlibdeps-with-ORIGIN-RPATH-success")
+ endif()
endif()
- # Check if distro has symbols or shlibs data
- file(GLOB SHLIBS_FILES_EXIST "/var/lib/dpkg/info/*.shlibs" "/var/lib/dpkg/info/*.symbols")
if(SHLIBS_FILES_EXIST)
list(APPEND DEB_CONFIGURATIONS_TO_TEST "components-depend2")
endif()
diff --git a/Tests/CMakeTests/FileTest.cmake.in b/Tests/CMakeTests/FileTest.cmake.in
index 71cb3db..7b76700 100644
--- a/Tests/CMakeTests/FileTest.cmake.in
+++ b/Tests/CMakeTests/FileTest.cmake.in
@@ -13,13 +13,13 @@ set(Copy-NoDest-STDERR "given no DESTINATION")
set(Copy-NoFile-RESULT 1)
set(Copy-NoFile-STDERR "COPY cannot find.*/does_not_exist\\.txt")
set(Glob-NoArg-RESULT 1)
-set(Glob-NoArg-STDERR "file must be called with at least two arguments")
+set(Glob-NoArg-STDERR "file GLOB must be called with at least one additional argument\\.")
set(Make_Directory-NoArg-RESULT 1)
set(Make-Directory-NoArg-STDERR "file must be called with at least two arguments")
set(MD5-NoFile-RESULT 1)
set(MD5-NoFile-STDERR "file MD5 failed to read file")
set(MD5-BadArg1-RESULT 1)
-set(MD5-BadArg1-STDERR "file must be called with at least two arguments")
+set(MD5-BadArg1-STDERR "file MD5 requires a file name and output variable")
set(MD5-BadArg2-RESULT 1)
set(MD5-BadArg2-STDERR "file MD5 requires a file name and output variable")
set(MD5-BadArg4-RESULT 1)
diff --git a/Tests/CPackComponentsDEB/CMakeLists.txt b/Tests/CPackComponentsDEB/CMakeLists.txt
index b2e2106..a3eb337 100644
--- a/Tests/CPackComponentsDEB/CMakeLists.txt
+++ b/Tests/CPackComponentsDEB/CMakeLists.txt
@@ -5,6 +5,10 @@
# which supports CPack components.
cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
+# Make sure to properly escape RPATH/RUNPATH entries.
+if (POLICY CMP0095)
+ cmake_policy(SET CMP0095 NEW)
+endif()
project(CPackComponentsDEB VERSION 1.0.3)
# Use GNUInstallDirs in order to enforce lib64 if needed
@@ -29,6 +33,14 @@ if (CPackDEBConfiguration MATCHES "shlibdeps-with-private-lib")
target_link_libraries(mylibapp3 myprivatelib)
endif()
+if (CPackDEBConfiguration MATCHES "shlibdeps-with-ORIGIN-RPATH")
+ add_subdirectory("subdir")
+ add_executable(mylibapp4 mylibapp.cpp)
+ target_compile_definitions(mylibapp4 PRIVATE -DSHLIBDEPS_OTHER)
+ target_link_libraries(mylibapp4 PUBLIC myotherlib)
+ set_target_properties(mylibapp4 PROPERTIES INSTALL_RPATH "\${ORIGIN};$ORIGIN/../lib")
+endif()
+
# Create installation targets. Note that we put each kind of file
# into a different component via COMPONENT. These components will
# be used to create the installation components.
@@ -39,17 +51,28 @@ install(TARGETS mylib
install(TARGETS mylibapp
RUNTIME
- DESTINATION bin
+ DESTINATION ${CMAKE_INSTALL_BINDIR}
COMPONENT applications)
install(FILES mylib.h
- DESTINATION include
- COMPONENT headers)
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ COMPONENT headers)
if (CPackDEBConfiguration MATCHES "shlibdeps-with-private-lib")
install(TARGETS mylibapp3
RUNTIME
- DESTINATION bin
+ DESTINATION ${CMAKE_INSTALL_BINDIR}
+ COMPONENT applications)
+endif()
+
+if (CPackDEBConfiguration MATCHES "shlibdeps-with-ORIGIN-RPATH")
+ install(TARGETS myotherlib
+ LIBRARY
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ COMPONENT libraries)
+ install(TARGETS mylibapp4
+ RUNTIME
+ DESTINATION ${CMAKE_INSTALL_BINDIR}
COMPONENT applications)
endif()
diff --git a/Tests/CPackComponentsDEB/MyLibCPackConfig-shlibdeps-with-ORIGIN-RPATH-failure.cmake.in b/Tests/CPackComponentsDEB/MyLibCPackConfig-shlibdeps-with-ORIGIN-RPATH-failure.cmake.in
new file mode 100644
index 0000000..0794fbd
--- /dev/null
+++ b/Tests/CPackComponentsDEB/MyLibCPackConfig-shlibdeps-with-ORIGIN-RPATH-failure.cmake.in
@@ -0,0 +1,23 @@
+#
+# Activate component packaging
+#
+
+if(CPACK_GENERATOR MATCHES "DEB")
+ set(CPACK_DEB_COMPONENT_INSTALL "ON")
+ set(CPACK_DEBIAN_ENABLE_COMPONENT_DEPENDS "ON")
+endif()
+
+#
+# Choose grouping way
+#
+#set(CPACK_COMPONENTS_ALL_GROUPS_IN_ONE_PACKAGE)
+#set(CPACK_COMPONENTS_GROUPING)
+set(CPACK_COMPONENTS_IGNORE_GROUPS 1)
+#set(CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE 1)
+
+# we set shlibdeps to on
+set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
+
+# setting dependencies
+# Note: We explicitly do NOT declare dependency to "libraries" component!
+#set(CPACK_COMPONENT_APPLICATIONS_DEPENDS "libraries")
diff --git a/Tests/CPackComponentsDEB/MyLibCPackConfig-shlibdeps-with-ORIGIN-RPATH-success.cmake.in b/Tests/CPackComponentsDEB/MyLibCPackConfig-shlibdeps-with-ORIGIN-RPATH-success.cmake.in
new file mode 100644
index 0000000..81d6c7b
--- /dev/null
+++ b/Tests/CPackComponentsDEB/MyLibCPackConfig-shlibdeps-with-ORIGIN-RPATH-success.cmake.in
@@ -0,0 +1,22 @@
+#
+# Activate component packaging
+#
+
+if(CPACK_GENERATOR MATCHES "DEB")
+ set(CPACK_DEB_COMPONENT_INSTALL "ON")
+ set(CPACK_DEBIAN_ENABLE_COMPONENT_DEPENDS "ON")
+endif()
+
+#
+# Choose grouping way
+#
+#set(CPACK_COMPONENTS_ALL_GROUPS_IN_ONE_PACKAGE)
+#set(CPACK_COMPONENTS_GROUPING)
+set(CPACK_COMPONENTS_IGNORE_GROUPS 1)
+#set(CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE 1)
+
+# we set shlibdeps to on
+set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
+
+# setting dependencies
+set(CPACK_COMPONENT_APPLICATIONS_DEPENDS "libraries")
diff --git a/Tests/CPackComponentsDEB/RunCPackVerifyResult-shlibdeps-with-ORIGIN-RPATH-failure.cmake b/Tests/CPackComponentsDEB/RunCPackVerifyResult-shlibdeps-with-ORIGIN-RPATH-failure.cmake
new file mode 100644
index 0000000..dddcb4a
--- /dev/null
+++ b/Tests/CPackComponentsDEB/RunCPackVerifyResult-shlibdeps-with-ORIGIN-RPATH-failure.cmake
@@ -0,0 +1,19 @@
+if(NOT CPackComponentsDEB_SOURCE_DIR)
+ message(FATAL_ERROR "CPackComponentsDEB_SOURCE_DIR not set")
+endif()
+
+include(${CPackComponentsDEB_SOURCE_DIR}/RunCPackVerifyResult.cmake)
+
+
+set(actual_output)
+run_cpack(actual_output
+ CPack_output
+ CPack_error
+ EXPECT_FAILURE
+ CONFIG_ARGS ${config_args}
+ CONFIG_VERBOSE ${config_verbose})
+
+string(REGEX MATCH "dpkg-shlibdeps: error: (cannot|couldn't) find[ \n\t]+library[ \n\t]+libmyotherlib.so.1[ \n\t]+needed[ \n\t]+by[ \n\t]+./usr/bin/mylibapp4" expected_error ${CPack_error})
+if(NOT expected_error)
+ message(FATAL_ERROR "Did not get the expected error-message!")
+endif()
diff --git a/Tests/CPackComponentsDEB/RunCPackVerifyResult-shlibdeps-with-ORIGIN-RPATH-success.cmake b/Tests/CPackComponentsDEB/RunCPackVerifyResult-shlibdeps-with-ORIGIN-RPATH-success.cmake
new file mode 100644
index 0000000..6eff3db
--- /dev/null
+++ b/Tests/CPackComponentsDEB/RunCPackVerifyResult-shlibdeps-with-ORIGIN-RPATH-success.cmake
@@ -0,0 +1,75 @@
+if(NOT CPackComponentsDEB_SOURCE_DIR)
+ message(FATAL_ERROR "CPackComponentsDEB_SOURCE_DIR not set")
+endif()
+
+include(${CPackComponentsDEB_SOURCE_DIR}/RunCPackVerifyResult.cmake)
+
+
+
+# requirements
+
+# debian now produces lower case names
+set(expected_file_mask "${CPackComponentsDEB_BINARY_DIR}/mylib-*_1.0.3_*.deb")
+set(expected_count 3)
+
+
+set(actual_output)
+run_cpack(actual_output
+ CPack_output
+ CPack_error
+ EXPECTED_FILE_MASK "${expected_file_mask}"
+ CONFIG_ARGS ${config_args}
+ CONFIG_VERBOSE ${config_verbose})
+
+message(STATUS "expected_count='${expected_count}'")
+message(STATUS "expected_file_mask='${expected_file_mask}'")
+message(STATUS "actual_output_files='${actual_output}'")
+
+if(NOT actual_output)
+ message(FATAL_ERROR "error: expected_files do not exist: CPackComponentsDEB test fails. (CPack_output=${CPack_output}, CPack_error=${CPack_error}")
+endif()
+
+list(LENGTH actual_output actual_count)
+message(STATUS "actual_count='${actual_count}'")
+if(NOT actual_count EQUAL expected_count)
+ message(FATAL_ERROR "error: expected_count=${expected_count} does not match actual_count=${actual_count}: CPackComponents test fails. (CPack_output=${CPack_output}, CPack_error=${CPack_error})")
+endif()
+
+
+# dpkg-deb checks for the summary of the packages
+find_program(DPKGDEB_EXECUTABLE dpkg-deb)
+if(DPKGDEB_EXECUTABLE)
+ set(dpkgdeb_output_errors_all "")
+ foreach(_f IN LISTS actual_output)
+
+ # extracts the metadata from the package
+ run_dpkgdeb(dpkg_output
+ FILENAME ${_f}
+ )
+
+ dpkgdeb_return_specific_metaentry(dpkg_package_name
+ DPKGDEB_OUTPUT "${dpkg_output}"
+ METAENTRY "Package:")
+
+ message(STATUS "package='${dpkg_package_name}'")
+
+ if(dpkg_package_name STREQUAL "mylib-applications")
+ # pass
+ elseif(dpkg_package_name STREQUAL "mylib-headers")
+ # pass
+ elseif(dpkg_package_name STREQUAL "mylib-libraries")
+ # pass
+ else()
+ set(dpkgdeb_output_errors_all ${dpkgdeb_output_errors_all}
+ "dpkg-deb: ${_f}: component name not found: ${dpkg_package_name}\n")
+ endif()
+
+ endforeach()
+
+
+ if(NOT dpkgdeb_output_errors_all STREQUAL "")
+ message(FATAL_ERROR "dpkg-deb checks failed:\n${dpkgdeb_output_errors_all}")
+ endif()
+else()
+ message("dpkg-deb executable not found - skipping dpkg-deb test")
+endif()
diff --git a/Tests/CPackComponentsDEB/mylibapp.cpp b/Tests/CPackComponentsDEB/mylibapp.cpp
index bb45831..6d63803 100644
--- a/Tests/CPackComponentsDEB/mylibapp.cpp
+++ b/Tests/CPackComponentsDEB/mylibapp.cpp
@@ -1,13 +1,13 @@
-#ifndef SHLIBDEPS_PRIVATE
+#if defined SHLIBDEPS_OTHER
-# include "mylib.h"
+# include "subdir/myotherlib.h"
int main()
{
- mylib_function();
+ myotherlib_function();
}
-#else
+#elif defined SHLIBDEPS_PRIVATE
# include "shlibdeps-with-private-lib/myprivatelib.h"
@@ -16,4 +16,13 @@ int main()
myprivatelib_function();
}
+#else
+
+# include "mylib.h"
+
+int main()
+{
+ mylib_function();
+}
+
#endif
diff --git a/Tests/CPackComponentsDEB/subdir/CMakeLists.txt b/Tests/CPackComponentsDEB/subdir/CMakeLists.txt
new file mode 100644
index 0000000..71b3fdd
--- /dev/null
+++ b/Tests/CPackComponentsDEB/subdir/CMakeLists.txt
@@ -0,0 +1,5 @@
+add_library(myotherlib SHARED myotherlib.cpp)
+set_target_properties( myotherlib PROPERTIES
+ VERSION 1.2.3
+ SOVERSION 1
+)
diff --git a/Tests/CPackComponentsDEB/subdir/myotherlib.cpp b/Tests/CPackComponentsDEB/subdir/myotherlib.cpp
new file mode 100644
index 0000000..eec270c
--- /dev/null
+++ b/Tests/CPackComponentsDEB/subdir/myotherlib.cpp
@@ -0,0 +1,8 @@
+#include "myotherlib.h"
+
+#include "stdio.h"
+
+void myotherlib_function()
+{
+ printf("This is myotherlib");
+}
diff --git a/Tests/CPackComponentsDEB/subdir/myotherlib.h b/Tests/CPackComponentsDEB/subdir/myotherlib.h
new file mode 100644
index 0000000..71848a0
--- /dev/null
+++ b/Tests/CPackComponentsDEB/subdir/myotherlib.h
@@ -0,0 +1 @@
+void myotherlib_function();
diff --git a/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake b/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake
index 44c6f74..3c7cd68 100644
--- a/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake
+++ b/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake
@@ -21,6 +21,7 @@ run_cmake(TLSVersionBadEnv)
run_cmake(NoOptions)
run_cmake(SourceEmpty)
run_cmake(SourceMissing)
+run_cmake(SourceDirExisting)
run_cmake(CMAKE_CACHE_ARGS)
run_cmake(CMAKE_CACHE_DEFAULT_ARGS)
run_cmake(CMAKE_CACHE_mix)
diff --git a/Tests/RunCMake/ExternalProject/SourceDirExisting.cmake b/Tests/RunCMake/ExternalProject/SourceDirExisting.cmake
new file mode 100644
index 0000000..761bb8e
--- /dev/null
+++ b/Tests/RunCMake/ExternalProject/SourceDirExisting.cmake
@@ -0,0 +1,16 @@
+# We're providing a pre-existing source directory. Make sure we don't trigger
+# an error if the undocumented but used-in-the-wild CMAKE_DISABLE_SOURCE_CHANGES
+# variable is set.
+set(CMAKE_DISABLE_SOURCE_CHANGES TRUE)
+
+include(ExternalProject)
+
+ExternalProject_Add(source_dir_existing
+ SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/Foo"
+ DOWNLOAD_COMMAND "${CMAKE_COMMAND}" -E echo "Download command executed"
+ UPDATE_COMMAND ""
+ CONFIGURE_COMMAND ""
+ BUILD_COMMAND ""
+ TEST_COMMAND ""
+ INSTALL_COMMAND ""
+)
diff --git a/Tests/RunCMake/FetchContent/DisableSourceChanges.cmake b/Tests/RunCMake/FetchContent/DisableSourceChanges.cmake
new file mode 100644
index 0000000..a144005
--- /dev/null
+++ b/Tests/RunCMake/FetchContent/DisableSourceChanges.cmake
@@ -0,0 +1,18 @@
+cmake_policy(SET CMP0168 NEW)
+
+# Undocumented variable used to catch attempts to write to anywhere under the
+# source directory that isn't under the build directory. In order for this
+# code path to be checked for direct population mode, we need a non-empty
+# download, update, or patch command so that the population code path is used.
+# Custom commands might not write to the source directory and instead just
+# print messages or other non-modifying tasks, like is done here.
+set(CMAKE_DISABLE_SOURCE_CHANGES TRUE)
+
+include(FetchContent)
+
+FetchContent_Declare(
+ WithProject
+ SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/WithProject # This exists
+ DOWNLOAD_COMMAND ${CMAKE_COMMAND} -E echo "Download command executed"
+)
+FetchContent_MakeAvailable(WithProject)
diff --git a/Tests/RunCMake/FetchContent/RunCMakeTest.cmake b/Tests/RunCMake/FetchContent/RunCMakeTest.cmake
index 72a458c..d0ec638 100644
--- a/Tests/RunCMake/FetchContent/RunCMakeTest.cmake
+++ b/Tests/RunCMake/FetchContent/RunCMakeTest.cmake
@@ -106,3 +106,5 @@ run_cmake_command(ScriptMode-direct
-DCMP0168=NEW
-P ${CMAKE_CURRENT_LIST_DIR}/ScriptMode.cmake
)
+
+run_cmake(DisableSourceChanges)
diff --git a/Tests/RunCMake/file/LOCK-error-no-path-stderr.txt b/Tests/RunCMake/file/LOCK-error-no-path-stderr.txt
index 2247aa6..6d70016 100644
--- a/Tests/RunCMake/file/LOCK-error-no-path-stderr.txt
+++ b/Tests/RunCMake/file/LOCK-error-no-path-stderr.txt
@@ -1,4 +1,4 @@
CMake Error at LOCK-error-no-path.cmake:[0-9]+ \(file\):
- file must be called with at least two arguments.
+ sub-command LOCK requires at least two arguments\.
Call Stack \(most recent call first\):
CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/file/TOUCH-result.txt b/Tests/RunCMake/file/TOUCH-result.txt
deleted file mode 100644
index d00491f..0000000
--- a/Tests/RunCMake/file/TOUCH-result.txt
+++ /dev/null
@@ -1 +0,0 @@
-1
diff --git a/Tests/RunCMake/file/TOUCH-stderr.txt b/Tests/RunCMake/file/TOUCH-stderr.txt
deleted file mode 100644
index 9f31676..0000000
--- a/Tests/RunCMake/file/TOUCH-stderr.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-^CMake Error at TOUCH\.cmake:[0-9]+ \(file\):
- file must be called with at least two arguments\.
-Call Stack \(most recent call first\):
- CMakeLists\.txt:[0-9]+ \(include\)
-+
-CMake Error at TOUCH\.cmake:[0-9]+ \(file\):
- file must be called with at least two arguments\.
-Call Stack \(most recent call first\):
- CMakeLists\.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/file/TOUCH.cmake b/Tests/RunCMake/file/TOUCH.cmake
index 8931eb5..c92a962 100644
--- a/Tests/RunCMake/file/TOUCH.cmake
+++ b/Tests/RunCMake/file/TOUCH.cmake
@@ -12,5 +12,6 @@ if(NOT EXISTS "${file}")
endif()
file(REMOVE "${file}")
+# Empty arguments used to be an error, but this is valid since CMake 3.30
file(TOUCH)
file(TOUCH_NOCREATE)
diff --git a/Tests/RunCMake/try_compile/RunCMakeTest.cmake b/Tests/RunCMake/try_compile/RunCMakeTest.cmake
index 229c102..124034a 100644
--- a/Tests/RunCMake/try_compile/RunCMakeTest.cmake
+++ b/Tests/RunCMake/try_compile/RunCMakeTest.cmake
@@ -16,6 +16,7 @@ run_cmake_with_options(Inspect
include("${RunCMake_BINARY_DIR}/Inspect-build/info.cmake")
run_cmake(ConfigureLog)
+run_cmake(TopIncludes)
run_cmake(NoArgs)
run_cmake(OneArg)
run_cmake(TwoArgs)
diff --git a/Tests/RunCMake/try_compile/TopIncludes-config.txt b/Tests/RunCMake/try_compile/TopIncludes-config.txt
new file mode 100644
index 0000000..6bd9c90
--- /dev/null
+++ b/Tests/RunCMake/try_compile/TopIncludes-config.txt
@@ -0,0 +1,85 @@
+^
+---
+events:(
+ -
+ kind: "message-v1"
+ backtrace:(
+ - "[^"]+")+
+ message: \|(
++ [^
+]*)*)+
+ -
+ kind: "try_compile-v1"
+ backtrace:
+ - "[^"]*/Modules/CMakeDetermineCompilerABI.cmake:[0-9]+ \(try_compile\)"
+ - "[^"]*/Modules/CMakeTestCCompiler.cmake:[0-9]+ \(CMAKE_DETERMINE_COMPILER_ABI\)"
+ - "TopIncludes.cmake:[0-9]+ \(enable_language\)"
+ - "CMakeLists.txt:[0-9]+ \(include\)"
+ checks:
+ - "Detecting C compiler ABI info"
+ directories:
+ source: "[^"]*/Tests/RunCMake/try_compile/TopIncludes-build/CMakeFiles/CMakeScratch/TryCompile-[^/"]+"
+ binary: "[^"]*/Tests/RunCMake/try_compile/TopIncludes-build/CMakeFiles/CMakeScratch/TryCompile-[^/"]+"
+ cmakeVariables:(
+ CMAKE_[^
+]*)+
+ buildResult:
+ variable: "CMAKE_C_ABI_COMPILED"
+ cached: true
+ stdout: \|.*
+ exitCode: 0(
+ -
+ kind: "message-v1"
+ backtrace:(
+ - "[^"]+")+
+ message: \|(
++ [^
+]*)*)*
+ -
+ kind: "try_compile-v1"
+ backtrace:
+ - "TopIncludes.cmake:[0-9]+ \(try_compile\)"
+ - "CMakeLists.txt:[0-9]+ \(include\)"
+ description: "Project without property set\."
+ directories:
+ source: "[^"]*/Tests/RunCMake/try_compile/proj"
+ binary: "[^"]*/Tests/RunCMake/try_compile/TopIncludes-build/CMakeFiles/CMakeScratch/TryCompile-[^/"]+"
+ buildResult:
+ variable: "result"
+ cached: true
+ stdout: \|.*
+ exitCode: 0
+ -
+ kind: "try_compile-v1"
+ backtrace:
+ - "TopIncludes.cmake:[0-9]+ \(try_compile\)"
+ - "CMakeLists.txt:[0-9]+ \(include\)"
+ description: "Project with property set\."
+ directories:
+ source: "[^"]*/Tests/RunCMake/try_compile/proj"
+ binary: "[^"]*/Tests/RunCMake/try_compile/TopIncludes-build/CMakeFiles/CMakeScratch/TryCompile-[^/"]+"
+ cmakeVariables:
+ CMAKE_PROJECT_TOP_LEVEL_INCLUDES: "[^"]*/Tests/RunCMake/try_compile/include_pass1.cmake;[^"]*/Tests/RunCMake/try_compile/include_pass2.cmake"
+ buildResult:
+ variable: "result"
+ cached: true
+ stdout: \|.*
+ exitCode: 0
+ -
+ kind: "try_compile-v1"
+ backtrace:
+ - "TopIncludes.cmake:[0-9]+ \(try_compile\)"
+ - "CMakeLists.txt:[0-9]+ \(include\)"
+ description: "Source file with property set\."
+ directories:
+ source: "[^"]*/Tests/RunCMake/try_compile/TopIncludes-build/CMakeFiles/CMakeScratch/TryCompile-[^/"]+"
+ binary: "[^"]*/Tests/RunCMake/try_compile/TopIncludes-build/CMakeFiles/CMakeScratch/TryCompile-[^/"]+"
+ cmakeVariables:(
+ CMAKE_[^
+]*)+
+ buildResult:
+ variable: "result"
+ cached: true
+ stdout: \|.*
+ exitCode: 0
+\.\.\.$
diff --git a/Tests/RunCMake/try_compile/TopIncludes.cmake b/Tests/RunCMake/try_compile/TopIncludes.cmake
new file mode 100644
index 0000000..2a70cc7
--- /dev/null
+++ b/Tests/RunCMake/try_compile/TopIncludes.cmake
@@ -0,0 +1,34 @@
+enable_language(C)
+
+# Normally CMAKE_PROJECT_TOP_LEVEL_INCLUDES must be set before the first
+# project() call. We don't care about the variable's usual effects here, we
+# only care whether the variable is propagated to try_compile() project calls.
+set(CMAKE_PROJECT_TOP_LEVEL_INCLUDES
+ ${CMAKE_CURRENT_LIST_DIR}/include_error.cmake
+)
+
+try_compile(result
+ PROJECT TestProject
+ SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/proj
+ LOG_DESCRIPTION "Project without property set."
+)
+
+set_property(GLOBAL PROPERTY PROPAGATE_TOP_LEVEL_INCLUDES_TO_TRY_COMPILE YES)
+set(CMAKE_PROJECT_TOP_LEVEL_INCLUDES
+ ${CMAKE_CURRENT_LIST_DIR}/include_pass1.cmake
+ ${CMAKE_CURRENT_LIST_DIR}/include_pass2.cmake
+)
+try_compile(result
+ PROJECT TestProject
+ SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/proj
+ LOG_DESCRIPTION "Project with property set."
+)
+
+# Confirm the property only affects whole project signature
+set(CMAKE_PROJECT_TOP_LEVEL_INCLUDES
+ ${CMAKE_CURRENT_LIST_DIR}/include_error.cmake
+)
+try_compile(result
+ SOURCES ${CMAKE_CURRENT_LIST_DIR}/src.c
+ LOG_DESCRIPTION "Source file with property set."
+)
diff --git a/Tests/RunCMake/try_compile/include_error.cmake b/Tests/RunCMake/try_compile/include_error.cmake
new file mode 100644
index 0000000..7c73ab6
--- /dev/null
+++ b/Tests/RunCMake/try_compile/include_error.cmake
@@ -0,0 +1 @@
+message(FATAL_ERROR "Unexpectedly read top level include file")
diff --git a/Tests/RunCMake/try_compile/include_pass1.cmake b/Tests/RunCMake/try_compile/include_pass1.cmake
new file mode 100644
index 0000000..e831ca3
--- /dev/null
+++ b/Tests/RunCMake/try_compile/include_pass1.cmake
@@ -0,0 +1 @@
+message(STATUS "Top level include file was read - pass 1")
diff --git a/Tests/RunCMake/try_compile/include_pass2.cmake b/Tests/RunCMake/try_compile/include_pass2.cmake
new file mode 100644
index 0000000..31336aa
--- /dev/null
+++ b/Tests/RunCMake/try_compile/include_pass2.cmake
@@ -0,0 +1 @@
+message(STATUS "Top level include file was read - pass 2")
diff --git a/Tests/RunCMake/try_compile/proj/CMakeLists.txt b/Tests/RunCMake/try_compile/proj/CMakeLists.txt
index 652f5b6..09feca4 100644
--- a/Tests/RunCMake/try_compile/proj/CMakeLists.txt
+++ b/Tests/RunCMake/try_compile/proj/CMakeLists.txt
@@ -1,2 +1,2 @@
-cmake_minimum_required(VERSION 3.3)
+cmake_minimum_required(VERSION 3.5)
project(TestProject NONE)