summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalGenerator.cxx
Commit message (Collapse)AuthorAgeFilesLines
* Merge topic 'add_visbility_flags_to_device_link_line'Brad King2023-01-181-1/+1
|\ | | | | | | | | | | | | 0c56bdf91e CUDA: device linking obeys CMAKE_CUDA_VISIBILITY_PRESET setting Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !8065
| * CUDA: device linking obeys CMAKE_CUDA_VISIBILITY_PRESET settingRobert Maynard2023-01-161-1/+1
| | | | | | | | Fixes #24272
* | cmValue: Use operator* explicitly to convert to std::string; avoid extra callVitaly Stakhovsky2023-01-161-4/+4
|/
* COMPILE_DEFINITIONS property: ensure leading -D is removed in all casesMarc Chevrier2022-12-131-1/+6
| | | | Fixes: #24186
* Merge topic 'custom-command-comment-genex'Brad King2022-11-221-2/+2
|\ | | | | | | | | | | | | | | | | 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
| * cmCustomCommandGenerator: refactor GetComment to return std::stringPeter Würth2022-11-191-2/+2
| | | | | | | | Refactoring was done because EvaluateComment leaked memory.
* | cmLocalGenerator: Inline AddCompilerRequirementFlag in only call siteBrad King2022-11-181-20/+13
| | | | | | | | | | | | 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.
* | Place language standard flags just after CMAKE_<LANG>_FLAGSBrad King2022-11-181-15/+12
|/ | | | | | | | | | | | | | | | 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
* Merge topic 'cmp0141-pch-reuse'Brad King2022-11-161-2/+4
|\ | | | | | | | | | | | | 94164ea55e CMP0141: Fix PCH REUSE_FROM when MSVC_DEBUG_INFORMATION_FORMAT is empty Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !7914
| * CMP0141: Fix PCH REUSE_FROM when MSVC_DEBUG_INFORMATION_FORMAT is emptyBrad King2022-11-151-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | 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
* | cmGeneratorExpression: Require cmake instanceKyle Edwards2022-11-111-1/+1
|/
* CMP0141: Fix PCH REUSE_FROM under policy NEW behaviorBrad King2022-10-311-6/+16
| | | | | | | | | | | 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
* cmLocalGenerator: Clarify name of local PDB type variableBrad King2022-10-311-3/+2
|
* cmLocalGenerator: Factor out helper to compute MSVC_DEBUG_INFORMATION_FORMATBrad King2022-10-311-16/+26
|
* Merge topic 'Intel-Fortran-warn-errors'Brad King2022-10-101-3/+7
|\ | | | | | | | | | | | | | | | | 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
| * COMPILE_WARNING_AS_ERROR: Fix internal formatting of options tableBrad King2022-10-071-3/+7
| | | | | | | | | | | | | | | | 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.
* | MSVC: Add abstraction for debug information formatGlen Chung2022-09-141-0/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | target_*: Fix cross-directory call backtracesBrad King2022-08-221-1/+2
| | | | | | | | | | | | | | Record the call-site backtrace, not the current backtrace of the target's directory. Fixes: #23873
* | Xcode: don't set SKIP_PRECOMPILE_HEADERS when source has no languageAndrey Filipenkov2022-08-111-1/+3
| | | | | | | | | | | | Resources that should go into "Copy Bundle Resources" build phase are added as source files but don't have an associated language Fixes: #23821
* | CUDA: Add Device LTO support for nvccRobert Maynard2022-07-221-4/+21
|/ | | | Fixes #22200
* cmSystemTools: Fix 'ErrorOccurred' spellingFeRD (Frank Dana)2022-06-131-3/+3
| | | | | | | | 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.
* Ninja: Avoid duplicating /DEF: linker flag with MSVC toolsBrad King2022-05-311-16/+2
| | | | | | | | | | 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
* cmLocalGenerator: Adopt AppendModuleDefinitionFlag methodBrad King2022-05-311-0/+26
| | | | Migrate from `cmCommonTargetGenerator::AddModuleDefinitionFlag`.
* Merge topic 'ignore-werror-command-arg'Brad King2022-05-191-5/+7
|\ | | | | | | | | | | | | 65f7053d6c COMPILE_WARNING_AS_ERROR: Add command-line option Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !7268
| * COMPILE_WARNING_AS_ERROR: Add command-line optionMartin Duffy2022-05-181-5/+7
| | | | | | | | | | | | | | Add command-line option `--compile-no-warning-as-error` to ignore value of `COMPILE_WARNING_AS_ERROR`. Issue: #19085
* | Merge topic 'werror-property'Brad King2022-05-101-0/+9
|\ \ | |/ | | | | | | | | | | | | | | 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
| * COMPILE_WARNING_AS_ERROR: Add options to treat warnings as errorsMartin Duffy2022-05-061-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | Add `COMPILE_WARNING_AS_ERROR` target property and supporting `CMAKE_COMPILE_WARNING_AS_ERROR` variable. `COMPILE_WARNING_AS_ERROR` is initialized by `CMAKE_COMPILE_WARNING_AS_ERROR`. It is a boolean variable. If it is true, it expands to a different flag depending on the compiler such that any warnings at compile will be treated as errors. Supports compiler ids that I could find a relevant flag for.
* | OpenWatcom: Allow specifying the runtime libraryCameron Cawley2022-05-061-0/+32
| | | | | | | | | | | | | | | | Add a `CMAKE_WATCOM_RUNTIME_LIBRARY` variable to control the runtime library selection. Add policy CMP0136 to switch to in place of the old hard-coded default flags. Fixes: #23178
* | Merge topic 'xcode-pch'Brad King2022-04-121-4/+6
|\ \ | |/ |/| | | | | | | | | | | | | 476c6a8910 PCH: Fix Xcode non-pch language exclusion fcf1fcfd0c Tests: Ignore all classes in Xcode internal objc warnings Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !7166
| * PCH: Fix Xcode non-pch language exclusionCristian Adam2022-04-111-4/+6
| | | | | | | | | | | | | | Fix a regression caused by commit bbcdac4e5d (PCH: Fix all-language precompile header support in Xcode, 2021-08-07, v3.22.0-rc1~140^2). Fixes: #23138
| * Merge topic 'nmc-reuse-from' into release-3.22Brad King2021-11-091-3/+3
| |\ | | | | | | | | | | | | | | | | | | | | | 244550997f PCH: Fixed Ninja Multi-Config and REUSE_FROM for MSVC Acked-by: Kitware Robot <kwrobot@kitware.com> Tested-by: buildbot <buildbot@kitware.com> Merge-request: !6713
* | | color: Introduce CMAKE_COLOR_DIAGNOSTICS variableSemyon Kolton2022-03-081-0/+24
| | | | | | | | | | | | | | | | | | | | | Add a variable to control both makefile color messages and compiler color diagnostics. Fixes: #15502
* | | cmExpandListWithBacktrace: add handling of empty elements.Marc Chevrier2022-02-061-2/+2
| | |
* | | Merge topic 'link-interface-direct'Brad King2022-01-311-0/+5
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | f3ad061858 Add usage requirements to update direct link dependencies 193a999cd5 cmTarget: Add INTERFACE_LINK_LIBRARIES_DIRECT{,_EXCLUDE} backtrace storage 22d5427aa6 cmGeneratorTarget: Add LookupLinkItem option to consider own target name f3d2eab36a cmGeneratorTarget: Fix link interface caching of partial results d75ab9d066 cmGeneratorTarget: Clarify CMP0022 logic in ComputeLinkInterfaceLibraries f3e9e03fe0 cmGeneratorTarget: Simplify CMP0022 warning check 216aa14997 cmGeneratorTarget: Return early from ExpandLinkItems with no items 1bc98371d1 Tests: Remove unnecessary policy setting from ObjectLibrary test ... Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !6886
| * | | PCH: Clear link interface cache when adding PCH object to itBrad King2022-01-291-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | On platforms using `CMAKE_LINK_PCH`, the implementation of `PRECOMPILE_HEADERS_REUSE_FROM`, when re-using the PCH from one object library in another, adds a PCH object file to the link interface. Clear any cached link interface to ensure it is used.
* | | | Shorten object name even if still longer than CMAKE_OBJECT_PATH_MAXNick Little2022-01-281-12/+18
|/ / / | | | | | | | | | | | | | | | | | | In some cases the shortened path may end up working in practice, even if it is over CMAKE_OBJECT_PATH_MAX, where the original path does not. If the original path is too long, do the MD5 substitution whenever it makes the path shorter. Retain the warning if it is still too long.
* | | cmCustomCommand: Track main dependency explicitlyNAKAMURA Takumi2021-12-141-20/+8
| | | | | | | | | | | | | | | | | | | | | Store the main dependency as the first entry in the dependency list plus a boolean member indicating its existence. Note that this slightly changes existing behavior: the main dependency was previously the last entry of the dependency list.
* | | cmLocalGenerator: Remove unused IncludePathStyle infrastructureBrad King2021-12-011-6/+3
| | | | | | | | | | | | | | | | | | It is unused since commit c564a3e3ff (Ninja: Always compile sources using absolute paths, 2021-05-19, v3.21.0-rc1~129^2), which left behind a FIXME comment to eventually remove it.
* | | cmLocalGenerator: Simplify Add{Custom,Utility}CommandNAKAMURA Takumi2021-11-181-95/+21
| | |
* | | cmMakefile: Simplify detail:::Add{Custom,Utility}CommandNAKAMURA Takumi2021-11-181-112/+94
| | | | | | | | | | | | | | | | | | | | | | | | | | | Note 1: `detail::AddCustomCommandToTarget()` resets cc, since cc is not moved away. Note 2: In `detail::AddUtilityCommand()`, a few vars are preserved before using. Their refs will be alive in most cases, but cc might be destroyed in the future.
* | | cmCustomCommand: Move constructor arguments to individual settersNAKAMURA Takumi2021-11-181-6/+17
| | | | | | | | | | | | | | | | | | | | | | | | Make `cmCustomCommand` have just only default constructor. Use each setter instead. This follows the builder pattern. Introduce `cc::SetOutputs(std::string output)`. This will be used later, as substitution for `cc::SetOutputs({output})`.
* | | Unity Build: Fix per-config sources in multi-config generatorsBrad King2021-11-111-29/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Single-config generators already support unity builds with per-config sources because they compute sources using `CMAKE_BUILD_TYPE` as the configuration. Each original source is either included in the unity build source, or not. Teach multi-config generators to compute the list of sources for inclusion in unity builds using all configurations. Previously they only used the empty string as the configuration. Each original source may be included in some configurations, but not others. Use preprocessor conditions to guard their inclusion when necessary. Fixes: #22892
* | | cmLocalGenerator: Add dedicated types to hold unity source infoBrad King2021-11-111-36/+53
| | |
* | | cmLocalGenerator: Clarify name of method to write unity source include linesBrad King2021-11-101-5/+7
| | |
* | | cmLocalGenerator: Simplify unity source copy-if-different logicBrad King2021-11-101-13/+8
| | |
* | | cmLocalGenerator: De-duplicate unity source file generationBrad King2021-11-101-40/+32
| | |
* | | Merge topic 'cuda_clang_cmp0105'Brad King2021-11-091-5/+3
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 4707ecbe6f CUDA: Support CMP0105 on Clang 15fde4c420 CUDA: Use local shorthands for variables in Clang device link code cf7e68087d CUDA: Avoid unnecessary allocation and GetLinkLanguage() 5b0693411e CUDA: Ignore USE_WATCOM_QUOTE for device link rules Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !6709
| * | | CUDA: Avoid unnecessary allocation and GetLinkLanguage()Raul Tambre2021-11-071-5/+3
| | | | | | | | | | | | | | | | | | | | There's no reason to allocate the cmNinjaLinkLineDeviceComputer on the heap. We can also assume the link language as CUDA in cmLocalGenerator::GetDeviceLinkFlags().
* | | | Merge topic 'nmc-reuse-from'Brad King2021-11-091-3/+3
|\ \ \ \ | | |_|/ | |/| | | | | | | | | | | | | | | | | | | | | | 244550997f PCH: Fixed Ninja Multi-Config and REUSE_FROM for MSVC Acked-by: Kitware Robot <kwrobot@kitware.com> Tested-by: buildbot <buildbot@kitware.com> Merge-request: !6713
| * | | PCH: Fixed Ninja Multi-Config and REUSE_FROM for MSVCCristian Adam2021-11-081-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The copy_idb_pdb.cmake script would be executed for every configuration for all configurations. Debug would still want to get the RelWithDebInfo files, and the other way around.