Commit Graph

64 Commits

Author SHA1 Message Date
Kitware Robot
1772622772 LICENSE: Replace references to Copyright.txt with LICENSE.rst
```
git grep -lz 'Copyright.txt or https://cmake.org/licensing ' |
  while IFS= read -r -d $'\0' f ; do
    sed -i '/Copyright.txt or https:\/\/cmake.org\/licensing / {
              s/Copyright.txt/LICENSE.rst/
            }' "$f" ; done
```
2025-03-03 10:43:35 -05:00
Ben Boeckel
dcf9a66ffe cxxmodules: plumb control data for exporting build databases
This includes the target property, its initializing variable, its
initializing environment variable, and updating related docs to mention
the new bits.
2024-08-27 12:37:36 -04:00
Silvio Traversaro
06af18b9db cmake: Allow CMAKE_INSTALL_PREFIX to be set by environment variable
Fixes: #25023
2024-01-30 11:44:45 -05:00
Joerg Bornemann
70c721befb AutoMoc: Don't initialize already defined CMAKE_AUTOMOC_ variables
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-11-16 10:38:53 +01:00
Brad King
51e81d1f73 Merge topic 'color-diagnostics'
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-09 12:15:53 -05:00
Semyon Kolton
78adb1b952 color: Add CMAKE_COLOR_DIAGNOSTICS environment variable 2022-03-08 16:38:13 -05:00
Semyon Kolton
884d9de8b7 color: Introduce CMAKE_COLOR_DIAGNOSTICS variable
Add a variable to control both makefile color messages and compiler
color diagnostics.

Fixes: #15502
2022-03-08 16:37:08 -05:00
Marc Chevrier
397ee55cd6 genex-LINK_LIBRARY: rename configuration variables
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-16 18:34:28 +01:00
Marc Chevrier
2a6b0415d7 $<LINK_LIBRARY>: Add LINK_LIBRARY_OVERRIDE target property
To enable the management of incompatible $<LINK_LIBRARY> declarations,
add LINK_LIBRARY_OVERRIDE and LINK_LIBRARY_OVERRIDE_<LIBRARY> target
properties.
2022-02-08 11:41:04 +01:00
Rechi
561d4b4a47 VS: Fix CMAKE_INSTALL_PREFIX with GENERATOR_PLATFORM for x64 and ARM
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-09-25 13:11:14 -04:00
Brad King
db659e18bc Merge branch 'backport-3.17-automoc-path-prefix-off' 2020-08-10 10:49:18 -04:00
Brad King
e503fbe38a Merge branch 'backport-3.16-automoc-path-prefix-off' 2020-08-10 10:41:06 -04:00
Joerg Bornemann
4c33b305a0 Autogen: Turn off moc path prefix generation by default
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-08-10 10:36:17 -04:00
Brad King
fe19df49d4 Initialize CMAKE_EXPORT_COMPILE_COMMANDS only if not set already
Also de-duplicate its initialization code.

Fixes: #16588
2020-05-12 08:08:20 -04:00
Richard
426941c433 Autogen: Recognize the new Q_NAMESPACE_EXPORT macro in AUTOMOC
Qt 5.14 introduced a new moc keyword `Q_NAMESPACE_EXPORT`.

Qt-Issue: https://bugreports.qt.io/browse/QTBUG-68014
2020-02-26 07:18:44 -05:00
Daan De Meyer
8065a686dd Initialize CMAKE_EXPORT_COMPILE_COMMANDS from envvar of the same name
Fixes: #18386
2019-10-18 14:37:33 -04:00
Sebastian Holtermann
d018d27c10 Autogen: Add moc path prefix generation (AUTOMOC_PATH_PREFIX)
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"
2019-09-16 18:18:48 +02:00
Sebastian Holtermann
b5e895b5d4 Autogen: Add (CMAKE_)AUTOGEN_ORIGIN_DEPENDS support
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-11-03 12:14:40 +01:00
Christian Pfeiffer
cd3e160022 GenericSystem: Remove misspelled flag default
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-23 12:46:08 +01:00
Beren Minor
48f7e2d300
Unhardcode the CMAKE_CONFIGURATION_TYPES values
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.
2018-01-08 21:15:14 +01:00
Sebastian Holtermann
1d7f099d9c Autogen: Add (CMAKE_)AUTOMOC_COMPILER_PREDEFINES 2017-09-29 15:00:47 +02:00
Sebastian Holtermann
786b5be03b Autogen: Define all macro names in CMAKE_AUTOMOC_MACRO_NAMES
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-27 14:13:12 +02:00
Minmin Gong
bc7c94fe13 MSVC: Add support for ARM64 architecture
Visual Studio 15.4 adds support for this architecture.

Fixes: #17213
2017-09-12 09:54:29 -04:00
Brad King
86578eccf2 Simplify CMake per-source license notices
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.
2016-09-27 15:14:44 -04:00
Michael Ensslin
1d3984780d Makefile: Optionally disable target completion messages in build output
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-14 13:57:58 -04:00
Brad King
d560b46f52 CMakeGenericSystem: Recognize Watcom WMake generator as Makefile generator 2015-07-14 13:57:58 -04:00
Kitware Robot
9db3116226 Remove CMake-language block-end command arguments
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-13 14:19:16 -04:00
Kitware Robot
77543bde41 Convert CMake-language commands to lower case
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-08-13 14:19:16 -04:00
Stephen Kelly
db839bec7d Make the CMAKE_EXPORT_COMPILE_COMMANDS option work with Ninja. 2012-06-04 23:42:37 +02:00
David Cole
59bdb879e8 Merge topic 'MakeDefaultInstallComponentNameConfigurable'
b71e731 -add docs for ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}
7ced073 make default install component name configurable
b6fba35 -strip trailing whitespace
2012-05-24 13:37:54 -04:00
Alex Neundorf
7ced0732e8 make default install component name configurable
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-14 22:19:12 +02:00
Alex Neundorf
b6fba35411 -strip trailing whitespace
Alex
2012-05-13 17:38:31 +02:00
Brad King
5af93bb987 VS11: Fix ARM architecture hint typo (#13077) 2012-05-10 07:08:09 -04:00
Minmin Gong
0fa3d09369 VS11: Add ARM architecture generator (#13077) 2012-05-09 09:12:13 -04:00
Stephen Kelly
635bf50c27 Add an option to skip RPATH during installation. 2012-03-05 22:24:57 +01:00
Matej Hribernik
aed92ccea6 Add VisualStudio 9 and 10 generators for Itanium platform 2011-06-20 08:31:13 -04:00
Manuel Klimek
8346a28a0a Only offer the compile command output feature on unix systems 2011-05-16 10:42:10 -04:00
Manuel Klimek
5674844de4 make compile command output optional 2011-04-25 13:27:58 -04:00
David Cole
2f98dac486 Correct CMAKE_INSTALL_PREFIX value for Win64 apps (#9992)
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-09-09 08:32:42 -04:00
Todd Gamblin
2cde67a781 Modules: Fix spelling 'To distributed' -> 'To distribute' 2010-08-09 08:48:31 -04:00
Brad King
e28c16b482 Split GNU compiler information files
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-12-02 09:52:00 -05:00
Brad King
3a666595c9 Convert CMake non-find modules to BSD License
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-09-28 11:46:51 -04:00
Brad King
493f88ce55 ENH: Allow projects to disable per-rule echo lines
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-16 16:55:58 -04:00
Brad King
2f651c2e59 ENH: Allow projects to disable per-rule progress
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-03-16 16:22:19 -04:00
Alexander Neundorf
fe3945bee1 STYLE: this is not necessary anymore for kdevelop, the kdevelop generator
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
2009-01-09 20:18:25 -05:00
Brad King
b8357db11d ENH: Rename SET_PROPERITES command to SET_PROPERTY and give it a more powerful signature. 2008-01-17 15:54:49 -05:00
Alexander Neundorf
c3b42e90ed ENH: add flag so a terminating slash for the link path can be specified (needed by the Digital Mars D compiler)
Alex
2007-08-28 16:19:01 -04:00
Alexander Neundorf
97b57fbaa4 BUG: use CMAKE_HOST_UNIX here instead of UNIX
Alex
2007-08-09 16:47:35 -04:00
Alexander Neundorf
f8261ff9f7 STYLE: change global cmake variable CMAKE_TARGET_SUPPORTS_ONLY_STATIC_LIBS
to the first global cmake property TARGET_SUPPORTS_SHARED_LIBS

Alex
2007-06-26 13:05:27 -04:00
Alexander Neundorf
1383368628 ENH: print a warning if ADD_LIBRARY( SHARED/MODULE ) is used and the target
platform doesn't support shared libraries

Alex
2007-06-21 16:23:54 -04:00