29093 Commits

Author SHA1 Message Date
Brad King
0e1dba36c3 CMake 3.18.6 2021-02-11 09:18:18 -05:00
Brad King
a8b41e2c68 LexerParser: Do not override existing _POSIX_C_SOURCE definition
In commit f034b0f663 (CMake compilation: do not use compiler extensions,
2020-03-14, v3.18.0-rc1~494^2) we explicitly defined `_POSIX_C_SOURCE`
to ensure availability of POSIX APIs even when compiler extensions are
not enabled.  Update the code to avoid redefining `_POSIX_C_SOURCE` if
it is already defined.  This occurs when building our release binaries
as configured in `Utilities/Release/linux`, where we define
`_POSIX_C_SOURCE` explicitly on the compiler command line.
2021-02-05 07:43:59 -05:00
Brad King
6c34835a26 Merge branch 'backport-ninja-no-cleandead' into release-3.18
Merge-request: !5614
2020-12-14 10:22:16 -05:00
Brad King
73a961eaba Ninja: Remove cleandead on regeneration
Remove the `cleandead` tool invocation added by commit fb18215904
(Ninja: clean ninja metadata once generated, 2019-05-13,
v3.17.0-rc1~207^2).  The tool deletes files that were not previously
deleted by regenerating the build system.  Also, there are use cases
where no-longer-generated files should not be removed, such as Qt's TS
files.

Fixes: #21549
2020-12-14 10:08:14 -05:00
Brad King
1a059d91af CMake 3.18.5 2020-11-18 06:34:00 -05:00
Raul Tambre
dd77dec18d VS: Don't compute CUDA options unless necessary
In the following scenario (with 3.18 policies):
1. A CXX target is created.
2. CUDA language is enabled.

CMake 3.18 introduced CMP0104, which requires CUDA_ARCHITECTURES to be
set.  Because the CXX target was created before CUDA was enabled it
wouldn't have it set.  The Visual Studio generator would however end up
computing CUDA compile options for the CXX target, which would result in
a fatal error due to the policy violation.

There doesn't seem to be a reason to do this for targets that don't
actually use the CUDA language, so we can skip and generate the CXX
target just fine.

Fixes: #21341
2020-10-27 07:29:01 -04:00
Brad King
e9109dec36 Merge branch 'ninja-multi-per-config-sources' into release-3.18
Merge-request: !5430
2020-10-26 16:14:00 -04:00
Kyle Edwards
d13bd6ec3d Ninja Multi-Config: Don't try to calculate dependencies for "all" 2020-10-26 15:37:04 -04:00
Johnny Jazeix
f7a5f28318 cmake: Fix '-E cat' command for binary files on Windows
Reset `std::cout` to write in binary mode with no encoding conversions.

Co-Author: Brad King <brad.king@kitware.com>
Fixes: #21295
2020-10-14 12:08:07 -04:00
Brad King
90b39a5209 cmConsoleBuf: Factor out cout/cerr console buffer management 2020-10-14 12:08:06 -04:00
Brad King
f1fdd15863 clang-format: Fix include block order in ctest.cxx and cpack.cxx 2020-10-14 12:06:50 -04:00
Brad King
3cc3d42aba CMake 3.18.4 2020-10-06 08:28:17 -04:00
Kinan Mahdi
8d87cfdbf3 VS: Fix regression in C# source links
Fix logic used since commit ac6b18cd90 (CSharp: Add support for source
groups with out-of-source builds, 2020-02-18, v3.18.0-rc1~645^2).
Add a check of the physical file location for C# source groups.
2020-10-05 12:49:14 -04:00
Brad King
177fc02073 CMake 3.18.3 2020-09-22 08:53:09 -04:00
Brad King
c9bc062632 Merge topic 'foreach-int-parse-range-check' into release-3.18
0412b55b83 foreach: Fix crash parsing integer out of range

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5239
2020-09-21 08:55:29 -04:00
Ben McMorran
0412b55b83 foreach: Fix crash parsing integer out of range 2020-09-18 09:54:58 -04:00
Kyle Edwards
23fe4b861f Ninja Multi-Config: Fix dependencies of custom commands
a9fd3a10 addressed the scenario where the depending target is a
utility target, but not the scenario where the dependent target is
a utility target. Account for this scenario.

Also add a Qt-specific test case.

Fixes: #21118
2020-09-17 15:46:57 -04:00
Brad King
566e96d42d CMake 3.17.5 2020-09-15 08:34:16 -04:00
Josef Angstenberger
aee2c51224 file(GENERATE): Create output file structures for all directories first
Since commit 36ded610af (PCH: Generate sources during Compute step,
2019-10-05, v3.16.0-rc1~2^2) the source file lookup is done earlier than
before.  Its parent commit f1fb63b306 (file(GENERATE): Create output
file structures even earlier, 2019-10-07, v3.16.0-rc1~2^2~1) prepared
for that.  However, that commit did not account for generating and
using files in separate subdirectories.

Fix this by evaluating all generated files before adding automatic
files.

Fixes: #21144
2020-09-10 16:13:01 -04:00
Brad King
9b5f167348 Merge topic 'automoc-rerun-missing-dependency' into release-3.18
9ac3503d30 AutoMoc: Re-run moc if a dependency is missing

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5180
2020-09-10 09:45:52 -04:00
Joerg Bornemann
9ac3503d30 AutoMoc: Re-run moc if a dependency is missing
AutoMoc uses the moc-emitted dependency file of Qt 5.15 to track
dependencies. Such a dependency may well live outside the project and
can vanish, for example when installing a new compiler version.

This situation was detected before, but merely a warning was issued.
Now, we're considering a generated file as out of date if a dependency
is missing and re-generate it.

We also have to remove the missing dependency from the ParseCache.
Otherwise the AUTOMOC target for all generators other than Ninja will
always be out of date.

The ParseCacheChanged flag had to be made atomic, because we're
potentially accessing it from multiple threads. The dependencies vector
itself is not vulnerable in this regard, because there's one vector per
file, and we're accessing exactly one ParseCacheT::FileHandleT per thread.

Fixes: #21136
2020-09-09 12:51:28 +02:00
Cristian Adam
ce7c100545 PCH: Fix 30s wait for VS2008 when used via -Tv90
Fixes: #21142
Backport: release
2020-09-07 19:49:15 +02:00
Kyle Edwards
a9fd3a107d Ninja Multi-Config: Fix dependencies of utility targets
Fixes: #21118
2020-09-02 12:59:59 -04:00
Kyle Edwards
f1199bdc96 Ninja Multi-Config: Fix cleaning of utility targets with commands 2020-09-02 12:59:59 -04:00
Kyle Edwards
657047cd24 Ninja Multi-Config: Fix clean:all target 2020-09-02 12:59:59 -04:00
Brad King
776059ef0f Merge branch 'backport-3.17-automoc-depend-project-file' 2020-08-31 13:10:31 -04:00
Joerg Bornemann
6b20bbd2dd AutoMoc: Restore support for re-running after project file changes
For Qt >= 5.15.0 and Ninja generators AutoMoc creates a depfile to let
Ninja decide when to run AutoMoc.  This was introduced by commit aebfbcaa46
(AutoGen: Use depfiles for the XXX_autogen ninja targets, 2020-01-14,
v3.17.0-rc1~58^2).

However, AutoMoc was not triggered after adding a new moc-able file to
the project. This patch adds the project file (and potentially included
files) to the dependencies in the depfile.

Now, a re-run of AutoMoc is triggered if the project file changes.

Fixes: #21127
2020-08-31 13:07:23 -04:00
Alexandru Croitor
a48bb185c3 AutoGen: Fix moc and uic dependencies when building Qt itself
When building Qt itself, the moc and uic executables are spcecified
via a generator expression of the form $<TARGET_FILE:Qt6::moc>,
which ends populating Moc's and Uic's 'Executable' field but not the
ExecutableTarget and ExecutableTargetName fields.

In such a scenario, the code in
cmQtAutoGenInitializer::InitAutogenTarget fails to add a dependency
on moc (or uic), because ExecutableTarget is null. First try to add
a dependency on the ExecutableTarget if it's not empty, otherwise try
to add a dependency on the path specified in the 'Executable' field.

Issue: #21118
2020-08-25 12:29:23 -04:00
Brad King
aaa5eab410 CMake 3.18.2 2020-08-20 08:20:32 -04:00
Brad King
5c9edd38c6 Merge topic 'osx-archs-apple-only' into release-3.18
70ce1ad64a PCH: Avoid Apple-specific architecture flags on other platforms

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5118
2020-08-11 08:54:15 -04:00
Brad King
70ce1ad64a PCH: Avoid Apple-specific architecture flags on other platforms
Since commit f593b354da (PCH: Add support for multi architecture iOS
projects, 2020-04-02, v3.18.0-rc1~414^2) the `OSX_ARCHITECTURES` target
property (and corresponding `CMAKE_OSX_ARCHITECTURES` variable) affects
flags on non-Apple platforms by accident.  Add a missing condition to
avoid this.

Fixes: #21072
2020-08-10 13:29:29 -04:00
Brad King
97d581b25d Xcode: Explicitly turn off signing in try_compile projects
Fixes: #18407, #20571, #20688
2020-08-10 14:28:38 +02:00
Brad King
13e5df19fd Merge topic 'reuse_pch_no_delay' into release-3.18
ef97fbe6c2 PCH: Avoid unnecessary 30s delay on MSBuild Generator with REUSE_FROM

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5102
2020-08-06 10:39:46 -04:00
Brad King
ab4895d6b2 Merge topic 'automoc_timestamp_deps' into release-3.18
9a9ed4b9d3 Merge branch 'backport-3.17-automoc_timestamp_deps'
7445c9a58a AutoGen: Add test to check for correct AutoMoc dependencies
a79056bb02 AutoGen: Fix over-specified direct dependencies of custom command

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Aleix <aleixpol@kde.org>
Merge-request: !5085
2020-08-06 10:31:23 -04:00
Brad King
ce4216dedd Merge topic 'ninja-multi-rsp-remove-path' into release-3.18
cdb50af2f6 Ninja: Restore shorter path to response files

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: alcroito <alexandru.croitor@qt.io>
Merge-request: !5094
2020-08-06 10:28:27 -04:00
Cristian Adam
ef97fbe6c2 PCH: Avoid unnecessary 30s delay on MSBuild Generator with REUSE_FROM
Fix logic added by commit 1f791eb160 (Multi-Ninja: Fix reusable PCHs for
MSVC, 2020-05-24, v3.18.0-rc1~72^2) to avoid an unnecessary delay.

Fixes: #21054
2020-08-05 15:52:05 -04:00
Brad King
effc9a1032 Merge branch 'backport-3.17-automoc_timestamp_deps' into release-3.17
Merge-request: !5085
2020-08-05 15:44:14 -04:00
Brad King
9a9ed4b9d3 Merge branch 'backport-3.17-automoc_timestamp_deps' 2020-08-05 15:42:39 -04:00
Alexandru Croitor
a79056bb02 AutoGen: Fix over-specified direct dependencies of custom command
The AutoMoc timestamp creating custom command explicitly depended
on all dependencies of the origin target (associated to the AutoGen
target).

When an origin target depended on a shared library 'libfoo.so',
if it was re-linked, the AutoMoc custom command would touch its
output timestamp file, and thus cause needless rebuilding of sources,
despite the shared library not having any influence on the AutoMoc
generated files.

Introduce a new '<target>_autogen_timestamp_deps' utility target,
which will serve as an 'order-only' dependency for the custom command.

This will prevent needless rebuilding, because touching 'libfoo.so'
will not cause the custom command to be re-executed.

The new AutoMoc dependency tree looks like:
    '_autogen_timestamp_deps (serves as order-only dep)'
 <- '<target_autogen>/timestamp' file ( + moc deps file)
 <- '<target>_autogen' target.

Fixes: #21020
2020-08-03 19:38:11 +02:00
Kyle Edwards
cdb50af2f6 Ninja: Restore shorter path to response files
In commit 99ed39b011 (Ninja Multi-Config: Make link response files
per-config, 2020-07-15, v3.17.4~3^2), we added the target directory to
the response file under the mistaken assumption that two different
targets with the same name could be in different directories. However,
this causes the path to the response file to be too long to fit on a
command line.  Take the path back out, while leaving in the per-config
split.

Fixes: #21050
2020-08-03 12:14:16 -04:00
Brad King
63a65baf4c CMake 3.18.1 2020-07-30 12:34:59 -04:00
Brad King
103d6faed9 CMake 3.17.4 2020-07-30 10:30:07 -04:00
Cristian Adam
7051250a6c Unity Builds: Do not set SKIP_AUTOGEN to source files
Fixes: #21028
2020-07-29 17:57:50 +02:00
Brad King
dde97681e9 Merge topic 'revert-add_test-special-chars' into release-3.18
5fc5f4d26e add_test: Revert "Allow special characters in test name"

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5067
2020-07-28 08:24:34 -04:00
Brad King
5fc5f4d26e add_test: Revert "Allow special characters in test name"
Revert commit f84af8e270 (add_test: Allow special characters in test
name, 2020-05-16, v3.18.0-rc1~142^2).  Unfortunately the fix breaks
projects that were working around the limitation with manual escaping.
The fix can be re-introduced with a policy in a future version.

Also add a 3.18.1 release note explaining the change.

Fixes: #21017, #20965
Issue: #19391
2020-07-28 08:04:11 +10:00
Brad King
4b0c4ca3d8 Merge topic 'xcode-12-legacy-deprecation' into release-3.18
36fc3a1e84 Xcode: Suppress legacy build system deprecation warning

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5052
2020-07-27 10:45:14 -04:00
Brad King
e19a62e28b Merge topic 'vs-lang-flags' into release-3.18
c4109a1bc8 VS: Restore toleration of target-wide -TP flag with MSVC

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5051
2020-07-27 10:42:44 -04:00
Brad King
36fc3a1e84 Xcode: Suppress legacy build system deprecation warning
Xcode 12 beta 3 now warns about using the legacy build system.
Since generation of the build system is CMake's responsibility,
the warning is not relevant to our users.  Suppress it.

Issue: #18088
2020-07-23 13:00:42 -04:00
Brad King
c4109a1bc8 VS: Restore toleration of target-wide -TP flag with MSVC
Since commit 3b547e2e4b (VS: Simplify logic adding source file C/C++
language flag to MSVC, 2020-05-15, v3.18.0-rc1~139^2~1) we only add a
per-source language selection flag when the source file extension does
not match the compiler's default.  This approach breaks when a project
adds a target-wide `-TP` flag.

Although such projects likely did not work with non-VS generators, we
did support them before in Visual Studio generators.  Add a special case
to tolerate such flags again.

Fixes: #21005
2020-07-23 10:54:35 -04:00
Brad King
4b1c6f908f Merge topic 'cmake-gui-qt-5.14' into release-3.18
af6cf586f6 cmake-gui: Fix crash when built with Qt 5.14 or later

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5045
2020-07-23 08:20:48 -04:00