summaryrefslogtreecommitdiffstats
path: root/Help/manual/cmake-policies.7.rst
Commit message (Collapse)AuthorAgeFilesLines
* 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
* Merge topic 'doc-CMP0111'Brad King2020-10-191-1/+1
|\ | | | | | | | | | | | | | | 5c3a91c808 CMP0111: Clarify that the new error is on a missing property setting Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: Alex Reinking <alex_reinking@berkeley.edu> Merge-request: !5385
| * CMP0111: Clarify that the new error is on a missing property settingBrad King2020-10-161-1/+1
| | | | | | | | The previous wording could be confused with the file missing on disk.
* | Ninja: Transform DEPFILEs with policy CMP0116Kyle Edwards2020-10-131-0/+1
| | | | | | | | Fixes: #21267
* | CMP0115: Require source file extensions to be explicitKyle Edwards2020-10-131-0/+8
|/
* ExternalProject: Add policy CMP0114 to refine step target dependenciesBrad King2020-09-141-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | `ExternalProject_Add_StepTargets` and `INDEPENDENT_STEP_TARGETS` have some limitations and lack some sanity checks. They can cause confusing build systems to be generated. The basic problems are: * The notion of step independence is attached to the step target rather than the step itself. * The custom commands implementing the steps are duplicated in the step targets and the primary targets. This can cause races. It is also incompatible with the Xcode "new build system". Fix this by introducing policy CMP0114 to change the way step target dependencies are handled. Define independence from external dependencies as a property of each individual step regardless of whether there is a target for it. Add dependencies among the primary target and the step targets such that each custom command only appears in one target. When some steps are disconnected from the primary target, add step targets for the steps commonly depended upon so that there is a place to hold their custom commands uniquely. Fixes: #18663
* Makefile: Add policy CMP0113 to avoid duplication of custom commandsBrad King2020-09-081-0/+1
| | | | | | | | | | | | | | | | | Do not attach a custom command to a target if it is already attached to one of the target's dependencies. The command's output will be available by the time the target needs it because the dependency containing the command will have already been built. This may break existing projects that do not properly mark non-created outputs with the `SYMBOLIC` property. Previously a chain of two custom commands whose intermediate dependency is not created would put both commands in a dependent project's Makefile even if the first command is also in its dependency's Makefile. The first command would run twice but the build would work. Now the second command needs an explicit `SYMBOLIC` mark on its input to tell CMake that it is not expected to exist. To maintain compatibility with projects that left out the mark, add a policy activating the behavior.
* GenEx: Remove unneeded dependencies from target info queriesRobert Maynard2020-09-011-0/+1
| | | | | | | | | | Only generate a graph dependency between a custom command and a target when the custom command queries for the file path of an artifact of the target. This makes generator expressions such as `TARGET_FILE_DIR` behave the same way as `TARGET_PROPERTY` which never generated a graph dependency.
* cmTarget: Raise error if imported target location is not setRaul Tambre2020-08-211-0/+1
| | | | | | | | Previously we would synthesize <TARGET_NAME>-NOTFOUND as the location. This would then end up on the link line and cause build failures. Policy CMP0110 is added to control this behaviour. Fixes #19080, #19943.
* add_test: Allow special characters in test name (w/ policy CMP0110)Deniz Bahadir2020-08-121-1/+2
| | | | | | | | | | | | | | Restore the change from commit f84af8e270 (add_test: Allow special characters in test name, 2020-05-16, v3.18.0-rc1~142^2) that had to be reverted by commit f84af8e270 (add_test: Allow special characters in test name, 2020-05-16, v3.18.0-rc1~142^2) for compatibility. Add policy CMP0110 to make the change in a compatible way. Also, support even more characters than before by generating the test scripts using bracket arguments around the test names. Fixes: #19391 Signed-off-by: Deniz Bahadir <dbahadir@benocs.com>
* find_program: Find programs that are executable but not readableBrad King2020-06-151-0/+8
| | | | | | | | | This fix was first made by commit 86e6349ef7 (find_program: Find programs that are executable but not readable, 2020-04-04, v3.18.0-rc1~372^2) but was reverted for compatibility. Re-introduce it with a policy for compatibility. Fixes: #10468
* target_link_libraries: self-link through ALIAS is an errorMarc Chevrier2020-05-301-0/+1
| | | | Fixes: #19617
* ALIAS target: cannot overwrite an existing targetMarc Chevrier2020-05-281-0/+1
| | | | Fixes: #19616
* Modules/Documentation: removeBen Boeckel2020-04-221-0/+1
| | | | | | | | | | | | This is an old module from when VTK and other Kitware projects drove the addition of commands and modules into CMake itself. Modern VTK doesn't need this module and it can be ignored. This module is kept around so that the ancient VTK versions which use it are not broken by it. VTK itself stopped using the module in 2012 and the last usage by an example in VTK was removed in 2020. Fixes: #20591
* CUDA: Device linking use now link optionsMarc Chevrier2020-04-191-0/+1
| | | | | | | | | | properties LINK_OPTIONS and INTERFACE_LINK_OPTIONS are propagated to the device link step. To control which options are selected for normal link and device link steps, the $<DEVICE_LINK> and $<HOST_LINK> generator expressions can be used. Fixes: #18265
* CUDA: Add CUDA_ARCHITECTURES target propertyRaul Tambre2020-04-151-0/+1
| | | | | | | | | | | Simplifies CUDA target architecture handling. Required for Clang support as Clang doesn't automatically select a supported architecture. We detect a supported architecture during compiler identification and set CMAKE_CUDA_ARCHITECTURES to it. Introduces CMP0104 for backwards compatibility with manually setting code generation flags with NVCC. Implements #17963.
* export(): raise an error on multiple calls with same FILEMarc Chevrier2020-03-261-0/+8
| | | | Fixes: 20472
* cmMarkAsAdvancedCommand: ignore variables which don't exist in the cacheBen Boeckel2020-01-201-0/+1
| | | | Fixes: #18331
* target_compile_options: ensure BEFORE keyword is handled in all scopesMarc Chevrier2020-01-111-0/+1
| | | | Fixes: #20200
* Autogen: Process .hh headers based on new policy CMP0100 settingsSebastian Holtermann2020-01-041-0/+1
| | | | | | | Reintroduces .hh header processing in AUTOMOC and AUTOUIC based on the new policy CMP0100 setting. Fixes: #13904 CMAKE_AUTOMOC misses headers with ".hh" extension
* Link properties: must be transitive over private dependency on static libraryMarc Chevrier2019-12-091-0/+1
| | | | Fixes: #20022
* FindFLEX: Add policy CMP0098 to run flex in build treeJannick2019-11-151-0/+8
|
* ExternalProject: Support not initializing any submodulesRobert Maynard2019-07-241-0/+1
| | | | Fixes #15592
* project: Keep leading `0` in PROJECT_VERSION componentsAlex Turbov2019-07-161-0/+1
| | | | | | | | | Introduce CMake policy `CMP0096` to make `project()` keep leading zeros in version components. As a side effect, it now allows really long version numbers. Fixes: #19421 Co-Author: Brad King <brad.king@kitware.com>
* Help: Move CMP0095 into CMake 3.16 sectionKyle Edwards2019-06-251-1/+8
| | | | | | CMP0095 was introduced in 3.16, but was mistakenly put in the notes for 3.15. This error was not caught during review. Move it into the notes for 3.16.
* cmInstallTargetGenerator: Introduce CMP0095Dennis Klein2019-06-131-0/+1
| | | | | | | Escape coincidental CMake syntax in RPATH entries when generating the intermediary cmake_install.cmake script. Fixes #19225
* FindPython: Add policy to manage lookup stratgey default.Marc Chevrier2019-05-211-0/+1
|
* FindBoost: Introduce CMP0093 to report Boost_VERSION in x.y.z formatDennis Klein2019-05-131-0/+1
| | | | This aligns module mode behaviour with config mode.
* MSVC: Do not add /W3 to CMAKE_<LANG>_FLAGS by defaultBrad King2019-04-191-0/+1
| | | | | | | | | | | | | | We do not add default warning flags on other compilers, and having a warning flag in the default flags makes it hard for projects to customize the warning level. They need to use string processing to remove `/W3` from `CMAKE_{C,CXX}_FLAGS`. Therefore we should drop it. However, projects may be using string processing to replace `/W3` with another flag, so we cannot simply drop it. Add a policy to drop it in a compatible way. Fixes: #18317
* MSVC: Add abstraction for runtime library selectionBrad King2019-04-171-0/+1
| | | | | | | | | | | | | | | | Replace our hard-coded defaults for `/MD` and `/MDd` with a first-class abstraction to select the runtime library from an enumeration of logical names. We've long hesitated to do this because the idea of "runtime library selection" 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 flags 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 CMP0091 to provide compatibility. Fixes: #19108
* export: Disable PACKAGE mode user package registry by defaultRobert Maynard2019-03-151-0/+2
| | | | | | | The user package registry populated by the `export()` command causes side effects outside the build and source directories. Such effects should be opt-in rather than op-out. Introduce a policy to change default behavior of `export(PACKAGE)` to do nothing.
* XLClang: Add policy CMP0089 to present as XL for compatibilityBrad King2019-02-251-0/+8
| | | | | | | | We now identify IBM's Clang-based XL compilers, which define `__ibmxl__`, as `XLClang` rather than `XL`. In order to support existing project code that checks for `XL`, add a policy whose OLD behavior is to present the compiler id as `XL` and whose NEW behavior is to present the compiler id as `XLClang` as we really detect it.
* FindBISON: Add policy CMP0088 to run bison in build treeRobert Maynard2019-01-101-0/+1
|
* install: Teach CODE,SCRIPT modes to evaluate generator expressionsJon Chronopoulos2018-12-221-0/+1
| | | | | | | This also introduces CMP0087 which will keep the OLD behaviour of not evaluating generator expressions Fixes: #15785
* UseSWIG: add management of SWIG option -moduleMarc Chevrier2018-12-071-0/+1
| | | | | | | When file property SWIG_MODULE_NAME is specified, provide option -module to SWIG compiler. Fixes: #18374
* Genex: Add policy to handle empty list items in $<IN_LIST:...>Kyle Edwards2018-11-191-0/+1
| | | | | | | | | | The old behavior of $<IN_LIST:...> is inconsistent with that of if(IN_LIST), in that it does not find an empty search item even if the list contains empty items. This change adds a new policy to correctly handle empty items and make the behavior more consistent with if(IN_LIST). Fixes: #18556
* find_package(): Add policy to remove the FindQt moduleKyle Edwards2018-11-141-0/+1
| | | | | | | | Removing FindQt.cmake gives Qt upstream a path forward to export its own QtConfig.cmake files which can be found by find_package() without having to explicitly specify CONFIG. Projects that still want to use Qt3/4 can call find_package(Qt[34]), include(FindQt), or add FindQt.cmake to their CMAKE_MODULE_PATH.