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

613 Commits

Author SHA1 Message Date
Kyle Edwards
78cf427157 RULE_LAUNCH_*: Add support for generator expressions 2023-02-03 11:23:32 -05:00
Brad King
c3210aab46 Merge topic 'lang-linker-launcher-genex'
33e27f6ca6 <LANG>_LINKER_LAUNCHER: Allow generator expressions
84ada0b0c9 <LANG>_COMPILER_LAUNCHER: Expand subset of genexes that can be evaluated

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !8152
2023-02-03 10:00:49 -05:00
Kyle Edwards
84ada0b0c9 <LANG>_COMPILER_LAUNCHER: Expand subset of genexes that can be evaluated 2023-02-02 11:37:30 -05:00
Ben Boeckel
837f7c113a cmCommonTargetGenerator: classify linked target directories by language
These directories are used to direct collators for Fortran and C++
modules to consume dependent module information to properly collate.
However, the consumption of these files merely checks for existence of
the file, not whether they are actually needed anymore.

The problem arises when a target has Fortran or C++ modules at point A,
a build occurs populating this file, and then the target is updated to
no longer have potential modules. The `DependInfo.make` (for
`Makefiles`) or `<LANG>DependInfo.json` (for `Ninja`) files still exist
as they are never guaranteed to be cleaned up. This can introduce stale
information to the build which may cause a false-positive compilation if
a module file happens to still exist and gets found this way.

Instead, query the `linked-target-dirs` using the language in question
and only add the directory if it contains potential sources for modules
coming from the language in question.
2023-01-31 22:34:29 -05:00
Ben Boeckel
245a89d8b6 cmMakefileTargetGenerator: make "target linked info" variable Fortran-specific
This variable is Fortran-specific, so clarify that through its name.
2023-01-31 22:23:36 -05:00
Ben Boeckel
aeb1b2ae3d cmMakefileTargetGenerator: simplify string streaming 2023-01-31 22:23:36 -05:00
Jiri Malak
a6bdf54a5e Watcom: Fix double-quote to be single-quote in response files for wlink
Response files contained double-quote for any response file, but response files for wlink must contains single-quote. This is fix for libraries list response file. Problem for object file list was fixed by MR
!8115
2023-01-26 15:27:53 +01:00
Kyle Edwards
232467eb1c clang-tidy: add <LANG>_CLANG_TIDY_EXPORT_FIXES_DIR property
Fixes: #21362
2022-12-06 10:39:29 -05:00
Felipe Torrezan
b1a3a38e03 Makefiles: Name object response files with .rsp extension
This is more consistent with the Ninja generator, and is necessary
for the IAR linker to recognize the argument as a response file.

Fixes: #24165
2022-11-21 10:29:24 -05:00
Ben Boeckel
887a8874c3 EXPORT_COMPILE_COMMANDS: add output field
Also write for all configurations from multi-config generators.

This field was added in the Clang 5 documentation and not present in the
Clang 4 documentation (sometime between Dec 2016 and Mar 2017 according
to `web.archive.org`).
2022-10-28 13:54:43 -04:00
Thomas Weißschuh
36400e9dc1 COMPILER_LAUNCHER: Add support for generator expressions
Fixes: #23441
2022-08-30 17:26:25 -04:00
Brad King
d94e09ec88 Merge topic 'cpp-named-module-file-sets'
07bc3b07ec gitlab-ci: test C++ modules using GCC
1b2270aa4e ci: add a Docker image to test out C++ modules with GCC
8c5a53096a Tests/RunCMake/CXXModules: add module-using examples
4151547e2f cmGlobalNinjaGenerator: use `cmModuleMapper` implementation
b43bdaff3c cmCxxModuleMapper: implement support for GCC's module map format
02d0f0e752 cmCxxModuleMapper: add source to handle module mapper contents
a046a45aad cmGlobalNinjaGenerator: add a TODO for header units
386465bf83 cmTarget: add support for C++ module fileset types
...

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !7369
2022-06-17 11:35:12 -04:00
Ben Boeckel
386465bf83 cmTarget: add support for C++ module fileset types
C++ modules have two variants which are of importance to CMake:

  - `CXX_MODULES`: interface modules (those using `export module M;`,
    `export module M:part;`, or `module M:internal_part;`)
  - `CXX_MODULE_HEADER_UNITS`: importable header units

Creating C++ modules or partitions are *not* supported in any other
source listing. This is because the source files must be installed (so
their scope matters), but not part of usage requirements (what it means
for a module source to be injected into a consumer is not clear at this
moment). Due to the way `FILE_SET` works with scopes, they are a perfect
fit as long as `INTERFACE` is not allowed (which it is not).
2022-06-16 10:28:34 -04:00
Robert Maynard
6377a43814 CUDA: Support response files with nvcc 2022-06-13 14:56:58 -04:00
Robert Maynard
627ef4c1d0 Provide guidance when trying to use non-enabled language
Fixes #23463
2022-05-04 09:33:35 -04:00
Brad King
67d604a792 Merge topic 'nmake-rsp-encoding'
d5ee6d50ee NMake: Use UTF-8 BOM in response files only with MSVC tooling
cab631c2e2 NMake: Document response file encoding heuristic in a comment

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !6905
2022-01-27 11:05:04 -05:00
Brad King
d5ee6d50ee NMake: Use UTF-8 BOM in response files only with MSVC tooling
Since commit f3f57cc4ed (NMake: Use UTF-8 with BOM if supported by
nmake, 2021-04-22, v3.21.0-rc1~217^2), we add a BOM to response files
to tell MSVC tooling that they are encoded as UTF-8.  However, the
"NMake Makefiles" generator may also be used with non-MSVC toolchains
that do not understand the BOM.  Update the response file encoding
selection heuristic to add the BOM only with MSVC tooling.

Fixes: #23143
2022-01-26 07:57:43 -05:00
Brad King
cab631c2e2 NMake: Document response file encoding heuristic in a comment
Since commit f3f57cc4ed (NMake: Use UTF-8 with BOM if supported by
nmake, 2021-04-22, v3.21.0-rc1~217^2) the encoding of response files is
selected based on the makefile encoding.  In principle these may be
orthogonal, but in practice it is a useful heuristic.  Call out this
heuristic in a comment, and leave a FIXME to do something better.
2022-01-26 07:40:36 -05:00
Brad King
d6993e593d Merge topic 'makefile-CMAKE_EXPORT_COMPILE_COMMANDS-HIP'
b59f7600c4 HIP: Enable CMAKE_EXPORT_COMPILE_COMMANDS for HIP

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6789
2021-12-07 09:54:10 -05:00
Brad King
b59f7600c4 HIP: Enable CMAKE_EXPORT_COMPILE_COMMANDS for HIP
Fixes: #22986
2021-12-07 09:34:49 -05:00
Raul Tambre
4707ecbe6f CUDA: Support CMP0105 on Clang
Add link flags during the "device compile" step.

Enabled the relevant tests. The disable reasons regarding separable compilation
were outdated and the actual failure case was device link flags support.
2021-11-08 21:26:00 +02:00
Raul Tambre
15fde4c420 CUDA: Use local shorthands for variables in Clang device link code
Helps reduce wrapping of lines making code more readable.
2021-11-07 21:28:08 +02:00
Sean McBride
5ba6e8ac59 Source: Replace most calls to sprintf with snprintf 2021-10-25 18:23:13 -04:00
Robert Maynard
61b9764b03 CUDA: Allow both CUDA_SEPARABLE_COMPILATION and CUDA_PTX_COMPILATION
The target properties `CUDA_SEPARABLE_COMPILATION` and `CUDA_PTX_COMPILATION`
now aren't mutually exclusive and can now be used together on the same
target.
2021-10-20 11:18:06 -04:00
Sean McBride
37859e3244 Source: Fix clang -Wimplicit-fallthrough warnings 2021-09-28 10:53:54 -04:00
Marc Chevrier
cc56dc7468 Rename cmProp in cmValue 2021-09-21 17:14:04 +02:00
PigeonF
ccfe1b0b40 IWYU: Add --driver-mode=cl when applicable
We already do this for `clang-tidy`.

Fixes: #16554
2021-09-10 09:53:31 -04:00
Marc Chevrier
5a2a275bb4 Refactor: reduce cmToCStr usage 2021-08-19 10:49:30 +02:00
Marc Chevrier
9e7a0568f6 Merge branch 'backport-3.21-CC-DEPFILE-independent-from-CMAKE_DEPENDS_USE_COMPILER' into CC-DEPFILE-independent-from-CMAKE_DEPENDS_USE_COMPILER 2021-08-01 15:26:21 +02:00
Marc Chevrier
213fec4908 add_custom_command(DEPFILE) independent from CMAKE_DEPENDS_USE_COMPILER
Fixes: #22486
2021-08-01 15:24:16 +02:00
Brad King
6064c70469 Merge topic 'cuda_separable_clang_make'
3975678fcc CUDA/Clang: Simplify --register-link-binaries logic
0b1cea66cd CUDA/Clang: Fix separable compilation in non-root directories with Makefiles

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6400
2021-07-29 08:45:40 -04:00
root
3975678fcc CUDA/Clang: Simplify --register-link-binaries logic
Move the logic for appending cubin afterwards, so the check can simply be
empty().
With the Makefile generator the option is now at the front instead of being
intermixed with the actual bins.
2021-07-29 13:19:37 +03:00
root
0b1cea66cd CUDA/Clang: Fix separable compilation in non-root directories with Makefiles
Seems the relative paths were wrong basically all around such that only
compiling files in the top-level directory would work. I've modified
CudaOnly.SeparateCompilation to cover this.

Fixes #22482.
2021-07-29 13:19:37 +03:00
Isuru Fernando
fe3f846e1b Makefiles: Add support for building Fortran intrinsics
Fixes: #21463
2021-06-24 08:39:47 -04:00
Robert Maynard
b50bfc8913 HIP: Add language to CMake 2021-06-07 19:25:33 +00:00
Brad King
37cda77d16 Merge topic 'fix-compile-db-crash'
316cbbe8d5 Makefiles: Fix CMAKE_EXPORT_COMPILE_COMMANDS crash with custom compile rule

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6173
2021-05-29 09:45:33 -04:00
Brad King
316cbbe8d5 Makefiles: Fix CMAKE_EXPORT_COMPILE_COMMANDS crash with custom compile rule
Extend the fix from commit 67e2130c96 (Makefiles: Fix
CMAKE_EXPORT_COMPILE_COMMANDS crash with custom compile rule,
2020-11-20, v3.19.1~8^2) to work for the `<FLAGS>` placeholder too.
Also fix the test case to actually enable `EXPORT_COMPILE_COMMANDS`
on the test target.

Fixes: #22261
2021-05-28 15:41:38 -04:00
Brad King
8526756b61 cmOutputConverter: Adopt relative path conversion helpers
Move them up from cmLocalGenerator and out of cmStateDirectory.
2021-05-17 10:04:01 -04:00
Brad King
15fa320071 cmLocalGenerator: Factor out relative path conversion helpers
Most calls to `MaybeConvertToRelativePath` use one of our common work
directories (e.g. top of the build tree) as the local path.  Add helpers
for each of the common cases to simplify and clarify call sites.
2021-05-13 12:47:25 -04:00
Brad King
1d1d88d3c8 cmMakefileTargetGenerator: Clarify name of relative path conversion helper 2021-05-13 12:47:25 -04:00
Vitaly Stakhovsky
ce97b7909b Source: Remove unnecessary comparisons to nullptr 2021-05-10 11:44:53 -04:00
Amine Najahi
f3f57cc4ed NMake: Use UTF-8 with BOM if supported by nmake
Fixes: #21792
2021-05-05 10:56:49 -04:00
Brad King
3e7dd39747 cmLocalGenerator: Simplify some GetIncludeFlag call sites
The path style argument is meaningful only with the Ninja generator,
so drop it from call sites in Makefile and Xcode generators.
2021-02-25 13:24:54 -05:00
Brad King
a133a583d4 cmLocalGenerator: Clarify GetIncludeFlags signature
Make the `config` argument non-optional so all callers must be explicit.
Convert the path style argument to an enumeration to make its role clear
at call sites.

The path style argument is implemented by `ConvertToIncludeReference`,
which was introduced with the Ninja generator by commit 5b114c9bee
(Introduce a cmLocalGenerator::ConvertToIncludeReference function,
2011-09-07, v2.8.7~187^2~4).  Its only purpose is to allow the Ninja
generator to use relative paths in `-I` flags.  Add a comment explaining
this role.
2021-02-25 13:24:45 -05:00
Cristian Adam
c450d66daa PCH: Remove restrictions for REUSE_FROM signature for MSVC
Fixes: #20201
2021-02-02 15:03:55 -05:00
Brad King
8d379e7406 Revert "PCH: Remove restrictions for REUSE_FROM signature for MSVC"
This reverts commit 9f060971411aca979807f70307d8b9fe1b43ff24.
It was merged accidentally.
2021-02-02 15:02:08 -05:00
Cristian Adam
9f06097141 PCH: Remove restrictions for REUSE_FROM signature for MSVC
Fixes: #20201
2021-02-02 19:11:44 +01:00
Marc Chevrier
bb64ea5741 Makefiles: ensure transparent switch between dependencies strategies 2021-01-09 11:35:17 +01:00
Brad King
1cbbfbc78f Merge topic 'export-compile-commands-per-target'
a742b5d137 CMAKE_EXPORT_COMPILE_COMMANDS: allow configuration per target

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5651
2021-01-07 08:22:27 -05:00
Shannon Booth
a742b5d137 CMAKE_EXPORT_COMPILE_COMMANDS: allow configuration per target
The new target property `EXPORT_COMPILE_COMMANDS` associated with the
existing global variable can be used to optionally configure targets for
their compile commands to be exported.

Fixes: #19462
2021-01-06 11:51:39 +13:00