Commit Graph

11261 Commits

Author SHA1 Message Date
Brad King ca449572ef Merge topic 'cxxmodules-import-std'
429902ebad Clang: support creating a target for imported modules
4617f272b4 MSVC: support `import std`
62a71047bb cmGraphVizWriter: ignore `__cmake_`-prefixed targets
442086c1dc fileapi: ignore `__cmake_`-prefixed targets
ffe74289b3 CMakeDetermineCompilerId: extract C++ standard library impl
15bbd1d9b8 Experimental: add an experimental feature gate for `import std`
f80c60df02 CMakeDetermineCompilerSupport: construct C++ modules targets
19341e2582 ci: enable `import_std23` C++ module tests on MSVC
...

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !9337
2024-04-15 09:56:53 -04:00
Ben Boeckel 15bbd1d9b8 Experimental: add an experimental feature gate for import std 2024-04-12 11:46:39 -04:00
Brad King 1d31a00ee4 Merge topic 'genex-compatible-interface'
c94cfe92eb GenEx: Fix COMPATIBLE_INTERFACE_ evaluation outside usage requirements
061f7a6b97 GenEx: Remove redundant condition in COMPATIBLE_INTERFACE_ evaluation
86f99c5f6d GenEx: Add COMPATIBLE_INTERFACE_ implementation comments
541a788264 Tests: Add COMPATIBLE_INTERFACE_ cases outside usage requirements
5ebcf96170 Tests: Add COMPATIBLE_INTERFACE_ cases for library targets
f4249cf86f Tests: Add COMPATIBLE_INTERFACE_NUMBER_{MAX,MIN} transitive-only cases

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9423
2024-04-12 09:30:45 -04:00
Brad King c94cfe92eb GenEx: Fix COMPATIBLE_INTERFACE_ evaluation outside usage requirements
In commit ff6c401309 (cmTarget: Add interface for compatible numeric
properties, 2013-10-22, v3.0.0-rc1~460^2) the condition

    dagCheckerParent && !dagCheckerParent->EvaluatingLinkLibraries()

was written that way to avoid a nullptr dereference, but is actually
meant to say "is not evaluating link libraries".  That can also be true
when there is no `dagCheckerParent`, such as when evaluating a generator
expression outside of usage requirements, e.g., for `add_custom_target`.
The original commit tried to account for that by duplicating the
implementation in another code path, but that did not work in all cases.

Fix the condition, remove the duplication, and enable tests for the
now-working cases.
2024-04-11 18:35:40 -04:00
Brad King 541a788264 Tests: Add COMPATIBLE_INTERFACE_ cases outside usage requirements 2024-04-11 18:34:19 -04:00
Brad King 5ebcf96170 Tests: Add COMPATIBLE_INTERFACE_ cases for library targets
The transitive (or not) behavior of these properties depends on the
target type.  Add cases for STATIC, OBJECT, and INTERFACE libraries.
2024-04-11 17:02:52 -04:00
Brad King f4249cf86f Tests: Add COMPATIBLE_INTERFACE_NUMBER_{MAX,MIN} transitive-only cases 2024-04-11 16:48:21 -04:00
Ben Boeckel d7e65b6178 Tests/CXXModules: mask C++23 std module targets
These tests mess with the availability of C++ module support. Hide
generation of the utility targets from any compiler detection.
2024-04-11 10:19:44 -04:00
Ben Boeckel 7146cf9248 cmTarget: support the CXX_MODULE_STD property 2024-04-11 10:19:44 -04:00
Ben Boeckel 64548fef16 Tests/CXXModules: test using targets that import std 2024-04-11 10:19:44 -04:00
Ben Boeckel 85e1281e00 Tests/CXXModules: add tests for exporting CXX_MODULE_STD 2024-04-11 10:19:44 -04:00
Ben Boeckel b8cc38f3a2 Tests/CXXModules: add tests that the C++ std targets don't get exported
These targets are purely internal and should never be exported.
2024-04-11 10:19:44 -04:00
Ben Boeckel 16bf12d1e8 Tests/CXXModules; add tests for CXX_MODULE_STD behavior 2024-04-11 10:19:44 -04:00
Ben Boeckel b17e6a52f9 Tests/CXXModules: add tests for genex usage in CXX_MODULE_STD 2024-04-11 10:19:44 -04:00
Ben Boeckel a9ad29403e Tests/CXXModules/vs-without-flags: use C++20
C++23 has complications with `import std` expectations.
2024-04-11 10:19:44 -04:00
Ben Boeckel b8af090c78 Tests/CXXModules: add a test for the CXX_MODULE_STD property 2024-04-11 10:19:43 -04:00
Ben Boeckel bf0b457461 Tests/CXXModules: add test case for import std support 2024-04-11 10:19:43 -04:00
Brad King 652c8c6a9a Merge topic 'restore-pkg-prefix-var'
0e4db17764 CMakePackageConfigHelpers: Restore undocumented PACKAGE_PREFIX_DIR variable

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9420
2024-04-11 10:09:42 -04:00
Brad King 0e4db17764 CMakePackageConfigHelpers: Restore undocumented PACKAGE_PREFIX_DIR variable
Revert commit 6ddf8712cd (CMakePackageConfigHelpers: Use unique variable
name for pkg prefix, 2024-03-30, v3.29.1~8^2).  It regressed existing
projects that rely on the undocumented `PACKAGE_PREFIX_DIR` variable in
package configuration files generated by `CMakePackageConfigHelpers`.

Fixes: #25873
Fixes: #25885
Issue: #25827
2024-04-11 09:23:46 -04:00
Brad King 61234135e1 Merge topic 'GenerateExportHeader-clang-tidy'
461ae86e6f GenerateExportHeader: Suppress clang-tidy warning

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !9418
2024-04-11 08:36:42 -04:00
Brad King fbd1091d8b Merge topic 'compiler-path-normalization'
26e79ed299 Fix regression on reconfigure with unnormalized -DCMAKE_<LANG>_COMPILER=
1d485a8b45 Tests/RunCMake/CompilerChange: Simplify test cases

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Acked-by: Ashay Rane <ashay.r@gmail.com>
Merge-request: !9416
2024-04-11 08:35:35 -04:00
Brad King 540090e010 Merge topic 'FindJasper-imported-target'
c6408577d6 ci: Enable FindJasper test on Fedora
28f4941bc7 ci: Add Jasper to Fedora base image
254358a91b Merge branch 'backport-FindJasper-imported-target'
4ab860c4c7 FindJasper: Fix Jasper::Jasper IMPORTED_CONFIGURATIONS

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9415
2024-04-11 08:34:21 -04:00
Brad King 409bf46562 Merge topic 'cmake_language-test-experimental-feature-query'
8fd089018d Tests/RunCMake/cmake_language: test GET_EXPERIMENTAL_FEATURE_ENABLED
46da8e64b0 cmCMakeLanguageCommand: use `cmExperimental::FeatureByName`
e8582abc6d cmExperimental: add support for getting a feature value from its name

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !9414
2024-04-11 08:33:09 -04:00
ClausKlein 461ae86e6f GenerateExportHeader: Suppress clang-tidy warning
Add `NOLINT` for `unconditional-preprocessor-if` in generated files.
2024-04-10 16:43:48 -04:00
Brad King c6408577d6 ci: Enable FindJasper test on Fedora 2024-04-10 12:21:13 -04:00
Brad King 26e79ed299 Fix regression on reconfigure with unnormalized -DCMAKE_<LANG>_COMPILER=
Since commit 3f2a5971c0 (Modules: CMAKE_*_COMPILER convert path to cmake
path, 2023-12-02, v3.29.0-rc1~292^2) we normalize the path to the
compiler.  Update our logic that checks whether the compiler has changed
to account for path normalization.

Fixes: #25883
Issue: #25456
2024-04-10 12:03:17 -04:00
Brad King 1d485a8b45 Tests/RunCMake/CompilerChange: Simplify test cases 2024-04-10 11:55:30 -04:00
Brad King fbca02163b Merge topic 'swift-fix-submodule-dependencies'
579472d877 Swift: Ninja: Remove module dependency for executables

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9411
2024-04-10 09:41:39 -04:00
Ben Boeckel 8fd089018d Tests/RunCMake/cmake_language: test GET_EXPERIMENTAL_FEATURE_ENABLED 2024-04-10 00:56:44 -04:00
Brad King 24f1e7c524 Merge topic 'nolint-header-sets-and-unity'
773dc0a297 Unity: Suppress clang-tidy include checks
eb66549c7c VERIFY_INTERFACE_HEADER_SETS: Suppress clang-tidy include checks
b0773aa4f6 VERIFY_INTERFACE_HEADER_SETS: Add IWYU pragma as C-style comment

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !9404
2024-04-09 08:49:14 -04:00
Raul Tambre f21dbf8f26 C++26: Fix C++/CUDA/HIP compile feature support
In commit f808d8afb9 (CMake: Support upcoming C++26 language level,
2022-08-19, v3.25.0-rc1~218^2) we forgot some necessary scaffolding.

Fixes: #25819
2024-04-09 11:38:59 +03:00
Brad King c7cbe57e1f Clang: Fix detection of C++26 when targeting MSVC ABI
`_MSVC_LANG` may not be defined higher than C++20, but `__cplusplus` is.
2024-04-09 11:38:51 +03:00
Evan Wilde 579472d877 Swift: Ninja: Remove module dependency for executables
We shouldn't include the swiftmodule in the ninja dependency graph
unless that target emits a swiftmodule.

Fixes: #25869
2024-04-08 18:07:13 -07:00
ClausKlein eb66549c7c VERIFY_INTERFACE_HEADER_SETS: Suppress clang-tidy include checks
`clang-tidy-17` adds include checks similar to IWYU.  Suppress them in
generated code.
2024-04-08 19:15:21 -04:00
ClausKlein b0773aa4f6 VERIFY_INTERFACE_HEADER_SETS: Add IWYU pragma as C-style comment
In commit 6942234bf5 (VERIFY_INTERFACE_HEADER_SETS: Add IWYU pragma:
associated to verification file, 2022-10-07, v3.25.0-rc1~22^2) the
comment was added as a C++-style comment.  The feature works in C too,
so use a C-style comment.
2024-04-08 19:10:10 -04:00
Brad King a3d067ba6b Merge topic 'test-pkg-config-gobject-introspection'
870500a326 Tests: Update RunCMake.FindPkgConfig gobject-introspection expectation

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9405
2024-04-08 18:11:36 -04:00
Brad King 679a57c10e Merge topic 'test-compile-features'
31acc90abe ci: Record expected C and CXX language standard support
c37e279014 Tests/CompileFeatures: Cover c_std_## and cxx_std_## meta-features
58cd9ee03c Tests/CompileFeatures: Factor out headers to compute C and C++ standard levels

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9401
2024-04-08 18:10:58 -04:00
Vladimir Petko 870500a326 Tests: Update RunCMake.FindPkgConfig gobject-introspection expectation
gobject-introspection 1.79+ uses binaries with an arch-specific prefix,
such as `/usr/bin/x86_64-linux-gnu-g-ir-scanner`.

Fixes: #25865
2024-04-08 18:09:59 -04:00
Brad King 4022b969be Merge topic 'lang-std-levels'
80a5a86514 GNU: Fix detection of C++ 11 mode in GCC 4.{4,5,6}
c9cc3dc646 PGI: Fix detection of C++ 14/17 modes
7f05d472a2 NVHPC: Fix detection of C++ 20 mode on NVHPC < 22.7
3587579f34 XL/XLClang: Fix detection of C++ 14 mode on Linux
863cde8c19 Intel: Fix detection of C++ 14/17 modes on Linux/macOS
1e774a86d3 Intel: Fix detection of C++ 17/20 modes on Windows
b9d4db7098 CompilerId: Clarify C and C++ standard level detection
ae18811f2e IntelLLVM: Add C standard flags on Windows
...

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9412
2024-04-08 18:09:36 -04:00
Brad King c2949dbdf8 Merge topic 'ctest-invalid-arg'
304396d13c ctest: Show error on invalid ctest arguments
06cb978c1b Tests: Fix ctest flag typo in RunCMake.GoogleTest

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Acked-by: scivision <michael@scivision.dev>
Merge-request: !9383
2024-04-05 11:55:47 -04:00
Brad King 31acc90abe ci: Record expected C and CXX language standard support
Explicitly enable standard levels in the `CompileFeatures` test that are
expected to work in each job regardless of whether compiler inspection
detects support.
2024-04-05 07:38:58 -04:00
Brad King c37e279014 Tests/CompileFeatures: Cover c_std_## and cxx_std_## meta-features 2024-04-05 07:38:58 -04:00
Brad King 58cd9ee03c Tests/CompileFeatures: Factor out headers to compute C and C++ standard levels 2024-04-05 07:38:56 -04:00
Brad King 80a5a86514 GNU: Fix detection of C++ 11 mode in GCC 4.{4,5,6}
These versions of the compiler have experimental C++11 support and so do
not define `__cplusplus` correctly, but do define a feature macro we can
use to distinguish this mode.
2024-04-05 07:38:14 -04:00
Brad King c9cc3dc646 PGI: Fix detection of C++ 14/17 modes
The PGI compiler is based on EDG.  Share conditions with Intel Classic.
2024-04-05 07:38:06 -04:00
Brad King 7f05d472a2 NVHPC: Fix detection of C++ 20 mode on NVHPC < 22.7
This compiler does not always define `__cplusplus` correctly, but does
define a feature macro that we can use to distinguish this mode.
2024-04-05 07:37:03 -04:00
Brad King 3587579f34 XL/XLClang: Fix detection of C++ 14 mode on Linux
This compiler does not always define `__cplusplus` correctly, but does
define a feature macro that we can use to distinguish this mode.
2024-04-04 17:56:31 -04:00
Brad King 863cde8c19 Intel: Fix detection of C++ 14/17 modes on Linux/macOS
The Intel Classic C++ compiler is based on EDG.  It does not always
define `__cplusplus` correctly, but does define feature macros that we
can use to distinguish these modes.
2024-04-04 17:56:02 -04:00
Brad King 1e774a86d3 Intel: Fix detection of C++ 17/20 modes on Windows
The Intel Classic C++ compiler for Windows does not always define
`_MSVC_LANG` correctly, but does define feature macros that we can use
to distinguish these modes.
2024-04-04 16:48:46 -04:00
Brad King b9d4db7098 CompilerId: Clarify C and C++ standard level detection
Use named constants.  Regularize comparison patterns.
2024-04-04 15:13:17 -04:00