summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake
diff options
context:
space:
mode:
authorMatheus Izvekov <mizvekov@gmail.com>2024-01-13 21:02:37 (GMT)
committerMatheus Izvekov <mizvekov@gmail.com>2024-01-14 17:14:26 (GMT)
commitc09f8d27cd8aa9d44993cf39a663ca331017ed75 (patch)
tree029dfdbb09b0414c53b74d34e67e3699bf7a693a /Tests/RunCMake
parent01e3eb91b85b6d9c622998bc9b3e29168ebe0c5a (diff)
downloadCMake-c09f8d27cd8aa9d44993cf39a663ca331017ed75.zip
CMake-c09f8d27cd8aa9d44993cf39a663ca331017ed75.tar.gz
CMake-c09f8d27cd8aa9d44993cf39a663ca331017ed75.tar.bz2
cxxmodules: compute link information for C++ module-consuming targets
Compute link information for all C++ targets which support modules instead of just those which may provide modules, as they may import modules as well. This captures `OBJECT` libraries using modules which otherwise do not have link steps. Fixes: #25592
Diffstat (limited to 'Tests/RunCMake')
-rw-r--r--Tests/RunCMake/CXXModules/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/CXXModules/examples/import-from-object/CMakeLists.txt16
-rw-r--r--Tests/RunCMake/CXXModules/examples/import-from-object/object-a.cxx2
-rw-r--r--Tests/RunCMake/CXXModules/examples/import-from-object/object-b.cxx1
4 files changed, 20 insertions, 0 deletions
diff --git a/Tests/RunCMake/CXXModules/RunCMakeTest.cmake b/Tests/RunCMake/CXXModules/RunCMakeTest.cmake
index abede44..b0571ed 100644
--- a/Tests/RunCMake/CXXModules/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CXXModules/RunCMakeTest.cmake
@@ -180,6 +180,7 @@ if ("named" IN_LIST CMake_TEST_MODULE_COMPILATION)
run_cxx_module_test(non-trivial-collation-order-randomized)
run_cxx_module_test(duplicate)
set(RunCMake_CXXModules_NO_TEST 1)
+ run_cxx_module_test(import-from-object)
run_cxx_module_test(circular)
run_cxx_module_test(try-compile)
run_cxx_module_test(try-run)
diff --git a/Tests/RunCMake/CXXModules/examples/import-from-object/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/import-from-object/CMakeLists.txt
new file mode 100644
index 0000000..e9ec809
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/import-from-object/CMakeLists.txt
@@ -0,0 +1,16 @@
+cmake_minimum_required(VERSION 3.24...3.28)
+project(cxx_modules_import_from_object CXX)
+
+include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake")
+
+set(CMAKE_CXX_STANDARD 20)
+
+add_library(a STATIC)
+target_sources(a
+ PUBLIC
+ FILE_SET CXX_MODULES
+ FILES
+ object-a.cxx)
+
+add_library(b OBJECT object-b.cxx)
+target_link_libraries(b PRIVATE a)
diff --git a/Tests/RunCMake/CXXModules/examples/import-from-object/object-a.cxx b/Tests/RunCMake/CXXModules/examples/import-from-object/object-a.cxx
new file mode 100644
index 0000000..9634a8f
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/import-from-object/object-a.cxx
@@ -0,0 +1,2 @@
+module;
+export module a;
diff --git a/Tests/RunCMake/CXXModules/examples/import-from-object/object-b.cxx b/Tests/RunCMake/CXXModules/examples/import-from-object/object-b.cxx
new file mode 100644
index 0000000..3b2a80c
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/import-from-object/object-b.cxx
@@ -0,0 +1 @@
+import a;