summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-06-30 13:27:57 (GMT)
committerKitware Robot <kwrobot@kitware.com>2023-06-30 13:28:19 (GMT)
commit67cf379354d0681b4d9fe0e73d38c6fac26715e6 (patch)
treebc71585185e8e31be55def5df51ebb64157cac88 /Tests
parent7952e114668e97c207a6fc210184765f052d033b (diff)
parentb9c99830c5a1e8e339fcca690b3e8fd62c31e61a (diff)
downloadCMake-67cf379354d0681b4d9fe0e73d38c6fac26715e6.zip
CMake-67cf379354d0681b4d9fe0e73d38c6fac26715e6.tar.gz
CMake-67cf379354d0681b4d9fe0e73d38c6fac26715e6.tar.bz2
Merge topic 'vs-cxxmodules-same-src-name' into release-3.27
b9c99830c5 VS: Fix C++ modules in source files with the same name Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !8596
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/CXXModules/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/CXXModules/examples/same-src-name-stderr.txt4
-rw-r--r--Tests/RunCMake/CXXModules/examples/same-src-name/CMakeLists.txt20
-rw-r--r--Tests/RunCMake/CXXModules/examples/same-src-name/a/same.cxx5
-rw-r--r--Tests/RunCMake/CXXModules/examples/same-src-name/b/same.cxx5
-rw-r--r--Tests/RunCMake/CXXModules/examples/same-src-name/main.cxx7
6 files changed, 42 insertions, 0 deletions
diff --git a/Tests/RunCMake/CXXModules/RunCMakeTest.cmake b/Tests/RunCMake/CXXModules/RunCMakeTest.cmake
index 1569f91..ada0c65 100644
--- a/Tests/RunCMake/CXXModules/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CXXModules/RunCMakeTest.cmake
@@ -148,6 +148,7 @@ if ("named" IN_LIST CMake_TEST_MODULE_COMPILATION)
set(RunCMake_CXXModules_NO_TEST 1)
run_cxx_module_test(circular)
unset(RunCMake_CXXModules_NO_TEST)
+ run_cxx_module_test(same-src-name)
run_cxx_module_test(scan_properties)
endif ()
diff --git a/Tests/RunCMake/CXXModules/examples/same-src-name-stderr.txt b/Tests/RunCMake/CXXModules/examples/same-src-name-stderr.txt
new file mode 100644
index 0000000..78bdf2b
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/same-src-name-stderr.txt
@@ -0,0 +1,4 @@
+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.
diff --git a/Tests/RunCMake/CXXModules/examples/same-src-name/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/same-src-name/CMakeLists.txt
new file mode 100644
index 0000000..997bbb1
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/same-src-name/CMakeLists.txt
@@ -0,0 +1,20 @@
+cmake_minimum_required(VERSION 3.27)
+project(cxx_modules_same_src_name CXX)
+
+include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake")
+
+add_executable(same_src_name)
+target_sources(same_src_name
+ PRIVATE
+ main.cxx
+ PRIVATE
+ FILE_SET CXX_MODULES
+ BASE_DIRS
+ "${CMAKE_CURRENT_SOURCE_DIR}"
+ FILES
+ a/same.cxx
+ b/same.cxx
+ )
+target_compile_features(same_src_name PUBLIC cxx_std_20)
+
+add_test(NAME same_src_name COMMAND same_src_name)
diff --git a/Tests/RunCMake/CXXModules/examples/same-src-name/a/same.cxx b/Tests/RunCMake/CXXModules/examples/same-src-name/a/same.cxx
new file mode 100644
index 0000000..8aa79cb
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/same-src-name/a/same.cxx
@@ -0,0 +1,5 @@
+export module a.same;
+export int a_same()
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/CXXModules/examples/same-src-name/b/same.cxx b/Tests/RunCMake/CXXModules/examples/same-src-name/b/same.cxx
new file mode 100644
index 0000000..7aa3703
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/same-src-name/b/same.cxx
@@ -0,0 +1,5 @@
+export module b.same;
+export int b_same()
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/CXXModules/examples/same-src-name/main.cxx b/Tests/RunCMake/CXXModules/examples/same-src-name/main.cxx
new file mode 100644
index 0000000..30f2250
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/same-src-name/main.cxx
@@ -0,0 +1,7 @@
+import a.same;
+import b.same;
+
+int main()
+{
+ return a_same() + b_same();
+}