summaryrefslogtreecommitdiff
path: root/Modules/CMakeGenericSystem.cmake
AgeCommit message (Collapse)AuthorLines
2024-08-27cxxmodules: plumb control data for exporting build databasesBen Boeckel-0/+7
This includes the target property, its initializing variable, its initializing environment variable, and updating related docs to mention the new bits.
2024-01-30cmake: Allow CMAKE_INSTALL_PREFIX to be set by environment variableSilvio Traversaro-9/+16
Fixes: #25023
2022-11-16AutoMoc: Don't initialize already defined CMAKE_AUTOMOC_ variablesJoerg Bornemann-3/+9
Setting the variables CMAKE_AUTOGEN_ORIGIN_DEPENDS, CMAKE_AUTOMOC_COMPILER_PREDEFINES, and CMAKE_AUTOMOC_MACRO_NAMES on the cmake command line did not work as expected. CMakeGenericSystem.cmake initialized these variables even if they were defined by the user. This led to the confusing situation where the cache variant of a variable had one value (defined on the command line) and the non-cache variant of a variable had a different value (defined in CMakeGenericSystem.cmake). Fix this by checking whether the variables are defined before setting their default values. Fixes: #24069
2022-03-09Merge topic 'color-diagnostics'Brad King-3/+8
6ab9fbd43b color: Add tests for CMAKE_COLOR_DIAGNOSTICS 78adb1b952 color: Add CMAKE_COLOR_DIAGNOSTICS environment variable 884d9de8b7 color: Introduce CMAKE_COLOR_DIAGNOSTICS variable Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Acked-by: Frank Dana <ferdnyc@gmail.com> Merge-request: !6990
2022-03-08color: Add CMAKE_COLOR_DIAGNOSTICS environment variableSemyon Kolton-0/+4
2022-03-08color: Introduce CMAKE_COLOR_DIAGNOSTICS variableSemyon Kolton-3/+4
Add a variable to control both makefile color messages and compiler color diagnostics. Fixes: #15502
2022-02-16genex-LINK_LIBRARY: rename configuration variablesMarc Chevrier-1/+1
To be more consistent between genex and variables as well as the forecomming LINK_GROUP genex, rename variable *_LINK_USING_<FEATURE>* in *_LINK_LIBRARY_USING_<FEATURE>*
2022-02-08$<LINK_LIBRARY>: Add LINK_LIBRARY_OVERRIDE target propertyMarc Chevrier-0/+6
To enable the management of incompatible $<LINK_LIBRARY> declarations, add LINK_LIBRARY_OVERRIDE and LINK_LIBRARY_OVERRIDE_<LIBRARY> target properties.
2020-09-25VS: Fix CMAKE_INSTALL_PREFIX with GENERATOR_PLATFORM for x64 and ARMRechi-0/+4
Generate the same default `CMAKE_INSTALL_PREFIX` if a project is configured with CMAKE_GENERATOR_PLATFORM (`cmake -G "Visual Studio [...]" -A x64` and `cmake -G "Visual Studio [...]" -A ARM`) instead of the prior CMake 3.1 way (`cmake -G "Visual Studio [...] Win64"` and `cmake -G "Visual Studio [...] ARM"`).
2020-08-10Merge branch 'backport-3.17-automoc-path-prefix-off'Brad King-1/+3
2020-08-10Merge branch 'backport-3.16-automoc-path-prefix-off'Brad King-1/+3
2020-08-10Autogen: Turn off moc path prefix generation by defaultJoerg Bornemann-1/+3
Change the default value of `CMAKE_AUTOMOC_PATH_PREFIX` to `OFF` to restore compatibility with behavior of CMake 3.15 and below. C++ source files that are generated by Qt's meta object compiler (moc) include the header file that was passed as input argument to moc. This is usually a path relative to the source directory, for example #include "../../source/dir/myobject.h" That is problematic for reproducible builds as described in #18815. To cope with that, the target property AUTOMOC_PATH_PREFIX was introduced in CMake 3.16 by commit d018d27c10 (Autogen: Add moc path prefix generation (AUTOMOC_PATH_PREFIX), 2019-09-13, v3.16.0-rc1~94^2~4). The property is default-initialized from the variable `CMAKE_AUTOMOC_PATH_PREFIX`, which defaults to `ON`. If this property is ON, and myobject.h is located in an include directory of the target, moc-generated C++ files include the file without the "path prefix": #include "myobject.h" This behavior, however, can break projects that have equally named header files in different include directories. As "not breaking existing projects" trumps "have reproducible builds by default" we change the default of `CMAKE_AUTOMOC_PATH_PREFIX` to `OFF`. Also, it is now possible to pass `-DCMAKE_AUTOMOC_PATH_PREFIX=ON` on the CMake command line. Before, it was overridden in `CMakeGenericSystem`. Fixes: #20598 Issue: #18815
2020-05-12Initialize CMAKE_EXPORT_COMPILE_COMMANDS only if not set alreadyBrad King-7/+1
Also de-duplicate its initialization code. Fixes: #16588
2020-02-26Autogen: Recognize the new Q_NAMESPACE_EXPORT macro in AUTOMOCRichard-1/+1
Qt 5.14 introduced a new moc keyword `Q_NAMESPACE_EXPORT`. Qt-Issue: https://bugreports.qt.io/browse/QTBUG-68014
2019-10-18Initialize CMAKE_EXPORT_COMPILE_COMMANDS from envvar of the same nameDaan De Meyer-4/+4
Fixes: #18386
2019-09-16Autogen: Add moc path prefix generation (AUTOMOC_PATH_PREFIX)Sebastian Holtermann-0/+1
The new `AUTOMOC_PATH_PREFIX` boolean target property enables automatic generation of the path prefix `-p` option for `moc`. `AUTOMOC_PATH_PREFIX` is initialized from the variable `CMAKE_AUTOMOC_PATH_PREFIX`, which is ON by default. When `AUTOMOC_PATH_PREFIX` is enabled, CMake tests if a `moc`ed header file is in one of the include directories. If so, then the `-p` option, with the relative path of the header parent directory to the respective include directory, is added to the `moc` command. If the header file is not in an include directory, the `-p` option is omitted. Closes: #18815 "AUTOMOC: generated files include full relative path, breaking certain reproducible builds"
2018-11-03Autogen: Add (CMAKE_)AUTOGEN_ORIGIN_DEPENDS supportSebastian Holtermann-0/+2
This adds - the variable ``CMAKE_AUTOGEN_ORIGIN_DEPENDS`` which initializes - the target property ``AUTOGEN_ORIGIN_DEPENDS`` which controls whether or not the origin target dependencies should be forwarded to the corresponding ``_autogen`` target. The default value of ``CMAKE_AUTOGEN_ORIGIN_DEPENDS`` is ``ON`` which corresponds to the behavior that is in place since CMake 3.9. Closes: #18493
2018-01-23GenericSystem: Remove misspelled flag defaultChristian Pfeiffer-1/+0
In CMakeGenericSystem, it should be ``CMAKE_INCLUDE_SEP_<LANG>`` and not ``CMAKE_INCLUDE_<LANG>_SEP``. However, if the flag is defined, include behavior changes to Java-style non-repeating flags, which isn't intended. Therefore, removing the (misspelled) default initialization should help remove confusion and unintended side effects.
2018-01-08Unhardcode the CMAKE_CONFIGURATION_TYPES valuesBeren Minor-0/+1
This removes duplicated code for per-config variable initialization by providing a `cmake_initialize_per_config_variable(<PREFIX> <DOCSTRING>)` function. This function initializes a `<PREFIX>` cache variable from `<PREFIX>_INIT` and unless the `CMAKE_NOT_USING_CONFIG_FLAGS` variable is defined, does the same with `<PREFIX>_<CONFIG>` from `<PREFIX>_<CONFIG>_INIT` for every `<CONFIG>` in `CMAKE_CONFIGURATION_TYPES` for multi-config generators or `CMAKE_BUILD_TYPE` for single-config generators.
2017-09-29Autogen: Add (CMAKE_)AUTOMOC_COMPILER_PREDEFINESSebastian Holtermann-0/+1
2017-09-27Autogen: Define all macro names in CMAKE_AUTOMOC_MACRO_NAMESSebastian Holtermann-0/+1
Instead of adding `Q_OBJECT` and `Q_GADGET` to the macro search list in `Source/cmQtAutoGenerators.cxx`, add them in `Modules/CMakeGenericSystem.cmake` to the default value of `CMAKE_AUTOMOC_MACRO_NAMES`. Also add `Q_NAMESPACE` to `CMAKE_AUTOMOC_MACRO_NAMES` which closes #17299.
2017-09-12MSVC: Add support for ARM64 architectureMinmin Gong-0/+2
Visual Studio 15.4 adds support for this architecture. Fixes: #17213
2016-09-27Simplify CMake per-source license noticesBrad King-12/+2
Per-source copyright/license notice headers that spell out copyright holder names and years are hard to maintain and often out-of-date or plain wrong. Precise contributor information is already maintained automatically by the version control tool. Ultimately it is the receiver of a file who is responsible for determining its licensing status, and per-source notices are merely a convenience. Therefore it is simpler and more accurate for each source to have a generic notice of the license name and references to more detailed information on copyright holders and full license terms. Our `Copyright.txt` file now contains a list of Contributors whose names appeared source-level copyright notices. It also references version control history for more precise information. Therefore we no longer need to spell out the list of Contributors in each source file notice. Replace CMake per-source copyright/license notice headers with a short description of the license and links to `Copyright.txt` and online information available from "https://cmake.org/licensing". The online URL also handles cases of modules being copied out of our source into other projects, so we can drop our notices about replacing links with full license text. Run the `Utilities/Scripts/filter-notices.bash` script to perform the majority of the replacements mechanically. Manually fix up shebang lines and trailing newlines in a few files. Manually update the notices in a few files that the script does not handle.
2015-07-14Makefile: Optionally disable target completion messages in build outputMichael Ensslin-0/+3
Add a TARGET_MESSAGES property to control whether Makefile targets print the "Built target " completion messages. Default to ON to preserve existing behavior.
2015-07-14CMakeGenericSystem: Recognize Watcom WMake generator as Makefile generatorBrad King-1/+1
2012-08-13Remove CMake-language block-end command argumentsKitware Robot-7/+7
Ancient versions of CMake required else(), endif(), and similar block termination commands to have arguments matching the command starting the block. This is no longer the preferred style. Run the following shell code: for c in else endif endforeach endfunction endmacro endwhile; do echo 's/\b'"$c"'\(\s*\)(.\+)/'"$c"'\1()/' done >convert.sed && git ls-files -z -- bootstrap '*.cmake' '*.cmake.in' '*CMakeLists.txt' | egrep -z -v '^(Utilities/cm|Source/kwsys/)' | egrep -z -v 'Tests/CMakeTests/While-Endwhile-' | xargs -0 sed -i -f convert.sed && rm convert.sed
2012-08-13Convert CMake-language commands to lower caseKitware Robot-49/+49
Ancient CMake versions required upper-case commands. Later command names became case-insensitive. Now the preferred style is lower-case. Run the following shell code: cmake --help-command-list | grep -v "cmake version" | while read c; do echo 's/\b'"$(echo $c | tr '[:lower:]' '[:upper:]')"'\(\s*\)(/'"$c"'\1(/g' done >convert.sed && git ls-files -z -- bootstrap '*.cmake' '*.cmake.in' '*CMakeLists.txt' | egrep -z -v '^(Utilities/cm|Source/kwsys/)' | xargs -0 sed -i -f convert.sed && rm convert.sed
2012-06-04Make the CMAKE_EXPORT_COMPILE_COMMANDS option work with Ninja.Stephen Kelly-0/+6
2012-05-24Merge topic 'MakeDefaultInstallComponentNameConfigurable'David Cole-2/+6
b71e731 -add docs for ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME} 7ced073 make default install component name configurable b6fba35 -strip trailing whitespace
2012-05-14make default install component name configurableAlex Neundorf-0/+4
Until now an unnamed component was always named "Unspecified". Now this name is taken from the new cmake variable CMAKE_INSTALL_DEFAULT_COMPONENT_NAME, which is initialized to "Unspecified". But it can now be set to something project-specific, per directory Alex
2012-05-13-strip trailing whitespaceAlex Neundorf-2/+2
Alex
2012-05-10VS11: Fix ARM architecture hint typo (#13077)Brad King-1/+1
2012-05-09VS11: Add ARM architecture generator (#13077)Minmin Gong-0/+2
2012-03-05Add an option to skip RPATH during installation.Stephen Kelly-0/+3
2011-06-20Add VisualStudio 9 and 10 generators for Itanium platformMatej Hribernik-1/+1
2011-05-16Only offer the compile command output feature on unix systemsManuel Klimek-3/+6
2011-04-25make compile command output optionalManuel Klimek-0/+3
2010-09-09Correct CMAKE_INSTALL_PREFIX value for Win64 apps (#9992)David Cole-13/+89
The default value for CMAKE_INSTALL_PREFIX should be based on what architecture the built targets are, not what architecture CMake itself is. This fix merely guesses better what the built targets architecture is. It still may guess incorrectly in some cases. For those cases, it will have to be up to build scripts and developers on projects to pass in a correct value for CMAKE_INSTALL_PREFIX with -D on the command line or via 'force cache value' logic in CMakeLists.txt files.
2010-08-09Modules: Fix spelling 'To distributed' -> 'To distribute'Todd Gamblin-1/+1
2009-12-02Split GNU compiler information filesBrad King-3/+0
This moves GNU compiler flags into new-style modules Compiler/GNU-<lang>.cmake Platform/<os>-GNU-<lang>.cmake We use language-independent helper modules Compiler/GNU.cmake Platform/<os>-GNU.cmake to define macros consolidating the information.
2009-09-28Convert CMake non-find modules to BSD LicenseBrad King-0/+14
This adds copyright/license notification blocks CMake's non-find modules. Most of the modules had no notices at all. Some had notices referring to the BSD license already. This commit normalizes existing notices and adds missing notices.
2009-03-16ENH: Allow projects to disable per-rule echo linesBrad King-3/+3
This creates global property RULE_MESSAGES which can be set to disbale per-rule progress and action reporting. On Windows, these reports may cause a noticable delay due to the cost of starting extra processes. This feature will allow scripted builds to avoid the cost since they do not need detailed information anyway. This replaces the RULE_PROGRESS property created earlier as it is more complete. See issue #8726.
2009-03-16ENH: Allow projects to disable per-rule progressBrad King-0/+3
This creates global property RULE_PROGRESS which can be set to disbale per-rule progress reporting. On Windows, progress reports may cause a noticable delay due to the cost of starting an extra process. This feature will allow scripted builds to avoid the cost since they do not need detailed progress anyway. See issue #8726.
2009-01-09STYLE: this is not necessary anymore for kdevelop, the kdevelop generatorAlexander Neundorf-5/+1
now generates the project so that the environment variable VERBOSE is set to 1 when make is executed by kdevelop (and additionally this didn't work, since CMAKE_GENERATOR never matches KDevelop3, this is now in CMAKE_EXTRA_GENERATOR) Alex
2008-01-17ENH: Rename SET_PROPERITES command to SET_PROPERTY and give it a more ↵Brad King-1/+1
powerful signature.
2007-08-28ENH: add flag so a terminating slash for the link path can be specified ↵Alexander Neundorf-0/+1
(needed by the Digital Mars D compiler) Alex
2007-08-09BUG: use CMAKE_HOST_UNIX here instead of UNIXAlexander Neundorf-3/+3
Alex
2007-06-26STYLE: change global cmake variable CMAKE_TARGET_SUPPORTS_ONLY_STATIC_LIBSAlexander Neundorf-1/+1
to the first global cmake property TARGET_SUPPORTS_SHARED_LIBS Alex
2007-06-21ENH: print a warning if ADD_LIBRARY( SHARED/MODULE ) is used and the targetAlexander Neundorf-0/+3
platform doesn't support shared libraries Alex
2007-05-22STYLE: move the two CMAKE_SHARED_LIBRARYC/CXX_FLAGS for gcc fromAlexander Neundorf-14/+8
CMakeGenericSystem.cmake to gcc.cmake Alex