summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Tests/RunCMake/CXXModules/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/CXXModules/examples/object-library-stderr.txt4
-rw-r--r--Tests/RunCMake/CXXModules/examples/object-library/CMakeLists.txt22
-rw-r--r--Tests/RunCMake/CXXModules/examples/object-library/importable.cxx6
-rw-r--r--Tests/RunCMake/CXXModules/examples/object-library/main.cxx6
5 files changed, 39 insertions, 0 deletions
diff --git a/Tests/RunCMake/CXXModules/RunCMakeTest.cmake b/Tests/RunCMake/CXXModules/RunCMakeTest.cmake
index 1009ce4..d324ec9 100644
--- a/Tests/RunCMake/CXXModules/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CXXModules/RunCMakeTest.cmake
@@ -142,6 +142,7 @@ string(REPLACE "," ";" CMake_TEST_MODULE_COMPILATION "${CMake_TEST_MODULE_COMPIL
if ("named" IN_LIST CMake_TEST_MODULE_COMPILATION)
run_cxx_module_test(simple)
run_cxx_module_test(library library-static -DBUILD_SHARED_LIBS=OFF)
+ run_cxx_module_test(object-library)
run_cxx_module_test(generated)
run_cxx_module_test(deep-chain)
run_cxx_module_test(duplicate)
diff --git a/Tests/RunCMake/CXXModules/examples/object-library-stderr.txt b/Tests/RunCMake/CXXModules/examples/object-library-stderr.txt
new file mode 100644
index 0000000..4709399
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/object-library-stderr.txt
@@ -0,0 +1,4 @@
+CMake Warning \(dev\) at CMakeLists.txt:[0-9]* \(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.
diff --git a/Tests/RunCMake/CXXModules/examples/object-library/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/object-library/CMakeLists.txt
new file mode 100644
index 0000000..238e30a
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/object-library/CMakeLists.txt
@@ -0,0 +1,22 @@
+cmake_minimum_required(VERSION 3.24)
+project(cxx_modules_objlib CXX)
+
+include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake")
+
+add_library(objlib OBJECT)
+target_sources(objlib
+ PUBLIC
+ FILE_SET CXX_MODULES
+ BASE_DIRS
+ "${CMAKE_CURRENT_SOURCE_DIR}"
+ FILES
+ importable.cxx)
+target_compile_features(objlib PUBLIC cxx_std_20)
+
+add_executable(objmain)
+target_sources(objmain
+ PRIVATE
+ main.cxx)
+target_link_libraries(objmain PRIVATE objlib)
+
+add_test(NAME objmain COMMAND objmain)
diff --git a/Tests/RunCMake/CXXModules/examples/object-library/importable.cxx b/Tests/RunCMake/CXXModules/examples/object-library/importable.cxx
new file mode 100644
index 0000000..607680a
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/object-library/importable.cxx
@@ -0,0 +1,6 @@
+export module importable;
+
+export int from_import()
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/CXXModules/examples/object-library/main.cxx b/Tests/RunCMake/CXXModules/examples/object-library/main.cxx
new file mode 100644
index 0000000..feb38d2
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/object-library/main.cxx
@@ -0,0 +1,6 @@
+import importable;
+
+int main(int argc, char* argv[])
+{
+ return from_import();
+}