Commit Graph

4625 Commits

Author SHA1 Message Date
Brad King
97fcd3bd30 CheckCompilerFlag: Revert 'Match the Clang "argument unused" output ...'
Revert commit 5b45a3d0ce (CheckCompilerFlag: Match the Clang "argument
unused" output for all languages, 2023-01-23, v3.26.0-rc1~38^2).  It
broke existing projects that were silently tolerating unrelated unused
arguments in their checks for C and CXX.  For example, using
`CFLAGS=-nostdinc` or `CXXFLAGS=-nostdinc++` causes those flags to be
used when driving the linker as well, and Clang warns they are unused in
that case.

Add a test case covering the now-restored behavior.

Fixes: #24591
2023-03-13 16:18:50 -04:00
Brad King
9c181ad470 Merge topic 'GoogleTest-type-param-suite' into release-3.26
9aa9032266 GoogleTest: Restore suite name for type-parametrized tests

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !8282
2023-03-06 08:53:40 -05:00
Brad King
9aa9032266 GoogleTest: Restore suite name for type-parametrized tests
Fix a regression from commit 073dd1bd81 (GoogleTest: Change format for
typed tests, 2022-02-07, v3.23.0-rc1~4^2) in the suite name detection.

Co-authored-by: Evgeniy Shcherbina <ixsci@pm.me>
Fixes: #24563
2023-03-03 10:38:02 -05:00
Brad King
cb1b95886b Merge topic 'ExternalProject-revert-install' into release-3.26
771387523a ExternalProject: Restore driving install through build system

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Acked-by: Craig Scott <craig.scott@crascit.com>
Reviewed-by: Ben Boeckel <ben.boeckel@kitware.com>
Merge-request: !8279
2023-03-03 09:22:45 -05:00
Brad King
771387523a ExternalProject: Restore driving install through build system
Revert commit 66b5d51f38 (ExternalProject: Install CMake projects
using 'cmake --install', 2022-09-08, v3.25.0-rc1~150^2).
It changed the ExternalProject install step command from:

    cmake --build <dir> --target install --config <cfg>

to:

    cmake --install <dir> --config <cfg>

The latter command no longer runs the external project build system
during the install step.  We could consider using the commands:

    cmake --build <dir> --target all --config <cfg>
    cmake --install <dir> --config <cfg>

as the install step, but if `CMAKE_SKIP_INSTALL_ALL_DEPENDENCY` is
used in the external project, that can change semantics too.

Revert the original change pending further investigation on other ways
to support its motivating use case.  Add a test covering the
previously-regressed use case.

Fixes: #24567
Issue: #23946
2023-03-02 14:28:26 -05:00
scivision
17b47da3d8 Tests: Add test for file(DOWNLOAD) with TLS_VERIFY
Occasionally curl updates introduce errors in https verification.
Add an explicit test for this capability, activated by an undocumented
option that we can use in CI to specify a URL to test.

Co-authored-by: Brad King <brad.king@kitware.com>
Fixes: #24405
Issue: #24147
Issue: #24398
2023-02-10 12:22:00 -05:00
Brad King
7f90210dd6 Merge topic 'stop_parsing_after_first_script_arg' into release-3.26
f9e8a067c2 cmake: Stop parsing after `--` when detecting script mode

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !8186
2023-02-09 09:58:13 -05:00
Robert Maynard
f9e8a067c2 cmake: Stop parsing after -- when detecting script mode
The fix in commit 08aa516880 (cmake: Stop parsing after `--` when
detecting script mode, 2022-12-06, v3.26.0-rc1~216^2) only corrected the
case where `-P -- -P <arg>` occurred and not `-P -- -P -<other>`.

Fixes: #24220
2023-02-08 17:21:10 -05:00
Ben Boeckel
3f1e005067 Tests/RunCMake/CXXModules: declare forwarding as extern "C++"
It is not part of any module, so it needs to be declared as such.
2023-02-03 15:54:11 -05:00
Brad King
5252c88569 try_compile: Record propagated CMake variables in configure log
These provide more detailed information about how the test project was
configured.

Issue: #23200
2023-02-01 09:32:42 -05:00
Brad King
1c4825066b Merge topic 'msvc-showIncludes'
8f82e755f3 Ninja: Fix detection of MSVC showIncludes prefix in Italian
d6e7e4d4a1 Tests: Extend RunCMake.Ninja ShowIncludes cases to cover more languages
9596305c0b Tests: Generalize RunCMake.Ninja ShowIncludes test infrastructure
c6dd4fa21d Tests: Extend RunCMake.Ninja ShowIncludes case with sample path
a9d97492fd Ninja: Record showIncludes detection in configure log

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !8129
2023-01-30 10:23:31 -05:00
Brad King
28ef53b55b Merge topic 'cxxmodules-export-iface-names-test'
f755296f9d Tests/RunCMake/CXXModules: add tests which don't export C++ module properties

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !8126
2023-01-30 10:18:51 -05:00
Brad King
8f82e755f3 Ninja: Fix detection of MSVC showIncludes prefix in Italian
The prefix does not have two colons.  Update our regex.

Fixes: #24357
2023-01-28 07:16:58 -05:00
Brad King
d6e7e4d4a1 Tests: Extend RunCMake.Ninja ShowIncludes cases to cover more languages
Add cases for English, French, German, and Japanese.
2023-01-28 07:16:58 -05:00
Brad King
9596305c0b Tests: Generalize RunCMake.Ninja ShowIncludes test infrastructure
Prepare to add support for more languages.
2023-01-28 06:30:08 -05:00
Brad King
c6dd4fa21d Tests: Extend RunCMake.Ninja ShowIncludes case with sample path
Verify that the prefix is separated from the path.
2023-01-27 10:55:37 -05:00
Ben Boeckel
f755296f9d Tests/RunCMake/CXXModules: add tests which don't export C++ module properties
The existing `export-interfaces-{build,install}` tests were actually
doing this, but make those test exporting the interfaces and copy the
existing tests to tests which explicitly test the "no properties"
condition.
2023-01-26 23:19:44 -05:00
Ross Kilgariff
01c1d81527 Xcode: Inherit Swift flags and compilation conditions
Extend the change from commit dfaf55fbfd (Xcode: add extra
'$(inherited)' entries using InheritBuildSettingAttribute, 2021-05-03,
v3.21.0-rc1~182^2) to cover Swift flags and compilation conditions,
allowing CocoaPods and CMake to interoperate when used in the same
project.
2023-01-25 15:15:03 -05:00
Brad King
e4cdd4206c Merge topic 'test-try_compile-matching'
7db4df2e8c Tests: Match configure log try_compile directories more precisely

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !8114
2023-01-25 11:16:39 -05:00
Brad King
1d6d10cbf6 Merge topic 'isdir_empty'
a1dc38a567 Help: Document behavior of if(EXISTS,IS_DIRECTORY) for empty paths

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !8109
2023-01-25 11:15:46 -05:00
Brad King
3c8a65d3aa Merge topic 'swiftmodule-dependency-tracking'
1730d208b5 Add incremental Swift static lib build test
bf3a8ef6d5 Ninja: Swift: Add dependency edge to swiftmodule file
d0b469b7e0 Ninja: NFC: refactor swift module name computations

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !8084
2023-01-25 11:11:37 -05:00
Brad King
7db4df2e8c Tests: Match configure log try_compile directories more precisely
Do not accept a double-quote in the `try_compile` work directory to
ensure we do not match more than the field value.
2023-01-24 15:25:10 -05:00
scivision
a1dc38a567 Help: Document behavior of if(EXISTS,IS_DIRECTORY) for empty paths
Document and add explicit tests for empty string input:
`if(EXISTS "")` and `if(IS_DIRECTORY "")` are always false.
This avoids need for users to do extra checks due to
CMake non-short-circuit logic as below:

    if("${p}")
      if(EXISTS "${p}")
2023-01-24 14:13:52 -05:00
Ben Boeckel
7abddcab08 Ninja: require Ninja 1.11 for C++ module support
See: https://gitlab.kitware.com/cmake/cmake/-/issues/18355#note_1296721
See: https://github.com/ninja-build/ninja/pull/1937
2023-01-23 12:21:05 -05:00
Ben Boeckel
0512428ad9 Ninja: require Ninja 1.11 for C++ module support
See: https://gitlab.kitware.com/cmake/cmake/-/issues/18355#note_1296721
See: https://github.com/ninja-build/ninja/pull/1937
2023-01-23 10:54:53 -05:00
Brad King
709bc0368f Merge topic 'genex-CONFIG-validate-all'
910ada1a88 Genex: $<CONFIG:> syntax of all entries checked
42e417ad12 GeneratorExpression Tests: Remove duplicate test entry

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !8082
2023-01-23 10:40:53 -05:00
Brad King
f4d604f77f Merge topic 'try_compile-verbose'
faa950a155 try_compile: Run native build tool with verbose output

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !8095
2023-01-23 10:34:37 -05:00
Evan Wilde
1730d208b5 Add incremental Swift static lib build test
Ensure that we're actually trying to rebuild libB when the public
interface for libA changes. Without handling the swiftmodule dependency
edge correctly, we would only get a linker error because libA didn't
have the symbol that libB depended on. With the fix, we get a proper
compiler error because ninja knows to rebuild the intermediate libB
when the public interface of libA changes. This is more actionable.
2023-01-21 10:37:09 -08:00
Robert Maynard
910ada1a88 Genex: $<CONFIG:> syntax of all entries checked
Fixes #24327
2023-01-20 13:30:25 -05:00
Brad King
06c7e88b91 Merge topic 'configure-log'
317aac14ef cmake: Stop pointing users at logs on configure errors
eae1398d09 cmake --system-information: Stop dumping CMake{Output,Error}.log

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !8094
2023-01-20 09:37:08 -05:00
Brad King
1d52007564 Merge topic 'ninja-swift-exported-executables'
4165eb3d0b Ninja: Emit swiftmodule from executable with exports

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !8048
2023-01-20 09:36:00 -05:00
Brad King
526b2db5d3 Merge topic 'print-configure-generate-time'
5f0c5ec49b cmake: Print configure/generate time

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Acked-by: scivision <michael@scivision.dev>
Merge-request: !8083
2023-01-20 09:32:45 -05:00
Brad King
faa950a155 try_compile: Run native build tool with verbose output
Make the compiler command lines visible in the configure log.

Issue: #23200
2023-01-20 09:17:51 -05:00
Evan Wilde
4165eb3d0b Ninja: Emit swiftmodule from executable with exports
This patch adds support for tracking the swiftmodules for executables
exporting symbols.

This fixes a bug in the earlier implementation around emitting the
swiftmodule. Previously, the code would use
`CMAKE_EXE_EXPORTS_Swift_FLAG` to inject the `-emit-module`, and module
path information into the `CMAKE_Swift_LINK_EXECUTABLE` rule. Because
Swift skips the build step and only runs during the link phase, these
flags were injected in `cmNinjaNormalTargetGenerator::ComputeLinkCmd`
instead of `cmLocalGenerator::GetTargetFlags` where it is done normally.

Unfortunately, injecting in `ComputeLinkCmd` didn't do anything because
we have a `linkCmd` so `ComputeLinkCmd` exits early, before the
EXE_EXPORT flags get added to the link command.

Instead of playing with that flag, CMake checks
`CMAKE_Swift_LINK_EXECUTABLE_WITH_EXPORTS` and uses that as the link
rule if it exists and falls back on `CMAKE_Swift_LINK_EXECUTABLE`. I've
defined that variable in terms of `CMAKE_Swift_LINK_EXECUTABLE` with the
necessary additional flags for emitting the swift module instead. This
has the same end effect as the desired behavior, but simplifies things a
bit.

Since we're generating the swiftmodule for executables with exports,
I've also updated the dependency graph to include the swiftmodule as an
output in the build dependency graph if the executable has exports.

Tests updated:
 - RunCMake/NoWorkToDo:
   Ensure that the build graph does not result in unnecessary rebuilds
   with exporting executables.

 - SwiftOnly:
   Ensure that we can consume functions defined in the executable by a
   library getting linked into said executable.
2023-01-19 11:49:24 -08:00
Brad King
317aac14ef cmake: Stop pointing users at logs on configure errors
Since commit 18e1bfbb3c (cmake: On configure error suggest looking at
CMake*.log files, 2013-07-09, v2.8.12~210^2), when configuring a project
fails, we print `See also .../CMake{Output,Error}.log` near the end of
the output.  This was intended to help users find failures in system and
compiler inspection checks, but for normal project errors the messages
may be misleading.  The logs may contain incidental errors that are part
of normal operation and do not need to be addressed by the user.

Since commit f6ed2585e5 (Modules: Record system inspection steps in the
configure log, 2023-01-16), CMake's builtin modules no longer log
information to the old-style `CMake{Output,Error}.log` files anyway,
so stop mentioning them.

Fixes: #22131
Issue: #23200
2023-01-19 13:27:51 -05:00
Brad King
5031934fb0 Merge topic 'configure-log'
f6ed2585e5 Modules: Record system inspection steps in the configure log
0f688386ea Modules: Drop redundant check logging to CMakeOutput.log and CMakeError.log
ecc26f98eb UsewxWidgets: Remove leftover debugging code
874c2e1198 FindQt4: Drop outdated advice to look at CMakeError.log on failure
a80465bcad GHS: Drop debugging message from log
9199449687 CompileFeatures: Warn explicitly when feature detection binary is not found
24ccc8c3c9 CompilerId: Restore logging of failed identifications
95976514f6 Tests: Avoid using CMake{Output,Error}.log files

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !8089
2023-01-19 13:21:36 -05:00
Kyle Edwards
5f0c5ec49b cmake: Print configure/generate time 2023-01-19 09:51:07 -05:00
Brad King
cd87bebe49 Merge topic 'optimize-full-name-function'
a525f5f1bf cmGeneratorTarget: Cache full name components

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !8033
2023-01-19 09:21:18 -05:00
Brad King
f6ed2585e5 Modules: Record system inspection steps in the configure log
Replace old-style `file(APPEND .../CMake{Output,Error}.log)` logging
with calls to `message(CONFIGURE_LOG)` to record the steps in the
`CMakeConfigureLog.yaml` configure log instead.

Issue: #23200
2023-01-18 17:59:10 -05:00
Brad King
95976514f6 Tests: Avoid using CMake{Output,Error}.log files
These log files will soon go away, so avoid using them in tests.
2023-01-18 16:40:19 -05:00
Kitware Robot
33abef7416 Revise C++ coding style using clang-format-15
Run the `clang-format.bash` script to update all our C and C++ code to a
new style defined by `.clang-format`.  Use `clang-format` version 15.

* If you reached this commit for a line in `git blame`, re-run the blame
  operation starting at the parent of this commit to see older history
  for the content.

* See the parent commit for instructions to rebase a change across this
  style transition commit.

Fixes: #24315
2023-01-18 16:20:47 -05:00
Brad King
20bbd5f3d3 Merge topic 'configure-log'
a78cba5197 message: Add CONFIGURE_LOG mode to record a message in the configure log
645671d36f Help: Document configure log behavior in try_compile and try_run

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !8080
2023-01-18 12:43:19 -05:00
Brad King
48639aa8fc clang-format.bash: Use generic clang-format attribute
Specify the clang-format version in the attribute value instead of its
name.

Issue: #24315
2023-01-18 11:48:49 -05:00
Brad King
a78cba5197 message: Add CONFIGURE_LOG mode to record a message in the configure log
Provide a replacement for `file(APPEND .../CMake{Output,Error}.log)`
that records messages in the configure log.

Issue: #23200
2023-01-18 11:37:11 -05:00
Pierre Testart
a525f5f1bf cmGeneratorTarget: Cache full name components
Cache the result of cmGeneratorTarget::GetFullNameInternalComponents
to improve performance.
2023-01-18 09:12:17 -05:00
Robert Maynard
42e417ad12 GeneratorExpression Tests: Remove duplicate test entry 2023-01-17 13:25:06 -05:00
Brad King
45f86b9990 Merge topic 'configure-log'
48292c8624 try_compile: Record stack of in-progess checks in configure log
d4bf7d80c6 try_compile: Add a NO_LOG option to skip recording in the configure log
9d9e8450a8 try_compile: Add optional LOG_DESCRIPTION to record in configure log
65ed5c2ca8 try_compile: Report underlying error when COPY_FILE fails
0418efb7ad Tests: Add explicit ConfigureLog case to RunCMake.try_compile
189557bd74 cmake: Make entire in-progress check stack available internally
96ce3581ab Help: Clarify backtrace order in cmake-configure-log(7)

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !8072
2023-01-17 09:26:50 -05:00
Brad King
dd18be5ebf Merge topic 'ctest-no-tests-action-env-var'
0661de58d8 ctest(1): Add CTEST_NO_TESTS_ACTION env var

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !8044
2023-01-17 09:18:04 -05:00
Brad King
48292c8624 try_compile: Record stack of in-progess checks in configure log
Many `try_compile` and `try_run` calls occur inside check modules
between `message(CHECK_START)` and `message(CHECK_{PASS,FAIL})` pairs.
Add a field to configure log entries to report this context.

Issue: #23200
2023-01-16 17:18:07 -05:00
Brad King
d4bf7d80c6 try_compile: Add a NO_LOG option to skip recording in the configure log 2023-01-16 17:16:12 -05:00