summaryrefslogtreecommitdiffstats
path: root/Help/manual/cmake-policies.7.rst
Commit message (Collapse)AuthorAgeFilesLines
* CPack: Change CPACK_PRODUCTBUILD_DOMAINS default to true (CMP0161)Craig Scott2024-01-281-0/+1
| | | | Fixes: #23351
* cmTarget: Don't allow setting read-only propertiesRobert Maynard2024-01-231-0/+1
| | | | | Ensure that all documented read-only target properties now produce errors when trying to set.
* file: `STRINGS` + `REGEX` store match resultsCristian Le2024-01-091-0/+1
| | | | Signed-off-by: Cristian Le <cristian.le@mpsd.mpg.de>
* add_test: Honor CROSSCOMPILING_EMULATOR only when cross-compilingRalf Habacker2023-12-191-0/+1
| | | | | | Add policy CMP0158 to provide compatibility for existing projects. Fixes: #23672
* Swift: Add abstraction for compilation modeEvan Wilde2023-11-171-0/+1
| | | | | | | | | | | 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-0/+8
| | | | | | | | | 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-1/+1
| | | | | | | | | | 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-0/+1
| | | | | 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-0/+1
| | | | | | | | | | 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-0/+1
|
* file(REAL_PATH): resolve symlinks before '..' componentsRobert Maynard2023-07-201-0/+8
| | | | | | | | 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/+1
| | | | Add policy CMP0151 to preserve the old behavior by default.
* ExternalProject/FetchContent: Support relative remote URLsChris Wright2023-04-261-0/+1
| | | | | | | | | 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/+1
| | | | | | | 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/+1
| | | | | | 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-0/+1
| | | | | | | | | | | | | | 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-0/+1
| | | | | | 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-0/+1
| | | | | 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-0/+8
| | | | | | | | | 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
* USE_FOLDERS: Treat as on by defaultJuan Ramos2022-11-081-0/+7
| | | | | | | 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-0/+1
| | | | | | | 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-0/+1
| | | | | | | | | | | | | | | | 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-0/+8
| | | | Fixes: #23871
* Help: Fix typos, grammar and formatting in CMP0134 policy docsCraig Scott2022-08-301-1/+1
|
* CheckIPOSupported: Compile check using flags of calling projectBrad King2022-06-101-1/+1
| | | | | | | | | | | | | | | | 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-1/+1
| | | | | | | | | | | | | | 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-0/+1
|
* MSVC: Default to -ZI instead of /Zi for x86 and x64Glen Chung2022-05-261-0/+1
| | | | | | | | | | Add a policy for compatibility. For more information, see [1]. [1] https://docs.microsoft.com/en-us/cpp/build/reference/z7-zi-zi-debug-information-format?view=msvc-170 Fixes: #10189
* try_compile: Propagate platform variables in project-mode tooBrad King2022-05-161-0/+1
| | | | | | | | | Add policy CMP0137 to propagate both our builtin variables and those listed by `CMAKE_TRY_COMPILE_PLATFORM_VARIABLES` to `try_compile` whole-project builds. Inspired-by: Alexander Neumann <Alexander.Neumann@hamburg.de> Fixes: #23219
* OpenWatcom: Allow specifying the runtime libraryCameron Cawley2022-05-061-0/+1
| | | | | | | | Add a `CMAKE_WATCOM_RUNTIME_LIBRARY` variable to control the runtime library selection. Add policy CMP0136 to switch to in place of the old hard-coded default flags. Fixes: #23178
* ExternalProject: Add DOWNLOAD_EXTRACT_TIMESTAMP option and policyKasper Laudrup2022-05-041-0/+1
| | | | | | | | | | Add the option to keep the current filestamps when extracting an archive in ExternalProject_Add. Enabling this option makes the behavior consistent with how ExternalProject_Add is used when checking out code from revision control instead of an archive. Fixes: #22746
* find_* commands: add control over Windows registry viewsMarc Chevrier2022-04-291-0/+1
| | | | Fixes: #22775
* CPack/DMG: Do not use CPACK_RESOURCE_FILE_LICENSE for SLA by defaultBrad King2022-04-141-0/+1
| | | | | | | | Since macOS 12.0 deprecated the tools needed to attach a SLA to a `.dmg`, we should no longer do this by default. Add a policy to change the default to off. Fixes: #22978
* CMP0132: Don't set compiler environment variables on first runCraig Scott2022-03-291-0/+1
| | | | | | | | | | | When running CMake for the first time in a build tree, for some generators CMake would set compiler environment variables like CC, CXX, etc. when the corresponding language is enabled. That behavior was never documented and can result in different behavior between the first and subsequent runs. Add a policy to no longer set those environment variables. Fixes: #21378
* LINK_LIBRARIES: Add support for LINK_ONLY genexBrad King2022-03-241-0/+1
| | | | | | | Previously we always used content guarded by `$<LINK_ONLY:...>` in `LINK_LIBRARIES`, even when evaluating for non-linking usage requirements. Add a policy to honor `LINK_ONLY` in `LINK_LIBRARIES` the same way we already do in `INTERFACE_LINK_LIBRARIES`.
* while: diagnose errors during condition evaluationBrad King2022-03-041-0/+8
| | | | | | Add a policy to diagnose condition errors in a compatible way. Fixes: #23296
* LCC: Add policy CMP0129 regarding interpreting LCC as GNUmakise-homura2021-10-211-0/+9
| | | | | | | | | | Due to MCST LCC compiler identification is now changed to LCC, there should be a way for old projects to still identify it as GNU, as it was before. This commits adds the policy: CMP0129: Compiler id for MCST LCC compilers is now LCC, not GNU. This policy controls such a behavior. OLD behaivior is to treat LCC as GNU, NEW is to treat is as LCC.
* cmStandardLevelResolver: Avoid unnecessary flags, fix unset level logicRaul Tambre2021-09-291-0/+1
| | | | | | | | | | | | | | | | | | The changes are part of CMP0128. When the standard level is unset: * Flags are added if extension mode doesn't match the compiler's default. Previously logic only worked if LANG_EXTENSIONS was ON. Fixes #22224. * The full flag is used. Previously CMAKE_LANG_EXTENSION_COMPILE_OPTION was used. This was only supported for IAR. Otherwise: * Avoid adding flags if not necessary per the detected compiler defaults. * Fixed check for when the requested standard is older. It now matches the nearby comments. I reworded the fallback comment as its logic was a bit difficult to wrap my head around.
* CMakeDependentOption: Introduce policy CMP0127 for full Condition SyntaxDaniel Schürmann2021-09-101-0/+8
| | | | Fixes: #22303
* set(CACHE): do not remove normal variableMarc Chevrier2021-05-201-0/+1
| | | | Fixes: #22038
* find_*: ensure consistent behavior for cache variablesMarc Chevrier2021-05-121-0/+1
| | | | Fixes: #22121
* Help: Fix typos and spelling in documentationJosef Angstenberger2021-05-071-1/+1
|
* foreach(): loop variables are only available in the loop scopeMarc Chevrier2021-04-281-0/+1
| | | | Fixes: #20553
* ARMClang: Do not automatically add cpu/arch compile or link optionsLingkai Dong2021-04-271-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | The compile options `--march=<arch>` and `--mcpu=<cpu>` and the link option `--cpu=<cpu>` are automatically added by CMake based on `CMAKE_SYSTEM_PROCESSOR` or `CMAKE_SYSTEM_ARCH`. But this is not sufficient, because armclang also supports enabling or disabling features using `+<feature>`: -mcpu=<name>[+[no]<feature>+...] For example: -mcpu=cortex-a57+nocrypto+nofp+nosimd+crc (Reference: https://developer.arm.com/documentation/dui0774/k/Compiler-Command-line-Options/-mcpu?lang=en) The problem is, even if a project adds a flag with features it needs, CMake still adds flags, resulting in code that is compiled with wrong CPU features and unable to run. Add policy `CMP0123` to not automatically add compile or link options, and let projects set them instead. Co-Author: Brad King <brad.king@kitware.com> Fixes: #21173
* UseSWIG: Use standard library name conventions for csharp languageMarc Chevrier2021-03-261-1/+2
| | | | Fixes: #21542
* cmListCommand: add a policy for failing on invalid indiciesBen Boeckel2021-02-181-0/+8
|
* WriteCompilerDetectionHeader: Add policy to remove moduleBrad King2020-12-051-0/+1
| | | | | | See justification in the policy documentation. Closes: #17842
* Compile with explicit language flag when source LANGUAGE property is setBrad King2020-12-021-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | This change was originally made by commit 74b1c9fc8e (Explicitly specify language flag when source LANGUAGE property is set, 2020-06-01, v3.19.0-rc1~722^2), but it was reverted by commit 30aa715fac (Revert "specify language flag when source LANGUAGE property is set", 2020-11-19) to restore compatibility with pre-3.19 behavior. Implement the change again, but add policy CMP0119 to make this change while preserving compatibility with existing projects. Note that the `Compiler/{Clang,Intel,MSVC}-CXX` modules do not need to specify `-TP` for their MSVC-like variants because we already use the flag in `CMAKE_CXX_COMPILE_OBJECT`. Similarly for `Compiler/XL-CXX` and `Platform/Windows-Embarcadero`. Note also that this does not seem possible to implement for XL C. Even with `-qsourcetype=c`, `xlc` complains about an unknown suffix: `1501-218 (W) file /.../AltExtC.zzz contains an incorrect file suffix`. It returns non-zero even with `-qsuppress=1501-218`. Co-Author: Robert Maynard <robert.maynard@kitware.com> Fixes: #14516, #20716
* GENERATED prop: Introducing policy CMP0118 and its documentationDeniz Bahadir2020-11-241-0/+1
| | | | | Note: This is currently only defining the CMP0118 policy and providing its documentation, however, the implementation is still not using it.
* MSVC: Do not add /GR to CMAKE_CXX_FLAGS by defaultBrad King2020-11-131-0/+1
| | | | | | | | | | | | The `/GR` flag has been on by default since MSVC cl 14.0 from VS 2005. Remove it from the default flags to make it easier for projects to pass `/GR-` themselves to turn it off. Projects may be using string processing to replace `/GR` with another flag, so we cannot simply drop it. Add a policy to drop it in a compatible way. Fixes: #21428