Commit Graph

31472 Commits

Author SHA1 Message Date
Brad King
0906a9b53d Merge branch 'aix-exe-exports' into release-3.22
Merge-request: !7120
2022-03-26 08:36:31 -04:00
Brad King
a8dae21ac1 AIX: Fix executable ENABLE_EXPORTS in Makefile generators
In commit afcd9fe669 (AIX: Add an option to disable automatic exports
from shared libraries, 2020-01-30, v3.17.0-rc1~47^2) the population of
the `<AIX_EXPORTS>` rule variable placeholder was accidentally added to
the device linking rule rather than the main linking rule.  This caused
our `ExportImportList` script on AIX, when called for executables with
`ENABLE_EXPORTS` set, to be given an `AIX_EXPORTS` file name that does
not exist, leading to a warning from the `dump` tool.

Move the population of the `<AIX_EXPORTS>` placeholder in the Makefile
generators to the main link rule.

Issue: #20290
2022-03-26 08:28:59 -04:00
Brad King
6e9eaf209d CMake 3.22.3 2022-03-04 12:06:35 -05:00
Brad King
78ae759e01 CMake 3.21.6 2022-03-04 10:52:43 -05:00
Alex Turbov
da2361ffb3 while: Restore tolerance of condition error
Since commit 880ca66b51 (Fix: `while()` can silently ignore incorrect
condition, 2021-08-09, v3.22.0-rc1~238^2~4) we correctly reject the
code

    set(paren "(")
    while(${paren})
    endwhile()

However, rejecting it breaks compatibility with projects that used such
code accidentally.  In CMake 3.21 and below, any error in the condition
was ignored because the `false` result exited the loop first.  Restore
tolerance of the error for now.  A policy will be needed to make it an
error later.

Note that the same condition with `if` was always correctly rejected.

Fixes: #22524
Issue: #23296
Co-authored-by: Brad King <brad.king@kitware.com>
2022-03-03 16:51:34 -05:00
Eugene Shalygin
83d79636bf install(TARGETS): Restore per-export INCLUDES DESTINATION
In commit 55e4753bbb (Refactor cmTargetExport removing
InterfaceIncludeDirecories, 2021-07-20, v3.22.0-rc1~337^2~1) the storage
of `INCLUDES DESTINATION` was moved into each target.  However, a target
may be installed in multiple exports, and their `INCLUDES DESTINATION`
should not be mixed.

Convert the IncludeDirectoriesEntries vector to a map and modify access
function to store the directories lists with respect to cmExportTarget
object. This fixes error when the same target is exported more than once
via different exports and each for consequent export its include
directories list grows. Add a test for this case.

Fixes: #23183
2022-02-09 13:31:26 -05:00
Brad King
6fe5df13c2 CMake 3.21.5 2022-02-01 10:54:10 -05:00
Brad King
71fa8f5780 Merge topic 'message-flush' into release-3.22
634587e322 message: Restore explicit flushing of messages on stderr

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6913
2022-01-28 09:36:01 -05:00
Brad King
634587e322 message: Restore explicit flushing of messages on stderr
In the `cmake` command-line tool, the `message()` command with no
message mode argument prints the message stderr using the C++ `cerr`
stream.  Since commit 0a0a0f8a74 (cmMessenger: Color messages to
terminal by type, 2021-05-18, v3.21.0-rc1~146^2) and an update by
commit c7a8c9c811 (cmMessenger: Revert to non-color messages on
Windows, 2021-07-20, v3.21.1~15^2), we print the newline at the end of
the message using just `\n`.  We've now observed some cases of output
on stdout and stderr getting jumbled when the two go to the same file
descriptor.  Previously the newline was printed with `endl`, which
implicitly flushes.  Flush explicitly to restore that behavior.

Fixes: #23155
2022-01-27 16:06:35 -05:00
Brad King
5588b538d8 Merge topic 'nmake-rsp-encoding' into release-3.22
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:03 -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
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
80b6b201a6 Merge branch 'IntelLLVM-Fortran-copy-mod' into release-3.21
Merge-request: !6740
2021-11-17 10:42:51 -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