diff options
author | Brad King <brad.king@kitware.com> | 2023-05-19 12:35:05 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2023-05-19 12:35:17 (GMT) |
commit | 9939f606a69c105772091e0c880ab8a8bfe31a97 (patch) | |
tree | 3f820cfe28319b4e04ebb8fdb2d7adff0cbbcc52 /Tests | |
parent | a60ce4e5f46a16c6f21cee003a7ce7762219b743 (diff) | |
parent | d38779df2a03b984901bc310ec7c370d35a09731 (diff) | |
download | CMake-9939f606a69c105772091e0c880ab8a8bfe31a97.zip CMake-9939f606a69c105772091e0c880ab8a8bfe31a97.tar.gz CMake-9939f606a69c105772091e0c880ab8a8bfe31a97.tar.bz2 |
Merge topic 'cxxmodules-private-between-targets'
d38779df2a ci: Enable RunCMake.CXXModules collation cases in clang jobs
69e4525241 Tests/CXXModules: add example for private modules between targets
18f87c87f8 cmCxxModuleMapper: track whether modules are private or not
56f7d6f827 cmCxxModuleMapper: add a structure to represent BMI locations
8207a3a266 cmDyndepCollation: add a query for visibility of an object's modules
e8efcbec8c iwyu: ignore `std::remove_reference` requirements
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !8476
Diffstat (limited to 'Tests')
9 files changed, 40 insertions, 2 deletions
diff --git a/Tests/CMakeLib/testStringAlgorithms.cxx b/Tests/CMakeLib/testStringAlgorithms.cxx index 1bb23df..78442ba 100644 --- a/Tests/CMakeLib/testStringAlgorithms.cxx +++ b/Tests/CMakeLib/testStringAlgorithms.cxx @@ -1,12 +1,11 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ -#include <cmConfigure.h> // IWYU pragma: keep +#include "cmConfigure.h" // IWYU pragma: keep #include <iostream> #include <sstream> #include <string> -#include <type_traits> #include <utility> #include <vector> diff --git a/Tests/RunCMake/CXXModules/RunCMakeTest.cmake b/Tests/RunCMake/CXXModules/RunCMakeTest.cmake index c1129ca..b088724 100644 --- a/Tests/RunCMake/CXXModules/RunCMakeTest.cmake +++ b/Tests/RunCMake/CXXModules/RunCMakeTest.cmake @@ -155,6 +155,9 @@ endif () # Tests which require collation work. if ("collation" IN_LIST CMake_TEST_MODULE_COMPILATION) run_cxx_module_test(public-req-private) + set(RunCMake_CXXModules_NO_TEST 1) + run_cxx_module_test(req-private-other-target) + unset(RunCMake_CXXModules_NO_TEST) endif () # Tests which use named modules in shared libraries. diff --git a/Tests/RunCMake/CXXModules/examples/req-private-other-target-build-result.txt b/Tests/RunCMake/CXXModules/examples/req-private-other-target-build-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/req-private-other-target-build-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CXXModules/examples/req-private-other-target-build-stdout.txt b/Tests/RunCMake/CXXModules/examples/req-private-other-target-build-stdout.txt new file mode 100644 index 0000000..912c2e9 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/req-private-other-target-build-stdout.txt @@ -0,0 +1 @@ +((Ninja generators)?(Unable to use module 'lib.priv' as it is 'PRIVATE' and therefore not accessible outside of its owning target.)) diff --git a/Tests/RunCMake/CXXModules/examples/req-private-other-target-stderr.txt b/Tests/RunCMake/CXXModules/examples/req-private-other-target-stderr.txt new file mode 100644 index 0000000..5e4392a --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/req-private-other-target-stderr.txt @@ -0,0 +1,9 @@ +CMake Warning \(dev\) at CMakeLists.txt:7 \(target_sources\): + CMake's C\+\+ module support is experimental. It is meant only for + experimentation and feedback to CMake developers. +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Warning \(dev\): + C\+\+20 modules support via CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP is + experimental. It is meant only for compiler developers to try. +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/CXXModules/examples/req-private-other-target/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/req-private-other-target/CMakeLists.txt new file mode 100644 index 0000000..910c515 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/req-private-other-target/CMakeLists.txt @@ -0,0 +1,16 @@ +cmake_minimum_required(VERSION 3.26) +project(req_private_other_target CXX) + +include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake") + +add_library(lib) +target_sources(lib + PUBLIC FILE_SET pub TYPE CXX_MODULES FILES lib.cxx + PRIVATE FILE_SET priv TYPE CXX_MODULES FILES priv.cxx +) +target_compile_features(lib PUBLIC cxx_std_20) + +add_executable(exe main.cxx) +target_link_libraries(exe PRIVATE lib) + +add_test(NAME exe COMMAND exe) diff --git a/Tests/RunCMake/CXXModules/examples/req-private-other-target/lib.cxx b/Tests/RunCMake/CXXModules/examples/req-private-other-target/lib.cxx new file mode 100644 index 0000000..066c2e1 --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/req-private-other-target/lib.cxx @@ -0,0 +1 @@ +export module lib; diff --git a/Tests/RunCMake/CXXModules/examples/req-private-other-target/main.cxx b/Tests/RunCMake/CXXModules/examples/req-private-other-target/main.cxx new file mode 100644 index 0000000..08b08ff --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/req-private-other-target/main.cxx @@ -0,0 +1,7 @@ +import lib; +import lib.priv; + +int main(int argc, char const* argv[]) +{ + return 0; +} diff --git a/Tests/RunCMake/CXXModules/examples/req-private-other-target/priv.cxx b/Tests/RunCMake/CXXModules/examples/req-private-other-target/priv.cxx new file mode 100644 index 0000000..a7cad3b --- /dev/null +++ b/Tests/RunCMake/CXXModules/examples/req-private-other-target/priv.cxx @@ -0,0 +1 @@ +export module lib.priv; |