1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-06-26 14:36:42 +08:00

727 Commits

Author SHA1 Message Date
Brad King
d9e4b47432 cmGeneratorTarget: Clarify logic recognizing explicit link interface 2021-07-13 11:53:00 -04:00
Brad King
ff97944806 cmGeneratorTarget: Clarify cmLinkImplItem constructor call 2021-07-13 11:52:59 -04:00
Brad King
8112480921 cmGeneratorTarget: Clarify ExpandLinkItems local variable role 2021-07-13 11:52:58 -04:00
Brad King
33f0505f01 cmGeneratorTarget: Simplify ExpandLinkItems signature 2021-07-13 11:31:16 -04:00
Marc Chevrier
8a93de080c cmGeneratorTarget: Add method for LINKER: prefix translation 2021-07-08 13:48:42 +02:00
Brad King
85fe60ef03 Merge topic 'tll-out-of-dir'
e27a76f131 target_link_libraries: Restore transitive out-of-dir linking

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6285
2021-06-30 07:27:49 -04:00
Brad King
e27a76f131 target_link_libraries: Restore transitive out-of-dir linking
Refactoring in commit 7f506b95a7 (cmGeneratorTarget: Refactor link item
lookup, 2021-05-26, v3.21.0-rc1~103^2~4) accidentally dropped the
persistent lookup scope tracking across multiple items that was added by
commit f0e67da061 (target_link_libraries: Fix out-of-dir linking of a
list of targets, 2020-01-14, v3.17.0-rc1~149^2).  This broke a
transitive out-of-dir linking case not covered by our test suite.
Restore the scope tracking and add a test case.

Fixes: #22363
2021-06-29 16:52:12 -04:00
Brad King
a6b075c3f8 Merge topic 'import-elf'
115ff6a347 cmELF: Include the ELF parsing code unconditionally
5dfa3ddbe5 cmELF: Allow building without system ELF headers
0da1540aaa cmELF: Fix check for TagMipsRldMapRel
e21188df8b cmELF: Open file explicitly in binary mode
70cdb36d25 Merge branch 'upstream-elf' into import-elf
7a0a37ca41 elf 2021-06-23 (f13da247)
18038042ed cmelf: Add script to import the FreeBSD ELF headers

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6240
2021-06-25 07:26:35 -04:00
Alex Richardson
115ff6a347 cmELF: Include the ELF parsing code unconditionally
Now that the ELF definitions are provided on all platforms there is no
need to keep the CMake_USE_ELF_PARSER option.
2021-06-24 10:57:51 -04:00
Isuru Fernando
fe3f846e1b Makefiles: Add support for building Fortran intrinsics
Fixes: #21463
2021-06-24 08:39:47 -04:00
Zack Galbreath
8514ee9b31 HIP: analyze output of hipcc to determine default GPU architecture 2021-06-07 19:25:34 +00:00
Robert Maynard
947dbed0aa HIP: Automatically inject the hip::device runtime target
Any target that might need to link to hip code needs the `hip::device`
target
2021-06-07 19:25:33 +00:00
Robert Maynard
b50bfc8913 HIP: Add language to CMake 2021-06-07 19:25:33 +00:00
Brad King
ed3aad97e3 cmGeneratorTarget: Clear cached link implementation when a source is added
Adding a source file at generate time can cause the linker language or
other settings to change that affect `GetLinkImplementationLibraries`
and friends.
2021-06-04 12:14:04 -04:00
Brad King
3941555d93 target_link_libraries: Place $<TARGET_OBJECTS> before libraries
Linkers always use object files explicitly specified on the command line
regardless of where they appear.  Move them to the front of the list of
linked libraries in so that symbols required by the object files can be
resolved by any library.

Issue: #22149
2021-05-29 09:28:36 -04:00
Brad King
7f506b95a7 cmGeneratorTarget: Refactor link item lookup
Look up items individually so the call sites can do something with the
result besides appending to a vector.
2021-05-28 14:27:38 -04:00
Brad King
96809a8541 cmGeneratorTarget: Give temporary link impl item an explicit name 2021-05-28 14:27:38 -04:00
Brad King
2ae72ef74b Xcode: Enable multi-arch TARGET_OBJECTS genex in [INTERFACE_]LINK_LIBRARIES
This was an oversight in the original implementation.
2021-05-26 15:43:38 -04:00
Kyle Edwards
820d3afb28 Framework: Fix $<TARGET_SONAME_FILE:...> for imported frameworks 2021-05-20 15:00:22 -04:00
Vitaly Stakhovsky
ce97b7909b Source: Remove unnecessary comparisons to nullptr 2021-05-10 11:44:53 -04:00
Brad King
b362c0bb26 Merge topic 'CUDA-device-link'
bb96984ec9 CUDA Device link: Ensure all link options are correctly formatted

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5962
2021-04-01 10:21:11 -04:00
Marc Chevrier
bb96984ec9 CUDA Device link: Ensure all link options are correctly formatted
Fixes: #21994
2021-03-31 12:05:23 +02:00
Kyle Edwards
d34d28e688 Genex: Add TARGET_RUNTIME_DLLS genex
Co-Authored-by: Brad King <brad.king@kitware.com>
2021-02-24 14:55:17 -05:00
Marc Chevrier
b722eea925 Genex: LINK_LANGUAGE respects LINKER_LANGUAGE property
If target property LINKER_LANGUAGE is set, LINK_LANGUAGE generator
expression evaluation must be always successful.

This fix can be helpful to elaborate a solution for issue #21818.
2021-02-23 08:14:14 -05:00
Brad King
e017ba046c AIX: Enable XCOFF editing to replace RPATH on installation
Avoid relinking before installation.
2021-02-03 12:26:58 -05:00
Brad King
d8f3e68ca9 Ninja Multi-Config: Enable relink diagnostic message
We already have a message for the "Ninja" generator, but it applies
to the "Ninja Multi-Config" generator too.
2021-02-03 11:35:31 -05:00
Brad King
b6071c93f5 Rename CMAKE_USE_ELF_PARSER to CMake_USE_ELF_PARSER
We use the `CMake_` prefix for options affecting CMake itself.
2021-02-03 11:35:31 -05:00
Brad King
9b96fbc358 Merge topic 'clang-tidy-fixes'
ef935b17ab clang-tidy: fix `readability-use-anyofallof` warnings
9ac8dbbb94 clang-tidy: fix `readability-simplify-boolean-expr` warnings
ca505718f4 clang-tidy: fix `readability-redundant-string-init` warnings
b3b6ede6a1 clang-tidy: fix `readability-redundant-access-specifiers` warnings
cdfc4e3195 clang-tidy: fix `readability-qualified-auto` warnings
808b17b120 clang-tidy: fix `readability-make-member-function-const` warnings
4470eb5179 clang-tidy: fix `performance-trivially-destructible` warnings
4f396e6528 clang-tidy: fix `performance-no-automatic-move` warnings
...

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5731
2021-01-27 09:52:18 -05:00
Ben Boeckel
cdfc4e3195 clang-tidy: fix readability-qualified-auto warnings 2021-01-27 08:45:45 -05:00
Asit Dhal
64c3857780 OUTPUT_DIRECTORY: Support tgt genex in output artifact vars
Following variables now support target dependent generator expressions.
- CMAKE_RUNTIME_OUTPUT_DIRECTORY
- CMAKE_LIBRARY_OUTPUT_DIRECTORY
- CMAKE_ARCHIVE_OUTPUT_DIRECTORY

Fixes: #18055
2021-01-26 12:13:15 -05:00
Oleksandr Koval
209daa20b2 Code style: add missed explicit 'this->'
CMake uses explicit 'this->' style. Using custom clang-tidy check we can
detect and fix places where 'this->' was missed.
2021-01-05 14:32:36 +02:00
Brad King
20e4db4a66 cmGeneratorTarget: Make GetConfigCommonSourceFiles Xcode-specific
The Xcode generator is the only place left that we do not support
per-config sources.  Make the corresponding helper Xcode-specific to
avoid any other new uses.
2020-12-16 14:04:30 -05:00
Kyle Edwards
dcf9f4d2f7 Ninja Multi-Config: Add support for cross-config custom commands
Co-Author: Brad King <brad.king@kitware.com>
2020-12-15 07:01:21 -05:00
Brad King
7b64b0cd5a cmLocalGenerator: Refactor custom command generator construction
Add support for constructing and using multiple generators for one
custom command.  cmGeneratorTarget contains a code path that needs this
behavior when used with Ninja but not other generators, so use virtual
dispatch through cmLocalGenerator.
2020-12-15 07:00:52 -05:00
Brad King
60d95fe2c2 Merge topic 'correct_ispc_path_computation'
9af93fef11 ISPC: Handle OBJECT sources in different directories
72ae15ebcb ISPC: Ninja properly compute ISPC_HEADER_DIRECTORY location

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5581
2020-12-08 10:17:33 -05:00
Robert Maynard
9af93fef11 ISPC: Handle OBJECT sources in different directories 2020-12-07 09:14:54 -05:00
Brad King
48aac247e9 Compile with explicit language flag when source LANGUAGE property is set
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
2020-12-02 11:39:11 -05:00
Vitaly Stakhovsky
f6e7d5f3a0 Reduce the scope of temporary cmProp variables and other improvements 2020-11-05 11:07:39 -05:00
Brad King
3e36d5e846 cmGeneratorTarget: Refactor custom command dependency evaluation
Previously we only used cmCustomCommandGenerator to evaluate generator
expressions for dependencies.  Use it for command lines too.  It also
collects target references for us, with backtraces.
2020-10-29 09:37:44 -04:00
Brad King
c300355aab Merge topic 'cuda_vs_skip_computation'
dd77dec18d VS: Don't compute CUDA options unless necessary

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5422
2020-10-27 08:20:55 -04:00
Brad King
8d6a0b9364 Merge topic 'cuda_vs_skip_computation' into release-3.19
dd77dec18d VS: Don't compute CUDA options unless necessary
e9109dec36 Merge branch 'ninja-multi-per-config-sources' into release-3.18
7c0de4175b Merge branch 'cmake-E-cat-binary' into release-3.18

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5422
2020-10-27 08:20:54 -04:00
Raul Tambre
dd77dec18d VS: Don't compute CUDA options unless necessary
In the following scenario (with 3.18 policies):
1. A CXX target is created.
2. CUDA language is enabled.

CMake 3.18 introduced CMP0104, which requires CUDA_ARCHITECTURES to be
set.  Because the CXX target was created before CUDA was enabled it
wouldn't have it set.  The Visual Studio generator would however end up
computing CUDA compile options for the CXX target, which would result in
a fatal error due to the policy violation.

There doesn't seem to be a reason to do this for targets that don't
actually use the CUDA language, so we can skip and generate the CXX
target just fine.

Fixes: #21341
2020-10-27 07:29:01 -04:00
Brad King
f87360b781 Merge topic 'per-config-source-TARGET_FILE'
cd33bfcad5 add_custom_command: Properly recognize if sources depend on config

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5410
2020-10-26 10:28:30 -04:00
Deniz Bahadir
cd33bfcad5 add_custom_command: Properly recognize if sources depend on config
Fixes: #21349
2020-10-22 23:03:05 +02:00
Cengizhan Pasaoglu
bd705788f6 Constify some code as suggested by clang-tidy 2020-10-20 00:04:04 +03:00
Kyle Edwards
fd50a75fa0 CMP0115: Require source file extensions to be explicit 2020-10-13 09:46:54 -04:00
Brad King
0090a11a42 cmLocalGenerator: Migrate custom command output lookup from cmMakefile
Since commit 777ceaea94 (cmMakefile: Delay custom command creation,
2019-10-17, v3.17.0-rc1~352^2) we process custom command declarations at
generate time.  Therefore we do not need to look up what source file
holds the custom command producing a given output until generate time.
2020-10-08 12:20:33 -04:00
Brad King
2e8b85b040 Merge topic 'macos-arm64'
b6c60f14b6 macOS: Default to arm64 architecture on Apple Silicon hosts
383e81aa60 Tests: Teach RunCMake to ignore Xcode internal objc warnings
8f75912176 Tests: Enable Assembler test case when CMAKE_OSX_ARCHITECTURES has one value

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5291
2020-10-01 08:45:13 -04:00
Brad King
b6c60f14b6 macOS: Default to arm64 architecture on Apple Silicon hosts
Detect `arm64` hardware using a method that pierces Rosetta.  If
`CMAKE_OSX_ARCHITECTURES` is not set, pass explicit flags to the
toolchain to use `arm64` instead of letting the toolchain pick.

Fixes: #20989
2020-09-30 11:58:44 -04:00
Brad King
ede7a32ef6 Merge topic 'refactor-cmprop'
c88dde2869 cmGeneratorTarget: internal refactoring

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5289
2020-09-29 05:50:45 -04:00