Commit Graph

1273 Commits

Author SHA1 Message Date
Russell Greene
37d994294b PCH: Add missing dependency of REUSE_FROM shared compiler PDB
Have the `copy_pdb_idb` script depend on the PCH file so that the shared
compiler PDB is updated when the PCH is rebuilt.

Fixes: #25240
2023-09-11 08:59:20 -04:00
Brad King
cdbb166fbd Merge topic 'unity_c_no_extensions'
7f7c443667 Unity: use C-style comments to work both with C and C++

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !8718
2023-08-16 09:48:02 -04:00
Sylvain Joubert
7f7c443667 Unity: use C-style comments to work both with C and C++
Update the comment added by commit 485256f2d0 (Unity: Suppress
clang-tidy 'bugprone-suspicious-include' warning, 2023-04-27,
v3.27.0-rc1~149^2) to work for C.

Fixes: #25184
2023-08-15 10:23:54 -04:00
Ben Boeckel
b334dc84c3 cmLocalGenerator: always support shortening filenames 2023-08-08 14:25:01 -04:00
Ben Boeckel
ec5f1c489a cmCryptoHash: prefer to cmSystemTools::ComputeStringMD5
The latter call is no longer post-bootstrap only since 596439b1bb
(cmCustomCommandGenerator: Add option to transform depfile, 2020-10-05)
via !5325. Convert callers to just use `cmCryptoHash` directly and
remove the bootstrap guard.
2023-08-08 13:22:13 -04:00
Craig Scott
feca1d51ff Merge topic 'doc-fixups-release-3.27'
78e7ea598d cmLocalGenerator: Fix trivial spelling error in code comment
1285fe27ff Help: Improve formatting and fix wording for ENABLE_EXPORTS
91336d061c Help: Improve formatting and cross-references for DEPENDS_EXPLICIT_ONLY
03208d9e18 Help: Fix indenting within TARGET_RUNTIME_DLLS genex docs

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !8688
2023-08-07 18:10:56 -04:00
Craig Scott
78e7ea598d cmLocalGenerator: Fix trivial spelling error in code comment 2023-08-06 18:23:24 +10:00
Brad King
241ee252ce IWYU: Update for Debian 12 CI job
`include-what-you-use` diagnostics, in practice, are specific to
the environment's compiler and standard library.  Update includes
to satisfy IWYU for our CI job under Debian 12.
2023-07-28 09:14:08 -04:00
Kyle Edwards
7050ac56a1 macOS: Add support for linking against .xcframework folders
Issue: #21752
2023-07-26 17:00:01 -04:00
Marc Chevrier
3c685a578a LINK_OPTIONS: ensure correct dollar escaping
Ensure correct escaping for Ninja and Makefile generators.

Fixes: #25049
2023-07-17 15:55:58 +02:00
Cordell Bloor
f4d28d9e27 HIP: Fix implicit include directory detection under /usr/include
The `CMAKE_<LANG>_IMPLICIT_INCLUDE_DIRECTORIES` are computed using
`try_compile` in `CMAKE_DETERMINE_COMPILER_ABI`, but the implicit
include directories are not known during that `try_compile`.  This can
be a problem when the HIP runtime include path is `/usr/include`,
because the runtime include path is always added to the userDirs and the
compiler automatically includes standard library headers via
`__clang_hip_runtime_wrapper.h`.

Issue: #24562
2023-06-02 11:25:06 -04:00
Marc Chevrier
ad9020a899 Apple Frameworks: honor SYSTEM target property
Fixes: #24109
2023-05-11 10:24:18 +02:00
Marc Chevrier
72faa9a017 CreateRulePlaceholderExpander(): enhance memory management
This method returns now a std::unique_ptr instance rather than a raw pointer.
2023-05-04 19:34:36 +02:00
Marc Chevrier
375e6fdbbe Link step: use linker dependency linker file
Based on work done by @ben.boeckel (!8051)

Fixes: #22217
2023-05-03 17:08:07 +02:00
Marc Chevrier
241304190f CMake code rely on cmList class for CMake lists management (part. 2) 2023-04-29 09:54:31 +02:00
Sylvain Joubert
485256f2d0 Unity: Suppress clang-tidy 'bugprone-suspicious-include' warning
Unity builds intentionally include entire source files.

Fixes: #24857
2023-04-27 12:41:30 -04:00
Marc Chevrier
e08ba229ee CMake code rely on cmList class for CMake lists management (part. 1) 2023-04-24 10:41:10 +02:00
Brad King
43e973eba2 cmGeneratorTarget: Pass language to GetAppleArchs when possible 2023-03-15 10:18:41 -04:00
Brad King
93afe804ce cmGeneratorTarget: Convert GetAppleArchs output argument to return value 2023-03-15 10:11:37 -04:00
Marc Chevrier
ede33f30cf Apple: Handle generation and comsuption of text-based stubs (.tbd files)
Fixes: #24123
2023-03-01 12:23:28 +01:00
Marc Chevrier
fcbd723a50 Enhance support functions
* Avoid duplicate definiitions for IsExecutableWithExports, etc...
* Add helper IsApple()
2023-02-28 14:24:03 +01:00
Brad King
8c61f15cdc Merge topic 'avoid-cmake-cfg-intdir'
2b17b6da6a cmGlobalGenerator: Avoid referencing CMAKE_CFG_INTDIR
f34876561f Tests: Remove or silence instances of ${CMAKE_CFG_INTDIR}
78cf427157 RULE_LAUNCH_*: Add support for generator expressions
cabad8a37f ExternalProject: Always use $<CONFIG> for source files
62e8884d3f CTestTargets: Use $<CONFIG> instead of ${CMAKE_CFG_INTDIR}

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !8169
2023-02-07 09:52:32 -05:00
Kyle Edwards
480b363724 cmCustomCommand: Refactor custom command-specific policy values
Many custom commands are created by CMake itself rather than by
the user. These custom commands should always have their policies
set to NEW, and user-created custom commands should have their
policy values set only from the state snapshot. In addition, we
want to genericize the mechanism of recording a policy at the time
of custom command creation.

Add a CM_FOR_EACH_CUSTOM_COMMAND_POLICY macro to genericize
custom command policies. Use this to define all custom command
policies. Make all such policies NEW instead of WARN by default.
Remove individual policy modifier methods and add a single method
that records relevant values from a cmStateSnapshot. Remove the
no longer needed explicit policy settings from synthesized custom
commands.
2023-02-06 15:04:16 -05:00
Kyle Edwards
78cf427157 RULE_LAUNCH_*: Add support for generator expressions 2023-02-03 11:23:32 -05:00
Brad King
3e7f3e2ca9 Merge topic 'add_visbility_flags_to_device_link_line'
0c56bdf91e CUDA: device linking obeys CMAKE_CUDA_VISIBILITY_PRESET setting

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !8065
2023-01-18 10:52:12 -05:00
Robert Maynard
0c56bdf91e CUDA: device linking obeys CMAKE_CUDA_VISIBILITY_PRESET setting
Fixes #24272
2023-01-16 11:27:13 -05:00
Vitaly Stakhovsky
b3edfcf46e cmValue: Use operator* explicitly to convert to std::string; avoid extra call 2023-01-15 23:39:02 -05:00
Marc Chevrier
7480fa0a5f COMPILE_DEFINITIONS property: ensure leading -D is removed in all cases
Fixes: #24186
2022-12-13 16:54:56 +01:00
Brad King
62172b4ab7 Merge topic 'custom-command-comment-genex'
26d813092b add_custom_{command,target}: add genex support for COMMENT
60a5a39022 cmCustomCommandGenerator: refactor GetComment to return std::string

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !7887
2022-11-22 09:47:59 -05:00
Peter Würth
60a5a39022 cmCustomCommandGenerator: refactor GetComment to return std::string
Refactoring was done because EvaluateComment leaked memory.
2022-11-19 13:32:56 +01:00
Brad King
a1c20b08b4 cmLocalGenerator: Inline AddCompilerRequirementFlag in only call site
The call site in `AddLanguageFlags` is now the "one true place" for
adding language standard flags.  Inline the helper to reduce risk of
adding other call sites later.
2022-11-18 11:44:52 -05:00
Brad King
914571a042 Place language standard flags just after CMAKE_<LANG>_FLAGS
Previously we added the language standard flag near the end of all
options, even after those added by `add_compile_options` and friends.
However, on some compilers such as MSVC, the `-std` flag may reset
defaults for flags that precede it on the command line.  Move the
language standard flag to before all other flags that CMake adds for
other abstractions, and before those added by `add_compile_options`.

`CMAKE_<LANG>_FLAGS` should still precede the language flags though,
because they are meant to be treated as language-wide modifications to
the compiler defaults, similar to `$CC $CFLAGS`.

Fixes: #23860
Fixes: #24170
2022-11-18 11:44:52 -05:00
Brad King
b686b58208 Merge topic 'cmp0141-pch-reuse'
94164ea55e CMP0141: Fix PCH REUSE_FROM when MSVC_DEBUG_INFORMATION_FORMAT is empty

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7914
2022-11-16 08:57:04 -05:00
Brad King
94164ea55e CMP0141: Fix PCH REUSE_FROM when MSVC_DEBUG_INFORMATION_FORMAT is empty
Under the policy's NEW behavior, `[CMAKE_]MSVC_DEBUG_INFORMATION_FORMAT`
may be explicitly set to an empty string to tell CMake not to add any
flags for this abstraction.  In this case, fall back to checking the
language-wide flags as we do in the OLD behavior.

This revises commit 183b9a9eca (CMP0141: Fix PCH REUSE_FROM under policy
NEW behavior, 2022-10-31, v3.25.0-rc3~4^2).

Issue: #24106
2022-11-15 06:57:02 -05:00
Kyle Edwards
09d7f947d6 cmGeneratorExpression: Require cmake instance 2022-11-11 12:29:41 -05:00
Brad King
183b9a9eca CMP0141: Fix PCH REUSE_FROM under policy NEW behavior
Under the CMP0141 NEW behavior added by commit 0e96a20478 (MSVC: Add
abstraction for debug information format, 2022-08-25, v3.25.0-rc1~142^2~1),
the `-Zi` and `-ZI` flags do not appear in `CMAKE_<LANG>_FLAGS_<CONFIG>`
anymore.  Teach the PCH REUSE_FROM implementation to recognize the
`EditAndContinue` and `ProgramDatabase` debug information formats
through the policy's new abstraction.

Fixes: #24106
2022-10-31 12:19:06 -04:00
Brad King
2e65fe92db cmLocalGenerator: Clarify name of local PDB type variable 2022-10-31 12:16:54 -04:00
Brad King
17096aeba8 cmLocalGenerator: Factor out helper to compute MSVC_DEBUG_INFORMATION_FORMAT 2022-10-31 12:16:45 -04:00
Brad King
eebbe36ae6 Merge topic 'Intel-Fortran-warn-errors'
13f3382b1c Intel/IntelLLVM: Fortran has distinct "-Werror"-like flag
ab8a0a106e COMPILE_WARNING_AS_ERROR: Fix internal formatting of options table

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !7758
2022-10-10 09:49:46 -04:00
Brad King
ab8a0a106e COMPILE_WARNING_AS_ERROR: Fix internal formatting of options table
In commit 76a08cd253 (COMPILE_WARNING_AS_ERROR: Add options to treat
warnings as errors, 2022-04-21, v3.24.0-rc1~173^2) we formatted the
options table entries as command-line string fragments.  Since they are
part of the `CMAKE_${lang}_COMPILE_OPTIONS_*` tables, they should be
formatted as `;`-separated lists of compiler options.
2022-10-07 10:05:21 -04:00
Glen Chung
0e96a20478 MSVC: Add abstraction for debug information format
Replace our hard-coded default for `/Zi` with a first-class abstraction
to select the debug information format an enumeration of logical
names.  We've long hesitated to do this because the idea of "debug
information format" touches on related concepts on several platforms.
Avoid that scope creep by simply defining an abstraction that applies
only when targeting the MSVC ABI on Windows.

Removing the old default flag requires a policy because existing
projects may rely on string processing to edit them and choose a
runtime library under the old behavior.  Add policy CMP0141 to
provide compatibility.

Fixes: #10189
2022-09-14 09:12:47 -04:00
Brad King
52c95540b7 target_*: Fix cross-directory call backtraces
Record the call-site backtrace, not the current backtrace of the
target's directory.

Fixes: #23873
2022-08-22 15:29:43 -04:00
Andrey Filipenkov
7b2359ac53 Xcode: don't set SKIP_PRECOMPILE_HEADERS when source has no language
Resources that should go into "Copy Bundle Resources" build phase are added as source files but don't have an associated language

Fixes: #23821
2022-08-11 15:26:30 +03:00
Robert Maynard
96bc59b1ca CUDA: Add Device LTO support for nvcc
Fixes #22200
2022-07-22 10:34:45 -04:00
FeRD (Frank Dana)
98a10290a8 cmSystemTools: Fix 'ErrorOccurred' spelling
Rename the booleans 's_ErrorOccured' and 's_FatalErrorOccured' to
's_ErrorOccurred' and 's_FatalErrorOccurred', respectively.

Rename the getters and setters to 'Get[Fatal]ErrorOccurred' and
'Set[Fatal]ErrorOccurred', and fix all uses across the codebase.
2022-06-13 09:05:24 -04:00
Brad King
6cc417586e Ninja: Avoid duplicating /DEF: linker flag with MSVC tools
In commit 9a0d5a828a (Ninja: add /DEF: flag to linker call, 2012-03-10,
v2.8.8~22^2~7) the logic should have been added to `GetTargetFlags` in
place of the older logic in that method from commit 7cef36c628 (ENH: add
the ability to generate custom commands for a language that is not
supported by an IDE, 2004-10-21, v2.4.0~2655).

Fixes: #23570
2022-05-31 15:40:58 -04:00
Brad King
39dba8a244 cmLocalGenerator: Adopt AppendModuleDefinitionFlag method
Migrate from `cmCommonTargetGenerator::AddModuleDefinitionFlag`.
2022-05-31 15:40:35 -04:00
Brad King
758756d1ba Merge topic 'ignore-werror-command-arg'
65f7053d6c COMPILE_WARNING_AS_ERROR: Add command-line option

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7268
2022-05-19 09:43:53 -04:00
Martin Duffy
65f7053d6c COMPILE_WARNING_AS_ERROR: Add command-line option
Add command-line option `--compile-no-warning-as-error` to ignore value of
`COMPILE_WARNING_AS_ERROR`.

Issue: #19085
2022-05-18 10:30:30 -04:00
Brad King
79b64690d9 Merge topic 'werror-property'
76a08cd253 COMPILE_WARNING_AS_ERROR: Add options to treat warnings as errors

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Acked-by: Michael Hirsch <michael@scivision.dev>
Merge-request: !7187
2022-05-10 10:30:42 -04:00