31459 Commits

Author SHA1 Message Date
Brad King
8428e39ed9 CMake 3.22.2 2022-01-25 08:45:06 -05:00
Raul Tambre
ee1396e29e CMP0128: Add flag in OLD mode even when standard matches the default
Commit 4a0485be (cmStandardLevelResolver: Avoid unnecessary flags, fix unset
level logic, 2021-04-29) unintentionally changed the behavior by modifying the
code to match a pre-existing comment. The resulting behavior change however
matches the intentions of CMP0128, so we simply need to guard it.

Fixes #23122.
2022-01-23 23:10:28 +02:00
Brad King
41bebbe50a file: Restore error capture in undocumented READ_ELF mode
Revise the error message added by commit 115ff6a347 (cmELF: Include the
ELF parsing code unconditionally, 2021-06-17, v3.22.0-rc1~557^2) to
honor the `CAPTURE_ERROR` option.  This is needed by the call site in
`BundleUtilities` to suppress errors on non-ELF files.

Fixes: #23074
2022-01-11 12:46:06 -05:00
Brad King
aa6a33fe54 CMake 3.22.1 2021-12-07 10:44:21 -05:00
Brad King
b59f7600c4 HIP: Enable CMAKE_EXPORT_COMPILE_COMMANDS for HIP
Fixes: #22986
2021-12-07 09:34:49 -05:00
Brad King
13a7ae2194 VS: Revert "Add missing label in C# project-build events"
Revert commit b284a21fee (VS: Add missing label in C# project-build
events, 2021-09-03, v3.22.0-rc1~156^2).  The change broke cases using
multiple successful custom commands.  Revert it pending further
investigation into the interaction of the generated script code with
`Microsoft.Common.CurrentVersion.targets`, and whether this is needed
for all managed projects or just C# projects.

Also add a test covering the case that was broken.

Fixes: #22964
Issue: #21440
2021-12-02 18:06:39 -05:00
Brad King
643fc46bdc file(RPATH): Restore tolerance of unknown formats if new RPATH is empty
Since commit 2e1149874d (cmSystemTools: Support multiple binary formats,
2021-06-14, v3.22.0-rc1~575^2) the `file(RPATH_...)` operations fail on
files that are not ELF or XCOFF format.  Previously the RPATH operations
tolerated files of unknown format if the goal was to produce a file with
an empty RPATH.  Restore this tolerance in order to support setting an
empty RPATH on GNU ld scripts.

Fixes: #22963
2021-12-01 12:58:11 -05:00
Brad King
5596cba7dc cmSystemTools: Remove unnecessary mark-as-used casts to void
The `CheckRPath` arguments are always used now.
2021-12-01 12:40:03 -05:00
Christoph Reiter
992e6d7c5d mingw: fix calling convention for strftime()
`strftime` uses `__cdecl` and not `__stdcall`.  This was exposed by
refactoring in commit 26c9fbab46 (MINGW-w64: Fix string(TIMESTAMP) build
on 32bits, 2021-11-16, v3.22.0~1^2).

This fixes a crash creating a timestamp with clang+mingw-w64 targeting x86.

Fixes: #22939
2021-11-30 11:03:33 -05:00
Brad King
5b1ed2a646 try_compile: Do not use CMAKE_BUILD_TYPE or CMAKE_CONFIGURATION_TYPES env vars
Since:

* commit e216b9bbd3 (cmake: Allow CMAKE_BUILD_TYPE to be set by
                     environment variable, 2021-06-29, v3.22.0-rc1~503^2~1)
* commit ef56eefc9b (cmake: Allow CMAKE_CONFIGURATION_TYPES to be set by
                     environment variable, 2021-06-29, v3.22.0-rc1~503^2)

the environment variables are supposed to provide defaults for settings
the user otherwise can control via cache entries.  However, they
accidentally affect `try_compile` projects too, which are supposed to be
programmatically controlled.

Fixes: #22935
2021-11-22 12:50:42 -05:00
Brad King
ff8c3acc0f CMake 3.22.0 2021-11-18 10:51:22 -05:00
Antons Jeļkins
26c9fbab46 MINGW-w64: Fix string(TIMESTAMP) build on 32bits.
Rephrase the string(TIMESTAMP) implementation not to
cause gcc-11 ICE on MSYS2/mingw32.

Fixes: #22916
2021-11-18 09:17:38 -05:00
Antons Jeļkins
f0eae9292b cmTimestamp: Declare component buffer before MinGW-specific code 2021-11-18 09:17:38 -05:00
Brad King
cb39d50e21 Merge topic 'IntelLLVM-Fortran-copy-mod' into release-3.22
209b896f2c IntelLLVM: Enable Fortran module rebuild avoidance in Makefile generators

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6740
2021-11-18 08:59:17 -05:00
Brad King
209b896f2c IntelLLVM: Enable Fortran module rebuild avoidance in Makefile generators
The Makefile generators use an internal `cmake -E cmake_copy_f90_mod`
tool to avoid rebuilding module consumers when the `.mod` content
changes only in a trivial way (e.g. the time it was built).  This is
done with logic specific to each vendor's module file format.  Enable
the "Intel" format support when using the IntelLLVM compiler (ifx) too.

Issue: #22922
2021-11-17 10:41:30 -05:00
Brad King
fed67fa40d CMake 3.22.0-rc3 2021-11-12 09:15:07 -05:00
Raul Tambre
e47dfce75d CMP0128: Enable/disable extensions if standard same as default
This was intended to be part of the initial MR (!6177), but accidentally went
missing when debugging nightly failures on less common systems. Noticed during
!6711 review as the comment about this behaviour didn't match the code.

Documentation for CMP0128 is updated to remove a false case and note the two
cases related to this.

Fixes #22224.
2021-11-11 21:55:04 +02:00
Brad King
95ea17dfd3 Merge topic 'nmc-reuse-from' into release-3.22
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
2021-11-09 07:53:18 -05:00
Brad King
2eb96cbe41 Merge topic 'msvc-pch-reuse-config' into release-3.22
95fa27d94d PCH: Fix REUSE_FROM when Debug and RelWithDebInfo configs differ

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !6712
2021-11-09 07:52:29 -05:00
Brad King
2b9b64269f Merge topic 'vs-framework-version' into release-3.22
d51246c662 VS: Default TargetFrameworkVersion to v4.7.2 for VS 2022
f97f8537f3 VS: Model a default target framework
e40cedddc0 cmVisualStudio10TargetGenerator: Refactor target framework selection
78782cc7dc cmGlobalVisualStudio8Generator: Refactor SetGeneratorPlatform

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6699
2021-11-08 12:38:47 -05:00
Cristian Adam
244550997f PCH: Fixed Ninja Multi-Config and REUSE_FROM for MSVC
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.
2021-11-08 18:16:36 +01:00
Cristian Adam
95fa27d94d PCH: Fix REUSE_FROM when Debug and RelWithDebInfo configs differ
If the Debug configuration contains `/ZI` but the RelWithDebInfo doesn't
then the copy_pdb_idb.cmake script will cause problems due to the fact
that it was common for both configurations but they are incompatible
with each other.
2021-11-08 16:51:18 +01:00
Brad King
d51246c662 VS: Default TargetFrameworkVersion to v4.7.2 for VS 2022
MSBuild defaults to v4.0 but VS 2022 does not install it anymore.
Explicitly specify a newer framework version by default.  Use a
version that VS 2022 installs without selecting a separate component.

Fixes: #22835
2021-11-06 06:08:55 -04:00
Brad King
f97f8537f3 VS: Model a default target framework
Add fields to the VS generator to select a target framework.
Migrate the existing default for VS 12 .NET CF for Windows CE.

Report the values in `CMAKE_VS_*` variables and use them for
the CSharp compiler id project too.

Issue: #22849
2021-11-06 06:08:54 -04:00
Brad King
e40cedddc0 cmVisualStudio10TargetGenerator: Refactor target framework selection
Split the selection from the generation of the resulting element(s).
2021-11-06 06:08:48 -04:00
Brad King
95f44e00cd Ninja Multi-Config: Fix custom command target dependencies in cross-configs
Generator expressions in a non-cross custom command's `COMMAND`
arguments are evaluated in the command config.  Target-level
dependencies implied by `TARGET_FILE` must therefore be cross
dependencies.  This is important to generate proper target-level
dependencies on the cross-config build statements for the target to
which the custom command is attached.

Fixes: #22855
2021-11-04 13:41:16 -04:00
Brad King
a883363935 Ninja Multi-Config: Fix internal cross-config target dependency ordering
In commit 7abc3d61ac (Ninja Multi-Config: Fix issue with framework
dependencies and Autogen, 2020-02-13, v3.17.0-rc2~18^2) the `cmLinkItem`
comparison operator was updated to order identical strings by the
cross-config boolean.  We need to order identical targets that way too
in order to represent both a cross and non-cross dependency on the same
target.

Issue: #22855
2021-11-04 13:41:13 -04:00
Brad King
16e24748c5 Ninja Multi-Config: Fix cross-config custom command dependency tracing
Process `CMAKE_CROSS_CONFIGS` and friends to properly configure the
generator for cross-config behavior before custom command dependency
tracing.
2021-11-04 12:23:35 -04:00
Brad King
6f995f3825 Merge topic 'msvc-cxx-modules-scanDependencies' into release-3.22
9ed1d7bee6 cmScanDepFormat: Accept P1689r4 files with version 1

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Ben Boeckel <ben.boeckel@kitware.com>
Merge-request: !6696
2021-11-04 09:05:39 -04:00
Brad King
78782cc7dc cmGlobalVisualStudio8Generator: Refactor SetGeneratorPlatform
Re-organize the method to make room for additional
`CMAKE_GENERATOR_PLATFORM` processing.
2021-11-03 15:06:25 -04:00
Brad King
9ed1d7bee6 cmScanDepFormat: Accept P1689r4 files with version 1
VS 2022's `cl` 19.30 has a `-scanDependencies` option that produces the
P1689r4 format.  It reports the "version" field with value "1".
2021-11-03 10:50:54 -04:00
Brad King
73b84db62d Ninja: Fix creation of Windows import library directory
Call `EnsureParentDirectoryExists` with our internal representation
of the path, not the representation quoted/encoded for Ninja.

Fixes: #22841
2021-11-03 10:08:48 -04:00
Brad King
bd36735f65 cmNinjaTargetGenerator: Replace "their" with "there" in comment 2021-11-03 10:08:47 -04:00
Ben Boeckel
7d52d48a32 cmCTestRunTest: get the default value from the environment
This only works due to some assumptions about how the `ENVIRONMENT`
property is processed. Comments have been added to notify anyone
modifying the behavior about where to look.

Fixes: #22819
2021-10-29 10:54:02 -04:00
Brad King
28a033cc7d CMake 3.22.0-rc2 2021-10-28 09:46:08 -04:00
Brad King
7b19f55003 Merge topic 'builtin-help-versionadded' into release-3.22
054754359a cmRST: support `versionadded` and `versionchanged` directives

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !6667
2021-10-28 09:09:23 -04:00
Brad King
f65cebf51a CMake 3.21.4 2021-10-27 09:51:39 -04:00
Brad King
964af18dc1 Merge topic 'envmod-support-mod-to-new-variables' into release-3.22
69f95cf1d9 cmCTestRunTest: fix modifying non-existent envvars

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !6663
2021-10-27 09:20:45 -04:00
Ben Boeckel
054754359a cmRST: support versionadded and versionchanged directives
This makes `versionadded` and `versionchanged` directives show up in
`cmake --help-*` output instead of disappearing (and potentially making
empty sections).

Fixes: #22808
2021-10-27 09:15:00 -04:00
Brad King
9eaf0932af cmGlobalVisualStudioVersionedGenerator: Fix repeating SetGeneratorInstance
Fix logic added by commit 8917b8512f
(cmGlobalVisualStudioVersionedGenerator: Allow repeating
SetGeneratorInstance, 2021-10-20) to avoid repeating work.
2021-10-26 14:07:07 -04:00
Ben Boeckel
69f95cf1d9 cmCTestRunTest: fix modifying non-existent envvars
When appending or modifying to a variable that has not been modified
before, the iterator was not valid, but it was used to insert into the
map again. Instead, just use indexing into the map since we know it will
exist by the end of the function anyways.

Fixes: #22796
2021-10-26 12:51:44 -04:00
Brad King
46e9ff5729 Restore honoring CMAKE_GENERATOR_INSTANCE in toolchain file
Revert the changes from commit d5b5c19278 (cmGlobalGenerator:
FindMakeProgram() before CMakeDetermineSystem, 2020-06-15,
v3.19.0-rc1~619^2~3) and commit ef91fb02f3 (cmGlobalGenerator:
FindMakeProgram() at a generator-specific time, 2020-11-23,
v3.19.1~2^2).  We must delay selecting the location of MSBuild until
after an instance of Visual Studio has been selected.

It is now safe to revert the ordering because the motivating use
case (sysroot detection in Platform/Android-Determine) has been
implemented another way.

Fixes: #22782
2021-10-20 13:00:26 -04:00
Brad King
44a86d0b38 cmake_host_system_information: Add undocumented VS_MSBUILD_COMMAND key
When using the Visual Studio generator for VS 10 or above,
offer this key to get the location of the MSBuild command
before the first `project()` or `enable_language()` command
has finished running.

This will be needed only by one of our own modules, so leave it
undocumented for now.
2021-10-20 13:00:25 -04:00
Brad King
6999b87133 cmGlobalVisualStudio10Generator: Add method to find MSBuild early
Add a way to find MSBuild before the main `FindMakeProgram` code path
has executed.
2021-10-20 13:00:25 -04:00
Brad King
7f730464be cmGlobalGenerator: Add method to check if generator is at least VS 10 2021-10-20 13:00:25 -04:00
Brad King
8917b8512f cmGlobalVisualStudioVersionedGenerator: Allow repeating SetGeneratorInstance 2021-10-20 13:00:25 -04:00
Brad King
6511654164 cmGlobalVisualStudio10Generator: Allow subclasses to reset MSBuild search
While at it, convert to inline initialization.
2021-10-20 13:00:25 -04:00
Brad King
263f8c6119 Merge topic 'fix-ifdef-windows' into release-3.22
40e73c5ac4 Source: Fix typo in _WIN32 preprocessor checks

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6631
2021-10-18 09:29:19 -04:00
Brad King
8497701d22 Merge branch 'fix-ifdef-windows' into release-3.21
Merge-request: !6631
2021-10-15 12:14:50 -04:00
Brad King
ad76bedabb Merge branch 'fix-ifdef-windows' into release-3.20
Merge-request: !6631
2021-10-15 12:14:38 -04:00