summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2024-02-15 17:54:55 (GMT)
committerBrad King <brad.king@kitware.com>2024-02-15 17:55:28 (GMT)
commitc8da7b0f5c183d12e407d85b73637395e400ddfd (patch)
treef474cb23b8bdb2f4e3d58408f9a8c1f6bed0b1d2
parent52b1bb08234d48c710385349402a8cc6800734ed (diff)
parent0f0d853de7054f2ed31253b21aabdb0855510b8f (diff)
downloadCMake-c8da7b0f5c183d12e407d85b73637395e400ddfd.zip
CMake-c8da7b0f5c183d12e407d85b73637395e400ddfd.tar.gz
CMake-c8da7b0f5c183d12e407d85b73637395e400ddfd.tar.bz2
Merge topic 'cxxmodules-collapse-source-paths' into release-3.28
0f0d853de7 cmDyndepCollation: collapse full path before looking up Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !9249
-rw-r--r--Source/cmDyndepCollation.cxx5
-rw-r--r--Tests/RunCMake/CXXModules/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/CXXModules/examples/file-sets-with-dot/CMakeLists.txt18
-rw-r--r--Tests/RunCMake/CXXModules/examples/file-sets-with-dot/importable.cxx6
-rw-r--r--Tests/RunCMake/CXXModules/examples/file-sets-with-dot/main.cxx6
5 files changed, 34 insertions, 2 deletions
diff --git a/Source/cmDyndepCollation.cxx b/Source/cmDyndepCollation.cxx
index edf56ff..2ce0f54 100644
--- a/Source/cmDyndepCollation.cxx
+++ b/Source/cmDyndepCollation.cxx
@@ -119,7 +119,8 @@ Json::Value CollationInformationCxxModules(
for (auto const& files_per_dir : files_per_dirs) {
for (auto const& file : files_per_dir.second) {
- auto lookup = sf_map.find(file);
+ auto const full_file = cmSystemTools::CollapseFullPath(file);
+ auto lookup = sf_map.find(full_file);
if (lookup == sf_map.end()) {
gt->Makefile->IssueMessage(
MessageType::FATAL_ERROR,
@@ -147,7 +148,7 @@ Json::Value CollationInformationCxxModules(
Json::Value& tdi_module_info = tdi_cxx_module_info[obj_path] =
Json::objectValue;
- tdi_module_info["source"] = file;
+ tdi_module_info["source"] = full_file;
tdi_module_info["bmi-only"] = ct == CompileType::BmiOnly;
tdi_module_info["relative-directory"] = files_per_dir.first;
tdi_module_info["name"] = file_set->GetName();
diff --git a/Tests/RunCMake/CXXModules/RunCMakeTest.cmake b/Tests/RunCMake/CXXModules/RunCMakeTest.cmake
index 0ac60e0..2a93aeb 100644
--- a/Tests/RunCMake/CXXModules/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CXXModules/RunCMakeTest.cmake
@@ -171,6 +171,7 @@ run_cxx_module_test(scan-with-pch)
# Tests which use named modules.
if ("named" IN_LIST CMake_TEST_MODULE_COMPILATION)
run_cxx_module_test(simple)
+ run_cxx_module_test(file-sets-with-dot)
run_cxx_module_test(vs-without-flags)
run_cxx_module_test(library library-static -DBUILD_SHARED_LIBS=OFF)
run_cxx_module_test(unity-build)
diff --git a/Tests/RunCMake/CXXModules/examples/file-sets-with-dot/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/file-sets-with-dot/CMakeLists.txt
new file mode 100644
index 0000000..2b16a6a
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/file-sets-with-dot/CMakeLists.txt
@@ -0,0 +1,18 @@
+cmake_minimum_required(VERSION 3.28)
+project(cxx_modules_file_sets_with_dot CXX)
+
+include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake")
+
+add_executable(file_sets_with_dot)
+target_sources(file_sets_with_dot
+ PRIVATE
+ ./main.cxx
+ PRIVATE
+ FILE_SET CXX_MODULES
+ BASE_DIRS
+ "${CMAKE_CURRENT_SOURCE_DIR}"
+ FILES
+ ./importable.cxx)
+target_compile_features(file_sets_with_dot PUBLIC cxx_std_20)
+
+add_test(NAME file_sets_with_dot COMMAND file_sets_with_dot)
diff --git a/Tests/RunCMake/CXXModules/examples/file-sets-with-dot/importable.cxx b/Tests/RunCMake/CXXModules/examples/file-sets-with-dot/importable.cxx
new file mode 100644
index 0000000..607680a
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/file-sets-with-dot/importable.cxx
@@ -0,0 +1,6 @@
+export module importable;
+
+export int from_import()
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/CXXModules/examples/file-sets-with-dot/main.cxx b/Tests/RunCMake/CXXModules/examples/file-sets-with-dot/main.cxx
new file mode 100644
index 0000000..feb38d2
--- /dev/null
+++ b/Tests/RunCMake/CXXModules/examples/file-sets-with-dot/main.cxx
@@ -0,0 +1,6 @@
+import importable;
+
+int main(int argc, char* argv[])
+{
+ return from_import();
+}