1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-16 05:26:58 +08:00
Commit Graph

267 Commits

Author SHA1 Message Date
Brad King
e62b6cb748 CMP0000: Remove support for OLD behavior 2025-01-17 09:28:34 -05:00
Brad King
bd176b430c Renumber post-3.31 development from 3.32 to 4.0
Issue: #26613
2025-01-16 09:18:21 -05:00
Alex Turbov
bc8621d999 Fix: A lot of typos in code found by typos
Yet another great code spellchecker: https://github.com/crate-ci/typos/

(Will be added later as a `pre-commit` hook)
2025-01-12 18:49:34 +04:00
Peter Kokot
6a7d5e414d FeatureSummary: Introduce policy CMP0183 for full Condition Syntax
Closes: #26468
2024-11-26 13:19:25 -05:00
Brad King
5c78623143 AIX: Enable shared library archives by default
This is the preferred convention for shared libraries on AIX.
Add policy CMP0182 to provide compatibility.

Closes: #26372
2024-11-23 15:23:25 -05:00
Brad King
ff9bc7291a cmPolicies: Remove now-unused GetRequiredPolicyError method 2024-11-13 11:47:10 -05:00
Brad King
659d8bd430 cmPolicies: Remove now-unused REQUIRED_IF_USED and REQUIRED_ALWAYS states 2024-11-13 11:43:07 -05:00
Brad King
58a90857f0 cmPolicies: Simplify representation of removed policies
A policy that can be set defaults to `WARN` internally.
A policy that has been removed always uses `NEW`.
The `REQUIRED_IF_USED` and `REQUIRED_ALWAYS` states
are not needed.
2024-11-13 11:33:29 -05:00
Brad King
dade821948 cmPolicies: Reduce boilerplate in policy table entries
Remove unnecessary `cmPolicies::` prefix from table entries. It can be
written where the entries are expanded.  This also prevents IWYU from
complaining that the table is written before `cmPolicies::PolicyStatus`
is declared.
2024-11-13 11:27:44 -05:00
Marc Chevrier
35350c419d Add support of "LINKER:" prefix for CMAKE_<TYPE>_LINKER_FLAGS variable
The following variables now support the LINKER: prefix:
* CMAKE_<TYPE>_LINKER_FLAGS
* CMAKE_<TYPE>_LINKER_FLAGS_<CONFIG>

Fixes: #26171
2024-11-04 17:07:58 +01:00
Craig Scott
e5a9ccbcc8 project: Always set <PROJECT-NAME>_* as normal variables
Re-introduce the behavior originally introduced in CMake 3.30.3 by
commit c1ece78d11 (project: non cache <project> prefix variables are
also created, 2024-08-27, v3.30.3~2^2), but this time with a policy for
compatibility.

Issue: #25714
Issue: #26243
2024-10-08 10:07:11 -04:00
Marc Chevrier
cd418d4bb6 Static libraries de-duplication: keep first occurrence
Fixes: #26335
2024-10-02 10:17:08 -04:00
Craig Scott
fc7aa3cd69 tests: Preserve empty arguments in test command lines
This will now preserve empty values in the TEST_LAUNCHER and
CROSSCOMPILING_EMULATOR target properties for tests added by:

- The add_test() command.
- The ExternalData_Add_Test() command from the ExternalData module.
- The gtest_add_tests() or gtest_discover_tests() commands from the
  GoogleTest module.

For the gtest_add_tests() and gtest_discover_tests() commands,
empty elements in the values passed after the EXTRA_ARGS keyword
are also now preserved.

Policy CMP0178 is added to provide backward compatibility with the
old behavior where empty values were silently discarded from the
above cases.

Fixes: #26337
2024-10-02 10:09:11 +10:00
Craig Scott
6a1fac1450 install: Normalize DESTINATION paths
The file generated by install(EXPORT) computes _IMPORT_PREFIX
in a way that assumes a normalized path. If the DESTINATION
contains any ../ components, the computed _IMPORT_PREFIX
would be wrong. Force the DESTINATION path to be normalized,
subject to the new CMP0176 policy.

Also normalize all other DESTINATION paths for consistency,
except for INCLUDES DESTINATION, which is not strictly a
destination but rather a search path to add.

Fixes: #26252
2024-09-19 20:31:47 +10:00
Brad King
e782811cfe execute_process: Change default ENCODING to UTF-8
Windows is heading toward making UTF-8 the preferred MBCS.  As CMake's
internal encoding, `UTF-8` is effectively equivalent to `NONE`, which
was CMake's behavior prior to 3.15's accidental change to `AUTO`.
Behavior of `ENCODING UTF-8` is independent of CMake's internal
encoding, making it in principle a better default than `NONE`.

Add policy CMP0176 for compatibility and to document the default's
history.

Fixes: #26262
2024-09-16 06:37:46 -04:00
Craig Scott
ec519f3e97 add_custom_command: Validate arguments more rigorously
Add a new CMP0175 policy to preserve backward compatibility
for projects that were using unsupported keywords or arguments.

Fixes: #26096, #21089, #18976
2024-09-10 08:19:09 +10:00
Craig Scott
ceeea4e511 cmake_parse_arguments: Set variable if empty string given after keyword
If a single-value keyword is followed by an empty string, the
command unsets the variable for that keyword instead of setting
it to the empty string. This is inconsistent and unexpected. Add
policy CMP0174 which ensures the variable for a single-value
keyword is always set when any value is given, not just for a
non-empty value.

The new CMP0174 policy only affects the PARSE_ARGV form of
cmake_parse_arguments. The older form silently drops all empty
string arguments before processing the argument list.

Fixes: #25972
2024-08-23 09:42:13 +10:00
Craig Scott
dd87640a22 CMakeFindFrameworks: Deprecate the module subject to policy CMP0173
Fixes: #20446
2024-08-16 11:10:27 +10:00
Brad King
d588e81ffb CPack/WIX: Generate perMachine installers by default
Add policy CMP0172 to set `CPACK_WIX_INSTALL_SCOPE` to `perMachine` by
default.  Follow up commit 60661f6770 (CPack/WiX: Make InstallScope
configurable, 2023-11-07, v3.29.0-rc1~413^2) and commit 614100dbf6
(CPack/WiX: Restore default (missing) InstallScope from 3.28 and lower,
2024-06-05, v3.30.0-rc1~7^2~1).

Issue: #20962
Issue: #26029
2024-07-18 14:16:54 -04:00
Juan Ramos
197cb419d1 add_custom_command: Add CODEGEN support
By specifying CODEGEN as an argument to add_custom_command the
custom command will be added to a codegen build target.

The intent is to provide a convenient way for users to get
their generated files without having to build the whole project.

This can be helpful for code analysis tools which can be useful
for IDEs and CI.
2024-07-01 12:02:49 -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
Craig Scott
b2496bf14c FetchContent: Populate directly without a sub-build
Fixes: #21703
2024-05-17 14:23:39 +10:00
Brad King
e0355c4ea9 FindBoost: Add policy to remove this module
Upstream Boost 1.70 and above provide a proper `BoostConfig.cmake`
package configuration file.  Packages for all major distros now
provide it in at least one LTS release.  Add a policy to pretend
that the `FindBoost` module does not exist so that projects calling
`find_package(Boost)` use the upstream package directly.

Closes: #19402
2024-05-03 10:30:23 -04:00
Brad King
ddb9442f48 GenEx: Fix TARGET_PROPERTY evaluation of transitive link properties
In commit bbba701899 (Link properties: must be transitive over private
dependency on static library, 2019-12-06, v3.17.0-rc1~323^2) and
commit af9d4f24ae (Link properties: must be transitive over private
dependency on static library, 2019-12-11, v3.17.0-rc1~305^2) we
neglected to implement CMP0099 NEW behavior for `TARGET_PROPERTY`
evaluation.  Add policy CMP0166 to fix this.
2024-04-29 17:40:03 -04:00
Brad King
7d3d728a72 Help: Clarify CMP0099 documentation and summary text 2024-04-29 17:40:03 -04:00
Craig Scott
9b61a7147d Help: CMP0135 applies to FetchContent as well
This updates the CMP0135 documentation, which should have been
done as part of c2044fdf3f (FetchContent: Respect the CMP0135 policy
setting, 2022-06-02).

Issue: #23560
2024-04-27 11:01:45 +10:00
Craig Scott
97464aa970 enable_language(): Fail if called before project()
Fixes: #25550
2024-04-02 23:00:38 +11:00
Asit Dhal
a61c9afdf8 add_library: Reject shared libraries on platforms that do not support them
Add policy CMP0164 to provide compatibility.

Fixes: #25759
2024-03-29 11:06:32 -04:00
Deniz Bahadir
071f0d6f98 CMP0163: Make GENERATED source file property globally visible
This was originally attempted by policy CMP0118, but its
implementation did not cover all intended use cases.  We fixed its
documentation in commit 1dabbbb5e0 (CMP0118: Revise documentation to
describe actual behavior, 2024-03-20).

Add new policy CMP0163 to cover the remaining use cases.  In particular,
make the `GENERATED` property visible to `get_property` calls in other
directories.  In order to capture the original intention of CMP0118,
define CMP0163's NEW behavior to also imply CMP0118's NEW behavior.

Fixes: #25437
Fixes: #25058
2024-03-29 08:54:11 -04:00
Deniz Bahadir
1dabbbb5e0 CMP0118: Revise documentation to describe actual behavior
The policy was originally intended to make the `GENERATED` source file
property globally visible, but the implementation didn't fully achieve
that goal.  Revise the documentation to describe what it actually does.

Issue: #25437
2024-03-21 11:37:46 -04:00
Brad King
721d8b192a VS: Add UseDebugLibraries to vcxproj files by default
Use heuristics to select a reasonable value.  Add policy CMP0162
to provide compatibility with existing projects.

Fixes: #25327
2024-02-22 08:43:16 -05:00
Craig Scott
339ae33e55 CPack: Change CPACK_PRODUCTBUILD_DOMAINS default to true (CMP0161)
Fixes: #23351
2024-01-28 21:09:12 +11:00
Robert Maynard
0cfd8fe8ad cmTarget: Don't allow setting read-only properties
Ensure that all documented read-only target properties now produce
errors when trying to set.
2024-01-23 08:50:38 -05:00
Cristian Le
fa00928bcd file: STRINGS + REGEX store match results
Signed-off-by: Cristian Le <cristian.le@mpsd.mpg.de>
2024-01-09 16:36:55 -05:00
Robert Maynard
63e20653f8 add_test: Fix version of CMake introducing CMP0158 (to 3.29)
This was missed in commit ca5a300d7f (add_test: Honor
CROSSCOMPILING_EMULATOR only when cross-compiling, 2023-11-02) when it
slipped from the 3.28 release.
2024-01-05 17:01:01 -05:00
Ralf Habacker
ca5a300d7f add_test: Honor CROSSCOMPILING_EMULATOR only when cross-compiling
Add policy CMP0158 to provide compatibility for existing projects.

Fixes: #23672
2023-12-19 10:00:55 -05:00
Evan Wilde
c1d787e473 Swift: Add abstraction for compilation mode
Add a `CMAKE_Swift_COMPILATION_MODE` variable and corresponding
`Swift_COMPILATION_MODE` target property to control the compilation
mode.  Select among `wholemodule`, `singlefile`, and `incremental`.

Add policy CMP0157 to remove the default `-wmo` flags in favor of the
abstract setting.

Issue: #25366
2023-11-17 08:43:21 -05:00
Marc Chevrier
7b99c42e57 Link step: Enable to configure deduplication of libraries
Some platforms, Apple or Windows for instance, do not require to duplicate
static libraries to resolve mutual dependencies. Moreover, Xcode version 15
emits a warning if a library is duplicated.
On Windows, enable a better control of libraries order.

Fixes: #20722, #25297
2023-11-09 19:20:40 +01:00
Ben Boeckel
889aa0354a CMP0155: ignore scanning for sources if no scanner is available
This allows for a more graceful transition for projects using C++20
without scanner support (e.g., Clang 15 or GCC 13). While newer
compilers will (needlessly) scan, it allows C++20-using projects to use
older compilers without having to set `CMAKE_CXX_SCAN_FOR_MODULES` to
support newer CMake minimum versions.

Fixes: #25357
2023-11-01 09:52:08 -04:00
Ben Boeckel
437280b127 cxxmodules: scan C++ sources for imports by default
Existing projects are not using C++ modules in their sources,
so introduce policy CMP0155 to enable scanning by default.
2023-10-02 10:17:31 -04:00
Martin Duffy
ec2ba29ac5 Ninja: Allow compilation before generation of dependencies' private sources
This requires knowing when a generated header is public, which we can
model using file sets.  Add policy CMP0154 to treat generated sources
as private by default in targets with file sets.  Generated public
headers can be specified in public file sets.

Fixes: #24959
Issue: #15555
2023-09-20 10:25:24 -04:00
Kyle Edwards
ff12a57d5e exec_program(): Remove by policy CMP0153 2023-07-25 11:09:56 -04:00
Robert Maynard
6b5f2dbbfe file(REAL_PATH): resolve symlinks before '..' components
Previously REAL_PATH would collapse paths before resolving any symlinks
so if `..` crossed a symlink the output from `REAL_PATH` would be wrong.

It looked like REAL_PATH did this by mistake since it was a side-effect
of ensuring we had an absolute path before resolving symlinks.
2023-07-20 17:02:58 -04:00
Orkun Tokdemir
7bf4e30090 Autogen: Default AUTOGEN_USE_SYSTEM_INCLUDE to ON if it is not set
Add policy CMP0151 to preserve the old behavior by default.
2023-05-03 09:03:46 -04:00
Chris Wright
550f63447d ExternalProject/FetchContent: Support relative remote URLs
Teach `ExternalProject_Add` and `FetchContent_Declare` to resolve
relative remote URLs provided via `GIT_REPOSITORY`.  Add policy
CMP0150 to maintain compatibility.

Fixes: #24211
Co-Authored-By: Craig Scott <craig.scott@crascit.com>
2023-04-26 16:30:36 +08:00
Brad King
f90c8ab54e VS: Select latest available Windows SDK version by default
Add policy `CMP0149` to stop preferring SDKs exactly matching
`CMAKE_SYSTEM_VERSION` over the latest SDK.

Fixes: #16202
2023-04-05 12:06:22 -04:00
Brad King
a4c5b91f80 FindPython{Interp,Libs}: Add policy to remove these modules
The `FindPythonInterp` and `FindPythonLibs` modules have been deprecated
since CMake 3.12.  Add a policy to pretend they do not exist in order to
encourage projects to port to `FindPython` or `FindPython{2,3}`.
2023-03-30 12:05:09 -04:00
Brad King
d6353e74b4 VS: Add policy to build custom commands concurrently
In commit 33c15ae2b9 (VS: Build custom commands concurrently when
possible, 2023-01-19, v3.26.0-rc1~56^2) we added `BuildInParallel` to
custom commands in `.vcxproj` files, but that had to be reverted by
commit abb1c12162 (VS: Revert "Build custom commands concurrently when
possible", 2023-03-07, v3.26.0-rc6~3^2) because some projects may have
custom commands that accidentally rely on serial execution in MSBuild.

Add a policy to use `BuildInParallel` for custom commands in projects
that have been updated to set the policy to `NEW`.

Fixes: #18405
2023-03-12 07:51:58 -04:00
Brad King
2c146a7fc5 FindCUDA: Add policy to remove this module
The `FindCUDA` module has been deprecated since CMake 3.10.
Add a policy to pretend it doesn't exist in order to encourage
projects to port away from it.
2023-03-09 07:39:36 -05:00