1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-06-06 06:10:23 +08:00

65 Commits

Author SHA1 Message Date
Brad King
77c7397ab4 Merge branch 'backport-3.31-custom-transitive-properties' 2025-02-23 08:36:56 -05:00
Brad King
8b5af40b34 GenEx: Fix evaluation of LINK_LIBRARIES as custom transitive property
Fix logic from commit b9ee79b8a1 (GenEx: Add support for custom
transitive compile properties, 2024-05-09, v3.30.0-rc1~82^2~1) to more
precisely know when we are computing the link dependency graph.

Issue: #20416
Issue: #26709
2025-02-23 08:30:42 -05:00
Brad King
99fee5720d cmGeneratorExpressionDAGChecker: De-duplicate constructor signature 2025-02-22 08:46:44 -05:00
Kitware Robot
0b96ae1f6a Revise C++ coding style using clang-format with "east const"
Run the `clang-format.bash` script to update all our C and C++ code to a
new style defined by `.clang-format`, now with "east const" enforcement.
Use `clang-format` version 18.

* If you reached this commit for a line in `git blame`, re-run the blame
  operation starting at the parent of this commit to see older history
  for the content.

* See the parent commit for instructions to rebase a change across this
  style transition commit.

Issue: #26123
2025-01-23 13:09:50 -05:00
Brad King
a6b84a438f GenEx: Revert "Limit TARGET_PROPERTY transitive closure optimization"
Revert commit 4a11772618 (GenEx: Limit TARGET_PROPERTY transitive
closure optimization to subgraphs, 2024-05-31, v3.31.0-rc1~114^2).
The change caused substantial performance regressions in some
existing use cases.  Revert it pending further investigation.

Issue: #25728
Fixes: #26457
2025-01-09 11:56:20 -05:00
Michael Herwig
4a11772618 GenEx: Limit TARGET_PROPERTY transitive closure optimization to subgraphs
Fixes: #25728
2024-09-10 13:24:24 +02:00
Brad King
633afa0b2e cmGeneratorExpressionDAGChecker: Make config name available in constructor 2024-05-21 09:22:51 -04:00
Brad King
79a3ae9a0d cmGeneratorExpressionDAGChecker: Simplify transitive property table
Refactor the table of builtin transitive properties to avoid
preprocessor-generated cascading-if blocks with duplicate code.
2024-04-29 17:39:12 -04:00
Brad King
e8010b67c7 cmGeneratorExpressionDAGChecker: Make local generator available in constructor
This is the local generator in the evaluation context, not that of
the current target/property pair.
2024-04-29 17:27:35 -04:00
Brad King
895efd4e7a cmGeneratorExpression: Consolidate recognition of transitive properties 2024-04-12 12:24:05 -04:00
Brad King
50840902ce cmGeneratorExpressionDAGChecker: Simplify finding evaluation graph root 2024-04-09 11:27:16 -04:00
Brad King
304f4c261e cmGeneratorExpressionDAGChecker: Simplify member initialization 2024-04-09 11:27:06 -04:00
Brad King
a585e410c0 cmGeneratorExpressionDAGChecker: Inline initialization in constructor 2024-04-09 11:26:53 -04:00
Brad King
42adf3cba8 Autogen: Evaluate INTERFACE_AUTOMOC_MACRO_NAMES efficiently
In commit c5c3aff1f5 (Autogen: Add INTERFACE_AUTOMOC_MACRO_NAMES target
property, 2023-04-03, v3.27.0-rc1~197^2) we forgot to mark the property
as a usage requirement.  This is needed for efficient evaluation over
the target dependency closure.

Fixes: #25238
2023-09-12 14:02:23 -04:00
Robert Maynard
c42630ee62 cmGeneratorExpressionNode: implement COMPILE_ONLY genex
This generator expression is the inverse of `LINK_ONLY` and only coveys
usage requirements for the purposes of compilation. Its intended use is
to avoid needing to export targets that do not have link usage
requirements (e.g., header-only libraries) when used by another target.

See: #15415
2023-05-04 09:39:06 -04:00
Kyle Edwards
33e27f6ca6 <LANG>_LINKER_LAUNCHER: Allow generator expressions 2023-02-02 11:58:56 -05:00
Marc Chevrier
913ea78d7a Genex LINK_LIBRARY and LINK_GROUP: check supported properties
Refines check for properties supporting these genex.
Enhance error message.

Fixes: #23699
2022-07-06 16:15:43 +02:00
Ben Boeckel
b3b6ede6a1 clang-tidy: fix readability-redundant-access-specifiers warnings 2021-01-27 08:45:45 -05:00
Kitware Robot
bdca8b01d2 Modernize: Use #pragma once in all header files
#pragma once is a widely supported compiler pragma, even though it is
not part of the C++ standard. Many of the issues keeping #pragma once
from being standardized (distributed filesystems, build farms, hard
links, etc.) do not apply to CMake - it is easy to build CMake on a
single machine. CMake also does not install any header files which can
be consumed by other projects (though cmCPluginAPI.h has been
deliberately omitted from this conversion in case anyone is still using
it.) Finally, #pragma once has been required to build CMake since at
least August 2017 (7f29bbe6 enabled server mode unconditionally, which
had been using #pragma once since September 2016 (b13d3e0d)). The fact
that we now require C++11 filters out old compilers, and it is unlikely
that there is a compiler which supports C++11 but does not support
#pragma once.
2020-09-03 09:30:21 -04:00
Marc Chevrier
6491d2503c Genex $<COMPILE_LANGUAGE>: Extend contexts supported
When genex $<TARGET_PROPERTY:...> for properties like INCLUDE_DIRECTORIES
is evaluated as part of add_custom_command or add_custom_target,
genex $<COMPILE_LANGUAGE> and $<COMPLIE_LANG_AND_ID> should be supported.

Fixes: #20926
2020-07-13 16:27:19 +02:00
Marc Chevrier
3fdae5acaa Genex: Add generator expressions $<DEVICE_LINK> and $<HOST_LINK>
These generator expressions can only be used in link options properties.
These expressions return the arguments respectively for device and host link
step, otherwise return an empty string.
2020-04-19 15:04:54 +02:00
Marc Chevrier
38332fc4fa cmGeneratorExpressionDAGChecker: introduce method Top() 2020-04-18 11:29:43 +02:00
Marc Chevrier
461efa7b51 Genex: Add $<LINK_LANGUAGE:...> and $<LINK_LANG_AND_ID:...>
This MR may help to solve issues #19757 and #18008

Fixes: #19965
2020-02-26 16:38:42 +01:00
Kitware Robot
ed98209ddc Revise include order using clang-format-6.0
Run the `clang-format.bash` script to update our C and C++ code to a new
include order `.clang-format`.  Use `clang-format` version 6.0.
2019-10-01 12:26:36 -04:00
Daniel Pfeifer
0467a2f91b PCH: add PRECOMPILE_HEADERS to special properties 2019-08-26 18:16:42 +02:00
Brad King
95d3598e04 cmGeneratorExpressionDAGChecker: Avoid const_cast
Make a member mutable to avoid casting away const of a whole object.
2019-07-19 09:58:12 -04:00
Regina Pfeifer
5a0784ddea clang-tidy: Pass by value 2019-01-22 13:03:04 -05:00
Marc Chevrier
023188ffb4 INTERFACE_POSITION_INDEPENDENT_CODE: add generator expressions support
Fixes: #16532
2018-11-08 14:58:57 +01:00
Marc Chevrier
a71caab46b LINK_DIRECTORIES: Add new properties and commands
These new capabilities enable to manage link directories

Two new properties:
* target properties: LINK_DIRECTORIES and INTERFACE_LINK_DIRECTORIES

One new command
* target_link_directories(): to populate target properties

Fixes: #17215
2018-09-25 23:59:58 +10:00
Brad King
f35be59961 Fix transitive usage requirements through same-name imported targets
If two imported targets in different directories have the same name we
should still be able to propagate transitive usage requirements from
both.  Fix the DAG checker to work with target pointers instead of
target names since the pointers will not be duplicated even if the names
are.

Fixes: #18345
2018-09-10 07:51:44 -04:00
Marc Chevrier
cc9f88af53 LINK_DEPENDS: add support for property INTERFACE_LINK_DEPENDS
Fixes: #17997
2018-06-27 18:38:36 +02:00
Marc Chevrier
c1f5a44b28 LINK_OPTIONS: Add new family of properties
This family enable to manage link flags

Three new properties:
* directory property: LINK_OPTIONS
* target properties: LINK_OPTIONS and INTERFACE_LINK_OPTIONS

Two new commands
* add_link_options(): to populate directory property
* target_link_options(): to populate target properties

Fixes: #16543
2018-06-06 17:22:39 +02:00
Marc Chevrier
4d15046edd Genex: Add $<TARGET_GENEX_EVAL:...> and $<GENEX_EVAL:...>
Fixes: #17884
2018-04-23 11:13:52 +02:00
Daniel Pfeifer
2b4c32c95f clang-format: format all code as Cpp11 2017-08-30 11:07:05 -04:00
Daniel Pfeifer
ca2233e31f IWYU: Mark cmConfigure.h with pragma: keep
Also remove `#include "cmConfigure.h"` from most source files.
2017-08-26 07:41:04 +02:00
Daniel Pfeifer
5962db4389 Use C++11 nullptr 2017-08-24 23:39:47 +02:00
Daniel Pfeifer
1d829c862c Use quotes for non-system includes
Automate with:

git grep -l '#include <cm_' -- Source \
  | xargs sed -i 's/#include <\(cm_.*\)>/#include "\1"/g'

git grep -l '#include <cmsys/' -- Source \
  | xargs sed -i 's/#include <\(cmsys\/.*\)>/#include "\1"/g'

git grep -l '#include <cm[A-Z]' -- Source \
  | xargs sed -i 's/#include <\(cm[A-Z].*\)>/#include "\1"/g'
2017-04-11 22:35:21 +02: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
Daniel Pfeifer
efed6468ed fix a load of include-what-you-use violations 2016-09-03 08:04:56 -04:00
Daniel Pfeifer
3838a0d5fb make sure to include cmConfigure.h before cmStandardIncludes.h 2016-09-03 08:04:22 -04:00
Daniel Pfeifer
1d6909a287 use CM_NULLPTR 2016-06-28 09:02:26 -04:00
Kitware Robot
d9fd2f5402 Revise C++ coding style using clang-format
Run the `Utilities/Scripts/clang-format.bash` script to update
all our C++ code to a new style defined by `.clang-format`.
Use `clang-format` version 3.8.

* If you reached this commit for a line in `git blame`, re-run the blame
  operation starting at the parent of this commit to see older history
  for the content.

* See the parent commit for instructions to rebase a change across this
  style transition commit.
2016-05-16 16:05:19 -04:00
Brad King
0ac18d40c8 Remove //------... horizontal separator comments
Modern editors provide plenty of ways to visually separate functions.
Drop the explicit comments that previously served this purpose.
Use the following command to automate the change:

    $ git ls-files -z -- \
        "*.c" "*.cc" "*.cpp" "*.cxx" "*.h" "*.hh" "*.hpp" "*.hxx" |
      egrep -z -v "^Source/cmCommandArgumentLexer\." |
      egrep -z -v "^Source/cmCommandArgumentParser(\.y|\.cxx|Tokens\.h)" |
      egrep -z -v "^Source/cmDependsJavaLexer\." |
      egrep -z -v "^Source/cmDependsJavaParser(\.y|\.cxx|Tokens\.h)" |
      egrep -z -v "^Source/cmExprLexer\." |
      egrep -z -v "^Source/cmExprParser(\.y|\.cxx|Tokens\.h)" |
      egrep -z -v "^Source/cmFortranLexer\." |
      egrep -z -v "^Source/cmFortranParser(\.y|\.cxx|Tokens\.h)" |
      egrep -z -v "^Source/cmListFileLexer\." |
      egrep -z -v "^Source/cm_sha2" |
      egrep -z -v "^Source/(kwsys|CursesDialog/form)/" |
      egrep -z -v "^Utilities/(KW|cm).*/" |
      xargs -0 sed -i '/^\(\/\/---*\|\/\*---*\*\/\)$/ {d;}'

This avoids modifying third-party sources and generated sources.
2016-05-09 09:41:43 -04:00
Ben Boeckel
a08292059e genex: remove the need for backtraces
Rather than making dummy backtraces and passing them around, just make
backtraces optional.
2014-06-05 12:44:18 -04:00
Stephen Kelly
5412deded1 cmTarget: Transitively evaluate compiler features.
Extend the interface of the target_compile_features command with
PUBLIC and INTERFACE keywords. Populate the INTERFACE_COMPILER_FEATURES
target property if they are set. Consume the INTERFACE_COMPILER_FEATURES
target property from linked dependent targets to determine the final
required compiler features and the compile flag, if needed.

Use the same pattern of origin-debugging which is used for other
build properties.
2014-04-07 18:11:18 +02:00
Stephen Kelly
3676fb4963 cmTarget: Allow transitive evaluation of SOURCES property.
Extend the cmGeneratorExpressionDAGChecker with an interface
returning the name of the top target.  Use that to determine
when there is a DAG violation, as required by the RunCMake.Languages
tests.
2014-04-02 23:14:02 +02:00
Ben Boeckel
270eb96df0 strings: Remove cmStdString references
Casts from std::string -> cmStdString were high on the list of things
taking up time. Avoid such implicit casts across function calls by just
using std::string everywhere.

The comment that the symbol name is too long is no longer relevant since
modern debuggers alias the templates anyways and the size is a
non-issue since the underlying methods are generated since it's
inherited.
2014-03-08 13:05:35 -05:00
Stephen Kelly
6eb3218105 Genex: Fix case of methods in the dag checker. 2014-01-06 18:46:45 +01:00
Stephen Kelly
646c6ec2f9 Genex: Use a preprocessor loop to implement transitive DAG check.
The other infrastructure for transitive property handling is
already using a preprocessor loop.

Implement special backward-compatibility handling of
COMPILE_DEFINITIONS_<CONFIG> using a template switch for the
extra check.
2014-01-06 18:46:45 +01:00
Stephen Kelly
711fb38f72 Genex: List transitive properties and methods as a table, not two lists.
Introduce a new set of macros to select the column.
2014-01-06 18:46:44 +01:00