5607 Commits

Author SHA1 Message Date
Craig Scott
fa07ddfebf project: Only check non-cache vars when setting project vars
The change in commit 86ad7cc886 (project: Only define non-cache vars if
already defined, 2024-09-15, v3.30.4~2^2) was meant to only check for
non-cache variables when deciding whether to set non-cache project
variables for the current call.  However, it erroneously checked for any
variable, including cache variables.  This gives the intended result on
the first run, but on subsequent runs a cache variable will exist that
did not on the first run, leading to different behavior between the two
runs.  Fix the logic to only check for a pre-existing non-cache
variable, as was originally intended.

Fixes: #26355
2024-10-07 10:24:37 -04:00
Craig Scott
86ad7cc886 project: Only define non-cache vars if already defined
In c1ece78d11 (project: non cache <project> prefix variables are
also created, 2024-08-27), we started explicitly setting the non-cache
variable for <projectName>_SOURCE_DIR, <projectName>_BINARY_DIR,
and <projectName>_IS_TOP_LEVEL in addition to setting them as
cache variables. This changed the behavior when a project name
was used more than once, and the second project call happens in
the same scope or a child scope of the first. Previously, the first
project call would set cache variables, and the second project call
would not overwrite those cache variables. With the change in
c1ece78d11, after the second project call the non-cache variables
would mask the cache variables and the project code would see
a different value to what it did before.

Setting the non-cache variable was added to handle the case where
a call to FetchContent_MakeAvailable() would set some non-cache
variables, and it just so happened those matched the same cache
variables that the project() command would set in the project being
fetched. The fetched project would then see a different set of
project-specific variables compared to when it was built standalone.

This commit here narrows the change from c1ece78d11 such that
the non-cache variable is only set by project() if there was already
a non-cache variable set. This still fixes the motivating problem
c1ece78d11 was intended to solve, but it avoids changing the variable
values seen by a project that re-uses the same project name in related scopes.

Issue: #26243, #25714
Fixes: #26281
2024-09-20 10:33:25 -04:00
Robert Maynard
c1ece78d11 project: non cache <project> prefix variables are also created
Fixes #26243, #25714
2024-08-27 12:37:07 -04:00
Brad King
35e908e0dc Merge topic 'swift-install-names' into release-3.30
8669176576 Swift: Fix INSTALL_NAME_DIR under CMP0157 NEW behavior

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !9692
2024-08-02 09:47:50 -04:00
Evan Wilde
8669176576 Swift: Fix INSTALL_NAME_DIR under CMP0157 NEW behavior
Setting `CMAKE_INSTALL_NAME_DIR` or the `INSTALL_NAME_DIR` on Swift
targets had no effect when CMP0157 was set to `NEW`.  This was a result
of missing the `<TARGET_INSTALLNAME_DIR>` before the `<TARGET_SONAME>`.
Fix that and add a test to verify that the install name directory is
included in the install name.

Fixes: #26175
2024-08-01 10:49:36 -04:00
Brad King
cdca6814a5 Merge topic 'backport-test-curl-output' into release-3.30
13fb20f4d3 Tests/RunCMake/file-DOWNLOAD: Update bad host name message for curl 8.9

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9690
2024-07-29 11:28:46 -04:00
Brad King
5f38057728 Merge topic 'backport-test-curl-output' into release-3.29
13fb20f4d3 Tests/RunCMake/file-DOWNLOAD: Update bad host name message for curl 8.9

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9690
2024-07-29 11:12:33 -04:00
Brad King
13fb20f4d3 Tests/RunCMake/file-DOWNLOAD: Update bad host name message for curl 8.9 2024-07-29 11:07:05 -04:00
Brad King
74beb6dba8 Xcode: Restore support for CMAKE_OSX_ARCHITECTURES=$(ARCHS_STANDARD)
Skip the `CMAKE_OSX_ARCHITECTURES` validation added by commit db409e5e68
(APPLE: Check if compilers respect CMAKE_OSX_ARCHITECTURES, 2024-05-04,
v3.30.0-rc1~15^2) if the value contains a placeholder, since we do not
know the real value.

Fixes: #26128
2024-07-19 09:42:45 -04:00
Kyle Edwards
b9e2f6828f Merge topic 'TRANSITIVE_LINK_PROPERTIES_isnt_usage' into release-3.30
2fc9e482a9 Evaluation of TRANSITIVE_LINK_PROPERTIES isn't considered a usage

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !9643
2024-07-08 10:04:22 -04:00
Robert Maynard
2fc9e482a9 Evaluation of TRANSITIVE_LINK_PROPERTIES isn't considered a usage
Fixes #26108
2024-07-05 13:16:47 -04:00
Brad King
fe8dc3012e Tests: Fix RunCMake.ExternalProject when git is not available
Move Git-dependent test cases added by commit 2ef3bd9186
(ExternalProject: Add TLS version options for https connections,
2024-02-26, v3.30.0-rc1~471^2) into the block of cases that run only
when Git is found.

Fixes: #26104
2024-07-03 10:44:15 -04:00
Brad King
c3046ea289 Merge topic 'link-feature-attributes-stabilization' into release-3.30
576567f028 Link feature attributes: stabilization
5617c34c31 Libraries processing: update configuration wording

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9607
2024-06-24 09:22:47 -04:00
Brad King
b1a804d616 Ninja Multi-Config: Fix crash if config list is changed in subdirectory
Look up the value of `CMAKE_CONFIGURATION_TYPES` only in the top level
directory.

Fixes: #26064
2024-06-21 12:21:36 -04:00
Marc Chevrier
576567f028 Link feature attributes: stabilization
* enhance OVERRIDE handling
* Update wording
2024-06-21 11:18:20 +02:00
Marc Chevrier
5617c34c31 Libraries processing: update configuration wording 2024-06-21 11:18:12 +02:00
Brad King
b243c19986 Tests: Update expected results for Xcode 16
In `Tests/RunCMake/LinkerSelection`, Xcode 16 warns when building the
AppleClassic case:

    ld: warning: -ld_classic is deprecated and will be removed
                 in a future release

Tolerate all build warnings.
2024-06-13 09:16:34 -04:00
Craig Scott
9299cbbdb4 FetchContent: Force cmake --fresh to re-execute direct population steps
Issue: #25468
2024-06-07 18:12:12 +10:00
Craig Scott
e82e2c38c1 Tests: RunCMake.FetchContent should not always force _deps removal
To properly test some functionality, tests may rely on not clearing
things like time stamps between cmake invocations. The RunCMake
infrastructure clears the build directory by default anyway, and
tests may individually ask for that to be disabled where needed.

The line being removed here was originally added to assist with
manually re-running individual tests locally outside the control of
RunCMake. That is no longer appropriate.
2024-06-07 17:58:55 +10:00
Craig Scott
f97b25ec4b Tests: Fix -direct variants of FetchContent tests using wrong files
The -direct variants of the RunCMake.FetchContent tests were
meant to be using the same result, stdout and stderr files as the
non-direct tests. The -direct tests were specified in the wrong way
for that and ended up using no files at all, so they weren't testing
the full set of expected conditions. Use the test variant feature
provided by the RunCMake infrastructure instead, which is the
proper way to handle this sort of scenario.
2024-06-07 17:58:55 +10:00
Brad King
57c6dd277e Merge topic 'cpack-nuget-dependency-groups'
0f4d3664a9 CPack/NuGet: Build dependencies in groups

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9544
2024-06-04 08:59:28 -04:00
Alex Opie
0f4d3664a9 CPack/NuGet: Build dependencies in groups
This allows particular frameworks to be targeted by
particular dependencies, and for empty dependency
groups to satisfy NuGet's framework-matching
requirements.
2024-06-03 11:28:49 -04:00
Brad King
1df18d5e54 Merge topic 'cmake-C-crash'
7330121467 Fix crash in target-specific commands called from initial cache script

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9571
2024-06-03 09:10:52 -04:00
Brad King
d1cf2a2206 Merge topic 'file-accept-empty-lists'
7c516f7e28 file(): TOUCH, TOUCH_NOCREATE and MAKE_DIRECTORY accept empty lists

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !9570
2024-06-03 09:08:52 -04:00
Brad King
640a167d03 Merge topic 'ep-disable-source-changes'
0cc1b550dd ExternalProject,FetchContent: Avoid CMAKE_DISABLE_SOURCE_CHANGES error

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !9569
2024-06-03 09:07:46 -04:00
Brad King
7330121467 Fix crash in target-specific commands called from initial cache script
Fixes: #26018
2024-06-01 06:28:26 -04:00
Brad King
e0a11dfa24 Merge topic 'dep-provider-try_compile'
4cb5bb014d try_compile: Propagating top level includes into whole-project calls

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Robert Maynard <robertjmaynard@gmail.com>
Merge-request: !9532
2024-05-31 09:20:27 -04:00
Craig Scott
7c516f7e28 file(): TOUCH, TOUCH_NOCREATE and MAKE_DIRECTORY accept empty lists
Projects may be generating a list of files or directories to pass as arguments
to file(TOUCH), file(TOUCH_NOCREATE), or file(MAKE_DIRECTORY). Those
lists might end up being empty, so rather than requiring at least one item,
allow an empty list.

Fixes: #24897
2024-05-31 22:55:20 +10:00
Craig Scott
0cc1b550dd ExternalProject,FetchContent: Avoid CMAKE_DISABLE_SOURCE_CHANGES error
The file(MAKE_DIRECTORY) implementation checks whether a path is
allowed to be written to before it checks if it already exists. For the
scenario where a SOURCE_DIR is an existing directory within the main
project's source directory, this triggers a fatal error if
CMAKE_DISABLE_SOURCE_CHANGES is set to true for ExternalProject,
and some FetchContent scenarios. Therefore, add an explicit check for
existence first to avoid making such error-triggering calls.

Fixes: #21872
2024-05-31 18:01:27 +10:00
Brad King
679a3d9e6c Merge topic 'enforce-fc-fully-disconnected-requirements'
f588421b58 FetchContent: Enforce FETCHCONTENT_FULLY_DISCONNECTED requirements

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !9556
2024-05-30 10:13:29 -04:00
Craig Scott
4cb5bb014d try_compile: Propagating top level includes into whole-project calls
Fixes: #24151
2024-05-30 19:01:03 +10:00
Brad King
54c9185b33 Merge topic 'deprecate-fetchcontent_populate'
4370fcf750 FetchContent: Deprecate FetchContent_Populate(depName)
bc70b458ad Help: Minor grammar improvements for FetchContent

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9552
2024-05-29 08:41:57 -04:00
Brad King
ad90d891f8 Merge topic 'swift-multi-config'
5bb7f8a4dd Swift: Use per-config module file locations in multi-config generators
b2e042d77a cmGeneratorTarget: Adopt Swift-related methods from the Ninja generator
45b3387c50 Tests/RunCMake/Swift: Enable more cases with Ninja Multi-Config

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9501
2024-05-29 08:34:21 -04:00
Craig Scott
f588421b58 FetchContent: Enforce FETCHCONTENT_FULLY_DISCONNECTED requirements
FETCHCONTENT_FULLY_DISCONNECTED should only be set to true if
each dependency's source directory has already been populated.
Previously, this wasn't being checked, but now it is (subject to a new
policy).
2024-05-29 20:39:17 +10:00
Craig Scott
4370fcf750 FetchContent: Deprecate FetchContent_Populate(depName)
Projects should use FetchContent_MakeAvailable(depName)
instead. Policy CMP0169 provides backward compatibility.
2024-05-29 18:52:24 +10:00
Brad King
374716a47a Merge topic 'execute_process-child-startup-info'
fa8c04b421 Tests/RunCMake/execute_process: Check STARTUPINFOW reserved members
d98df689ab Merge branch 'libuv-win-process-no-extra-stdio'
a590382850 libuv: win/spawn: disable extra-file-descriptor support not needed by CMake

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9541
2024-05-28 08:56:42 -04:00
Craig Scott
2efceb290e FetchContent: Make FetchContent_Populate() honor CMP0168 2024-05-25 19:01:10 +10:00
Dave Abrahams
5bb7f8a4dd Swift: Use per-config module file locations in multi-config generators
Place `.swiftmodule` files a subdirectory named after the configuration.

Fixes: #25864
Fixes: #25997

- Swift/RunCMakeTest.cmake:
  - CMP0157-OLD was enabled for Xcode, where it works.
  - A test was added that verifies .swiftmodule's are generated into
    separate directories with multi-config generators.

- Tests/SwiftOnly/CMakeLists.txt: tests were added that validate that
  cross-subdirectory module dependencies (via target_link_libraries)
  work.
2024-05-24 15:23:41 -07:00
Dave Abrahams
45b3387c50 Tests/RunCMake/Swift: Enable more cases with Ninja Multi-Config
Also factor out testing that's common across Xcode and Ninja.* generators.

- Ninja expected output files were extended to accept directories named
  after the configuration in paths.
- Tests that previously ran with Ninja were allowed to run with Ninja
  Multi-Config.
- Swift/RunCMakeTest.cmake:
  - Checks for conditions where little or no testing could be done
    were moved to the top of the file, with return()s to limit nesting
    of the remainder of the code ("Early bailouts").
  - CMP0157 tests, which were being performed for all generators, were
    factored out into a block at the top of the file.
  - RunCMake_TEST_OPTIONS is set initially for all multi-config
    generators and list(APPEND)'ed-to in each block() where it was previously
    set() and unset().
2024-05-24 13:41:01 -07:00
Brad King
5427884f01 Merge topic 'doc-test-RunCMake'
0dbf2c24bf Tests/RunCMake: Document how to write multi-step test cases
61a08b0856 Tests/RunCMake: Document commands/variables available to RunCMakeTest scripts
aebf6b8b29 Tests/RunCMake: Clarify documentation of platform-specific output matching
c2f8a6729f Tests/RunCMake: Rename "sub-test" terminology to "case"
0add7a802f Tests/RunCMake: Organize README as multiple sections
aff4dc47c4 Tests/RunCMake: Cross-reference README from main Tests/README

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9548
2024-05-24 10:34:57 -04:00
Brad King
7b38a1dee7 Merge topic 'genex-compiler-frontend-variant'
af81b8667e GenEx: Add generator expr. for CMAKE_<LANG>_COMPILER_FRONTEND_VARIANT
8a11a39c51 Help: Use correct programming language names in docs of generator expr.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9538
2024-05-24 10:31:52 -04:00
Brad King
1d519cf796 Merge topic 'ninja-parallel'
0e5250e63c Ninja: Add option for parallel install
daeb8fffa2 Help: Add Builtin Targets section to Ninja help

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9505
2024-05-24 10:29:57 -04:00
Brad King
fa8c04b421 Tests/RunCMake/execute_process: Check STARTUPINFOW reserved members
Verify that `execute_process` launches processes on Windows such that
`GetStartupInfoW` in the child does not populate `STARTUPINFOW` members
reserved for the MSVC C run-time.

Issue: #25996
2024-05-24 10:12:27 -04:00
Brad King
0dbf2c24bf Tests/RunCMake: Document how to write multi-step test cases 2024-05-23 16:11:46 -04:00
Brad King
61a08b0856 Tests/RunCMake: Document commands/variables available to RunCMakeTest scripts 2024-05-23 16:11:40 -04:00
Brad King
aebf6b8b29 Tests/RunCMake: Clarify documentation of platform-specific output matching 2024-05-23 15:51:34 -04:00
Brad King
c2f8a6729f Tests/RunCMake: Rename "sub-test" terminology to "case"
We've long used the latter term in commit messages and comments.
2024-05-23 15:19:36 -04:00
Brad King
0add7a802f Tests/RunCMake: Organize README as multiple sections 2024-05-23 14:38:51 -04:00
Brad King
aff4dc47c4 Tests/RunCMake: Cross-reference README from main Tests/README 2024-05-23 14:36:49 -04:00
Martin Duffy
0e5250e63c Ninja: Add option for parallel install
Adds the global property ``INSTALL_PARALLEL`` to enable a parallel install
target for Ninja.

Fixes: #25459
2024-05-23 09:54:19 -04:00