summaryrefslogtreecommitdiffstats
path: root/Source/cmPolicies.h
Commit message (Collapse)AuthorAgeFilesLines
* project: Always set <PROJECT-NAME>_* as normal variablesCraig Scott2024-10-081-1/+4
| | | | | | | | | | 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
* Static libraries de-duplication: keep first occurrenceMarc Chevrier2024-10-021-2/+7
| | | | Fixes: #26335
* tests: Preserve empty arguments in test command linesCraig Scott2024-10-021-0/+2
| | | | | | | | | | | | | | | | | | | | 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
* install: Normalize DESTINATION pathsCraig Scott2024-09-191-1/+3
| | | | | | | | | | | | | | 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
* execute_process: Change default ENCODING to UTF-8Brad King2024-09-161-0/+2
| | | | | | | | | | | | | 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
* add_custom_command: Validate arguments more rigorouslyCraig Scott2024-09-091-0/+2
| | | | | | | Add a new CMP0175 policy to preserve backward compatibility for projects that were using unsupported keywords or arguments. Fixes: #26096, #21089, #18976
* cmake_parse_arguments: Set variable if empty string given after keywordCraig Scott2024-08-221-1/+5
| | | | | | | | | | | | | | | 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
* CMakeFindFrameworks: Deprecate the module subject to policy CMP0173Craig Scott2024-08-161-1/+3
| | | | Fixes: #20446
* CPack/WIX: Generate perMachine installers by defaultBrad King2024-07-181-1/+5
| | | | | | | | | | | 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
* add_custom_command: Add CODEGEN supportJuan Ramos2024-07-011-1/+3
| | | | | | | | | | | 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.
* FetchContent: Enforce FETCHCONTENT_FULLY_DISCONNECTED requirementsCraig Scott2024-05-291-1/+4
| | | | | | | 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).
* FetchContent: Deprecate FetchContent_Populate(depName)Craig Scott2024-05-291-0/+4
| | | | | Projects should use FetchContent_MakeAvailable(depName) instead. Policy CMP0169 provides backward compatibility.
* FetchContent: Populate directly without a sub-buildCraig Scott2024-05-171-1/+5
| | | | Fixes: #21703
* FindBoost: Add policy to remove this moduleBrad King2024-05-031-1/+3
| | | | | | | | | | 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
* GenEx: Fix TARGET_PROPERTY evaluation of transitive link propertiesBrad King2024-04-291-1/+5
| | | | | | | | | 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.
* Help: Clarify CMP0099 documentation and summary textBrad King2024-04-291-2/+2
|
* Help: CMP0135 applies to FetchContent as wellCraig Scott2024-04-271-2/+2
| | | | | | | | 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
* enable_language(): Fail if called before project()Craig Scott2024-04-021-1/+4
| | | | Fixes: #25550
* add_library: Reject shared libraries on platforms that do not support themAsit Dhal2024-03-291-1/+5
| | | | | | Add policy CMP0164 to provide compatibility. Fixes: #25759
* CMP0163: Make GENERATED source file property globally visibleDeniz Bahadir2024-03-291-0/+4
| | | | | | | | | | | | | | | 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
* CMP0118: Revise documentation to describe actual behaviorDeniz Bahadir2024-03-211-4/+4
| | | | | | | | 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
* VS: Add UseDebugLibraries to vcxproj files by defaultBrad King2024-02-221-2/+7
| | | | | | | Use heuristics to select a reasonable value. Add policy CMP0162 to provide compatibility with existing projects. Fixes: #25327
* CPack: Change CPACK_PRODUCTBUILD_DOMAINS default to true (CMP0161)Craig Scott2024-01-281-1/+3
| | | | Fixes: #23351
* cmTarget: Don't allow setting read-only propertiesRobert Maynard2024-01-231-2/+7
| | | | | Ensure that all documented read-only target properties now produce errors when trying to set.
* file: `STRINGS` + `REGEX` store match resultsCristian Le2024-01-091-1/+4
| | | | Signed-off-by: Cristian Le <cristian.le@mpsd.mpg.de>
* add_test: Fix version of CMake introducing CMP0158 (to 3.29)Robert Maynard2024-01-051-1/+1
| | | | | | 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.
* add_test: Honor CROSSCOMPILING_EMULATOR only when cross-compilingRalf Habacker2023-12-191-1/+5
| | | | | | Add policy CMP0158 to provide compatibility for existing projects. Fixes: #23672
* Swift: Add abstraction for compilation modeEvan Wilde2023-11-171-2/+6
| | | | | | | | | | | 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
* Link step: Enable to configure deduplication of librariesMarc Chevrier2023-11-091-2/+7
| | | | | | | | | 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
* CMP0155: ignore scanning for sources if no scanner is availableBen Boeckel2023-11-011-4/+4
| | | | | | | | | | 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
* cxxmodules: scan C++ sources for imports by defaultBen Boeckel2023-10-021-1/+6
| | | | | Existing projects are not using C++ modules in their sources, so introduce policy CMP0155 to enable scanning by default.
* Ninja: Allow compilation before generation of dependencies' private sourcesMartin Duffy2023-09-201-2/+7
| | | | | | | | | | 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
* exec_program(): Remove by policy CMP0153Kyle Edwards2023-07-251-1/+3
|
* file(REAL_PATH): resolve symlinks before '..' componentsRobert Maynard2023-07-201-1/+5
| | | | | | | | 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.
* Autogen: Default AUTOGEN_USE_SYSTEM_INCLUDE to ON if it is not setOrkun Tokdemir2023-05-031-0/+4
| | | | Add policy CMP0151 to preserve the old behavior by default.
* ExternalProject/FetchContent: Support relative remote URLsChris Wright2023-04-261-1/+6
| | | | | | | | | 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>
* VS: Select latest available Windows SDK version by defaultBrad King2023-04-051-0/+3
| | | | | | | Add policy `CMP0149` to stop preferring SDKs exactly matching `CMAKE_SYSTEM_VERSION` over the latest SDK. Fixes: #16202
* FindPython{Interp,Libs}: Add policy to remove these modulesBrad King2023-03-301-0/+3
| | | | | | 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}`.
* VS: Add policy to build custom commands concurrentlyBrad King2023-03-121-2/+7
| | | | | | | | | | | | | | 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
* FindCUDA: Add policy to remove this moduleBrad King2023-03-091-1/+3
| | | | | | 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.
* Dart,FindDart: Add policy to remove these modulesBrad King2023-02-281-1/+3
| | | | | These modules and the "DART" tool they support have long been replaced by CTest.
* find_package: Use <PACKAGENAME>_ROOT variables as search prefixesBrad King2023-02-231-1/+4
| | | | | | | | | Extend commit eb35d8884b (find_package: Use PackageName_ROOT variables as search prefixes, 2018-03-15, v3.12.0-rc1~349^2) to also check upper-case `<PACKAGENAME>_ROOT` variables. Add policy `CMP0144` to enable the behavior in a compatible way. Fixes: #24403
* cmCustomCommand: Refactor custom command-specific policy valuesKyle Edwards2023-02-061-0/+2
| | | | | | | | | | | | | | | | | Many custom commands are created by CMake itself rather than by the user. These custom commands should always have their policies set to NEW, and user-created custom commands should have their policy values set only from the state snapshot. In addition, we want to genericize the mechanism of recording a policy at the time of custom command creation. Add a CM_FOR_EACH_CUSTOM_COMMAND_POLICY macro to genericize custom command policies. Use this to define all custom command policies. Make all such policies NEW instead of WARN by default. Remove individual policy modifier methods and add a single method that records relevant values from a cmStateSnapshot. Remove the no longer needed explicit policy settings from synthesized custom commands.
* USE_FOLDERS: Treat as on by defaultJuan Ramos2022-11-081-1/+4
| | | | | | | Add a policy to treat the `USE_FOLDERS` global property as ON by default if it is not set. Fixes: #21695
* Xcode: Do not append per-config suffixes to library search pathsMikko Sivulainen2022-09-151-2/+7
| | | | | | | Add policy `CMP0142` to remove the automatic addition of the `$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)` suffix in a compatible way. Fixes: #21757
* MSVC: Add abstraction for debug information formatGlen Chung2022-09-141-1/+5
| | | | | | | | | | | | | | | | Replace our hard-coded default for `/Zi` with a first-class abstraction to select the debug information format an enumeration of logical names. We've long hesitated to do this because the idea of "debug information format" touches on related concepts on several platforms. Avoid that scope creep by simply defining an abstraction that applies only when targeting the MSVC ABI on Windows. Removing the old default flag requires a policy because existing projects may rely on string processing to edit them and choose a runtime library under the old behavior. Add policy CMP0141 to provide compatibility. Fixes: #10189
* return(): Propagate variables to result scopeMarc Chevrier2022-09-031-1/+3
| | | | Fixes: #23871
* CheckIPOSupported: Compile check using flags of calling projectBrad King2022-06-101-1/+2
| | | | | | | | | | | | | | | | Forward `CMAKE_<LANG>_FLAGS` and `CMAKE_<LANG>_FLAGS_DEBUG` from the calling project into the test project. The set of flags may affect the availability of IPO support. Since this may change the result of the check for existing projects, add a policy for compatibility. This was discovered after commit 5fcadc481e (MSVC: Default to -ZI instead of /Zi for x86 and x64, 2022-05-24) introduced policy CMP0138 to switch our default for MSVC's debug info flag. The `-ZI` flag is incompatible with the `-GL` flag used for IPO, so CMP0138 was reverted pending future work on an alternative solution. Re-use the CMP0138 policy number for this change to CheckIPOSupported instead. Fixes: #23607
* MSVC: Revert "Default to -ZI instead of /Zi for x86 and x64"Brad King2022-06-091-3/+2
| | | | | | | | | | | | | | Revert commit 5fcadc481e (MSVC: Default to -ZI instead of /Zi for x86 and x64, 2022-05-24). The `-ZI` flag is incompatible with the `-GL` flag used for IPO, and so is not an unconditionally better default. Revert the change pending future design of a first-class setting for MSVC debug info format that can be automatically reconciled with IPO settings. That commit introduced policy CMP0138, but we already have later policy numbers used too. Leave placeholder text to avoid policy renumbering. Issue: #23607, #10189
* if command: Add PATH_EQUAL operatorMarc Chevrier2022-06-031-1/+5
|