Browse Source

Merge topic 'misc-cxx-modules-fixes'

28ece63fee cxxmodules: Fix exported path to installed module sources in subdirs
f2a699261b cxxmodules: Do not expect collator install scripts with no CXX_MODULES
f9677cc122 Tests: Improve RunCMake.CXXModules expectation matching and error reporting

Acked-by: Kitware Robot <[email protected]>
Reviewed-by: Ben Boeckel <[email protected]>
Merge-request: !8474
Brad King 2 years ago
parent
commit
cf7b7600c6
33 changed files with 194 additions and 44 deletions
  1. 4 0
      Source/cmDyndepCollation.cxx
  2. 6 0
      Source/cmExportBuildFileGenerator.cxx
  3. 6 0
      Source/cmExportInstallFileGenerator.cxx
  4. 1 1
      Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build-stderr.txt
  5. 6 2
      Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/CMakeLists.txt
  6. 3 0
      Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/no_modules.cxx
  7. 6 0
      Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/subdir/importable.cxx
  8. 17 5
      Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/test/CMakeLists.txt
  9. 1 1
      Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install-stderr.txt
  10. 6 2
      Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/CMakeLists.txt
  11. 3 0
      Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/no_modules.cxx
  12. 6 0
      Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/subdir/importable.cxx
  13. 17 5
      Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/test/CMakeLists.txt
  14. 1 1
      Tests/RunCMake/CXXModules/examples/export-interface-build-stderr.txt
  15. 6 2
      Tests/RunCMake/CXXModules/examples/export-interface-build/CMakeLists.txt
  16. 3 0
      Tests/RunCMake/CXXModules/examples/export-interface-build/no_modules.cxx
  17. 6 0
      Tests/RunCMake/CXXModules/examples/export-interface-build/subdir/importable.cxx
  18. 17 5
      Tests/RunCMake/CXXModules/examples/export-interface-build/test/CMakeLists.txt
  19. 1 1
      Tests/RunCMake/CXXModules/examples/export-interface-install-stderr.txt
  20. 6 2
      Tests/RunCMake/CXXModules/examples/export-interface-install/CMakeLists.txt
  21. 3 0
      Tests/RunCMake/CXXModules/examples/export-interface-install/no_modules.cxx
  22. 6 0
      Tests/RunCMake/CXXModules/examples/export-interface-install/subdir/importable.cxx
  23. 17 5
      Tests/RunCMake/CXXModules/examples/export-interface-install/test/CMakeLists.txt
  24. 1 1
      Tests/RunCMake/CXXModules/examples/export-interface-no-properties-build-stderr.txt
  25. 6 2
      Tests/RunCMake/CXXModules/examples/export-interface-no-properties-build/CMakeLists.txt
  26. 3 0
      Tests/RunCMake/CXXModules/examples/export-interface-no-properties-build/no_modules.cxx
  27. 6 0
      Tests/RunCMake/CXXModules/examples/export-interface-no-properties-build/subdir/importable.cxx
  28. 7 3
      Tests/RunCMake/CXXModules/examples/export-interface-no-properties-build/test/CMakeLists.txt
  29. 1 1
      Tests/RunCMake/CXXModules/examples/export-interface-no-properties-install-stderr.txt
  30. 6 2
      Tests/RunCMake/CXXModules/examples/export-interface-no-properties-install/CMakeLists.txt
  31. 3 0
      Tests/RunCMake/CXXModules/examples/export-interface-no-properties-install/no_modules.cxx
  32. 6 0
      Tests/RunCMake/CXXModules/examples/export-interface-no-properties-install/subdir/importable.cxx
  33. 7 3
      Tests/RunCMake/CXXModules/examples/export-interface-no-properties-install/test/CMakeLists.txt

+ 4 - 0
Source/cmDyndepCollation.cxx

@@ -358,6 +358,10 @@ cmDyndepCollation::ParseExportInfo(Json::Value const& tdi)
       fsi.Name = tdi_cxx_module_info["name"].asString();
       fsi.RelativeDirectory =
         tdi_cxx_module_info["relative-directory"].asString();
+      if (!fsi.RelativeDirectory.empty() &&
+          fsi.RelativeDirectory.back() != '/') {
+        fsi.RelativeDirectory = cmStrCat(fsi.RelativeDirectory, '/');
+      }
       fsi.SourcePath = tdi_cxx_module_info["source"].asString();
       fsi.Type = tdi_cxx_module_info["type"].asString();
       fsi.Visibility = cmFileSetVisibilityFromName(

+ 6 - 0
Source/cmExportBuildFileGenerator.cxx

@@ -542,6 +542,12 @@ bool cmExportBuildFileGenerator::GenerateImportCxxModuleConfigTargetInclusion(
   os.SetCopyIfDifferent(true);
 
   for (auto const* tgt : this->ExportedTargets) {
+    // Only targets with C++ module sources will have a
+    // collator-generated install script.
+    if (!tgt->HaveCxx20ModuleSources()) {
+      continue;
+    }
+
     os << "include(\"${CMAKE_CURRENT_LIST_DIR}/target-" << tgt->GetExportName()
        << '-' << config << ".cmake\")\n";
   }

+ 6 - 0
Source/cmExportInstallFileGenerator.cxx

@@ -752,6 +752,12 @@ bool cmExportInstallFileGenerator::
 
   auto& prop_files = this->ConfigCxxModuleTargetFiles[config];
   for (auto const* tgt : this->ExportedTargets) {
+    // Only targets with C++ module sources will have a
+    // collator-generated install script.
+    if (!tgt->HaveCxx20ModuleSources()) {
+      continue;
+    }
+
     auto prop_filename = cmStrCat("target-", tgt->GetExportName(), '-',
                                   filename_config, ".cmake");
     prop_files.emplace_back(cmStrCat(dest, prop_filename));

+ 1 - 1
Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build-stderr.txt

@@ -1,4 +1,4 @@
-CMake Warning \(dev\) at CMakeLists.txt:7 \(target_sources\):
+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.

+ 6 - 2
Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/CMakeLists.txt

@@ -18,10 +18,14 @@ target_sources(export_bmi_and_interfaces
       BASE_DIRS
         "${CMAKE_CURRENT_SOURCE_DIR}"
       FILES
-        importable.cxx)
+        importable.cxx
+        subdir/importable.cxx
+  )
 target_compile_features(export_bmi_and_interfaces PUBLIC cxx_std_20)
 
-install(TARGETS export_bmi_and_interfaces
+add_library(no_modules STATIC no_modules.cxx)
+
+install(TARGETS export_bmi_and_interfaces no_modules
   EXPORT CXXModules
   FILE_SET modules DESTINATION "lib/cxx/miu"
   CXX_MODULES_BMI DESTINATION "lib/cxx/bmi")

+ 3 - 0
Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/no_modules.cxx

@@ -0,0 +1,3 @@
+void no_modules()
+{
+}

+ 6 - 0
Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/subdir/importable.cxx

@@ -0,0 +1,6 @@
+export module subdir_importable;
+
+export int from_subdir()
+{
+  return 0;
+}

+ 17 - 5
Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-build/test/CMakeLists.txt

@@ -14,19 +14,31 @@ get_property(file_sets TARGET CXXModules::export_bmi_and_interfaces
   PROPERTY INTERFACE_CXX_MODULE_SETS)
 if (NOT file_sets STREQUAL "modules")
   message(FATAL_ERROR
-    "Incorrect exported file sets in `CXXModules::export_bmi_and_interfaces`: `${file_sets}`")
+    "Incorrect exported file sets in CXXModules::export_bmi_and_interfaces:\n  ${file_sets}")
 endif ()
 
 get_property(file_set_files TARGET CXXModules::export_bmi_and_interfaces
   PROPERTY CXX_MODULE_SET_modules)
-if (NOT file_set_files STREQUAL "${expected_source_dir}/importable.cxx")
+set(expected_file_set_files
+  "${expected_source_dir}/importable.cxx"
+  "${expected_source_dir}/subdir/importable.cxx"
+  )
+if (NOT file_set_files STREQUAL "${expected_file_set_files}")
   message(FATAL_ERROR
-    "Incorrect exported file set paths in CXXModules::export_bmi_and_interfaces`: `${file_set_files}`")
+    "Incorrect exported file set paths in CXXModules::export_bmi_and_interfaces:\n  ${file_set_files}")
 endif ()
 
 get_property(imported_modules TARGET CXXModules::export_bmi_and_interfaces
   PROPERTY IMPORTED_CXX_MODULES_DEBUG)
-if (NOT imported_modules MATCHES "importable=${expected_source_dir}/importable.cxx,${expected_binary_dir}/CMakeFiles/export_bmi_and_interfaces.dir(/Debug)?/importable.(gcm|pcm|ifc)")
+set(expected_imported_modules
+  "importable=${expected_source_dir}/importable.cxx,${expected_binary_dir}/CMakeFiles/export_bmi_and_interfaces.dir(/Debug)?/importable.(gcm|pcm|ifc)"
+  "subdir_importable=${expected_source_dir}/subdir/importable.cxx,${expected_binary_dir}/CMakeFiles/export_bmi_and_interfaces.dir(/Debug)?/subdir_importable.(gcm|pcm|ifc)"
+  )
+if (NOT imported_modules MATCHES "^${expected_imported_modules}$")
   message(FATAL_ERROR
-    "Incorrect exported modules in CXXModules::export_bmi_and_interfaces`: `${imported_modules}`")
+    "Incorrect exported modules in CXXModules::export_bmi_and_interfaces:\n"
+    "  ${imported_modules}\n"
+    "does not match:\n"
+    "  ${expected_imported_modules}"
+  )
 endif ()

+ 1 - 1
Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install-stderr.txt

@@ -1,4 +1,4 @@
-CMake Warning \(dev\) at CMakeLists.txt:7 \(target_sources\):
+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.

+ 6 - 2
Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/CMakeLists.txt

@@ -18,10 +18,14 @@ target_sources(export_bmi_and_interfaces
       BASE_DIRS
         "${CMAKE_CURRENT_SOURCE_DIR}"
       FILES
-        importable.cxx)
+        importable.cxx
+        subdir/importable.cxx
+  )
 target_compile_features(export_bmi_and_interfaces PUBLIC cxx_std_20)
 
-install(TARGETS export_bmi_and_interfaces
+add_library(no_modules STATIC no_modules.cxx)
+
+install(TARGETS export_bmi_and_interfaces no_modules
   EXPORT CXXModules
   FILE_SET modules DESTINATION "lib/cxx/miu"
   CXX_MODULES_BMI DESTINATION "lib/cxx/bmi")

+ 3 - 0
Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/no_modules.cxx

@@ -0,0 +1,3 @@
+void no_modules()
+{
+}

+ 6 - 0
Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/subdir/importable.cxx

@@ -0,0 +1,6 @@
+export module subdir_importable;
+
+export int from_subdir()
+{
+  return 0;
+}

+ 17 - 5
Tests/RunCMake/CXXModules/examples/export-bmi-and-interface-install/test/CMakeLists.txt

@@ -14,19 +14,31 @@ get_property(file_sets TARGET CXXModules::export_bmi_and_interfaces
   PROPERTY INTERFACE_CXX_MODULE_SETS)
 if (NOT file_sets STREQUAL "modules")
   message(FATAL_ERROR
-    "Incorrect exported file sets in `CXXModules::export_bmi_and_interfaces`: `${file_sets}`")
+    "Incorrect exported file sets in CXXModules::export_bmi_and_interfaces:\n  ${file_sets}")
 endif ()
 
 get_property(file_set_files TARGET CXXModules::export_bmi_and_interfaces
   PROPERTY CXX_MODULE_SET_modules)
-if (NOT file_set_files STREQUAL "${expected_source_dir}/importable.cxx")
+set(expected_file_set_files
+  "${expected_source_dir}/importable.cxx"
+  "${expected_source_dir}/subdir/importable.cxx"
+  )
+if (NOT file_set_files STREQUAL "${expected_file_set_files}")
   message(FATAL_ERROR
-    "Incorrect exported file set paths in CXXModules::export_bmi_and_interfaces`: `${file_set_files}`")
+    "Incorrect exported file set paths in CXXModules::export_bmi_and_interfaces:\n  ${file_set_files}")
 endif ()
 
 get_property(imported_modules TARGET CXXModules::export_bmi_and_interfaces
   PROPERTY IMPORTED_CXX_MODULES_DEBUG)
-if (NOT imported_modules MATCHES "importable=${expected_source_dir}/importable.cxx,${expected_binary_dir}/importable.(gcm|pcm|ifc)")
+set(expected_imported_modules
+  "importable=${expected_source_dir}/importable.cxx,${expected_binary_dir}/importable.(gcm|pcm|ifc)"
+  "subdir_importable=${expected_source_dir}/subdir/importable.cxx,${expected_binary_dir}/subdir_importable.(gcm|pcm|ifc)"
+  )
+if (NOT imported_modules MATCHES "^${expected_imported_modules}$")
   message(FATAL_ERROR
-    "Incorrect exported modules in CXXModules::export_bmi_and_interfaces`: `${imported_modules}`")
+    "Incorrect exported modules in CXXModules::export_bmi_and_interfaces:\n"
+    "  ${imported_modules}\n"
+    "does not match:\n"
+    "  ${expected_imported_modules}"
+  )
 endif ()

+ 1 - 1
Tests/RunCMake/CXXModules/examples/export-interface-build-stderr.txt

@@ -1,4 +1,4 @@
-CMake Warning \(dev\) at CMakeLists.txt:7 \(target_sources\):
+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.

+ 6 - 2
Tests/RunCMake/CXXModules/examples/export-interface-build/CMakeLists.txt

@@ -18,10 +18,14 @@ target_sources(export_interfaces
       BASE_DIRS
         "${CMAKE_CURRENT_SOURCE_DIR}"
       FILES
-        importable.cxx)
+        importable.cxx
+        subdir/importable.cxx
+  )
 target_compile_features(export_interfaces PUBLIC cxx_std_20)
 
-install(TARGETS export_interfaces
+add_library(no_modules STATIC no_modules.cxx)
+
+install(TARGETS export_interfaces no_modules
   EXPORT CXXModules
   FILE_SET modules DESTINATION "lib/cxx/miu")
 export(EXPORT CXXModules

+ 3 - 0
Tests/RunCMake/CXXModules/examples/export-interface-build/no_modules.cxx

@@ -0,0 +1,3 @@
+void no_modules()
+{
+}

+ 6 - 0
Tests/RunCMake/CXXModules/examples/export-interface-build/subdir/importable.cxx

@@ -0,0 +1,6 @@
+export module subdir_importable;
+
+export int from_subdir()
+{
+  return 0;
+}

+ 17 - 5
Tests/RunCMake/CXXModules/examples/export-interface-build/test/CMakeLists.txt

@@ -14,19 +14,31 @@ get_property(file_sets TARGET CXXModules::export_interfaces
   PROPERTY INTERFACE_CXX_MODULE_SETS)
 if (NOT file_sets STREQUAL "modules")
   message(FATAL_ERROR
-    "Incorrect exported file sets in `CXXModules::export_interfaces`: `${file_sets}`")
+    "Incorrect exported file sets in CXXModules::export_interfaces:\n  ${file_sets}")
 endif ()
 
 get_property(file_set_files TARGET CXXModules::export_interfaces
   PROPERTY CXX_MODULE_SET_modules)
-if (NOT file_set_files STREQUAL "${expected_source_dir}/importable.cxx")
+set(expected_file_set_files
+  "${expected_source_dir}/importable.cxx"
+  "${expected_source_dir}/subdir/importable.cxx"
+  )
+if (NOT file_set_files STREQUAL "${expected_file_set_files}")
   message(FATAL_ERROR
-    "Incorrect exported file set paths in CXXModules::export_interfaces`: `${file_set_files}`")
+    "Incorrect exported file set paths in CXXModules::export_interfaces:\n  ${file_set_files}")
 endif ()
 
 get_property(imported_modules TARGET CXXModules::export_interfaces
   PROPERTY IMPORTED_CXX_MODULES_DEBUG)
-if (NOT imported_modules MATCHES "importable=${expected_source_dir}/importable.cxx,${expected_binary_dir}/CMakeFiles/export_interfaces.dir(/Debug)?/importable.(gcm|pcm|ifc)")
+set(expected_imported_modules
+  "importable=${expected_source_dir}/importable.cxx,${expected_binary_dir}/CMakeFiles/export_interfaces.dir(/Debug)?/importable.(gcm|pcm|ifc)"
+  "subdir_importable=${expected_source_dir}/subdir/importable.cxx,${expected_binary_dir}/CMakeFiles/export_interfaces.dir(/Debug)?/subdir_importable.(gcm|pcm|ifc)"
+  )
+if (NOT imported_modules MATCHES "^${expected_imported_modules}$")
   message(FATAL_ERROR
-    "Incorrect exported modules in CXXModules::export_interfaces`: `${imported_modules}`\n`importable=${expected_source_dir}/importable.cxx,${expected_binary_dir}/CMakeFiles/export_interfaces.dir(/Debug)?/importable.(gcm|pcm|ifc)`")
+    "Incorrect exported modules in CXXModules::export_interfaces:\n"
+    "  ${imported_modules}\n"
+    "does not match:\n"
+    "  ${expected_imported_modules}"
+  )
 endif ()

+ 1 - 1
Tests/RunCMake/CXXModules/examples/export-interface-install-stderr.txt

@@ -1,4 +1,4 @@
-CMake Warning \(dev\) at CMakeLists.txt:7 \(target_sources\):
+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.

+ 6 - 2
Tests/RunCMake/CXXModules/examples/export-interface-install/CMakeLists.txt

@@ -18,10 +18,14 @@ target_sources(export_interfaces
       BASE_DIRS
         "${CMAKE_CURRENT_SOURCE_DIR}"
       FILES
-        importable.cxx)
+        importable.cxx
+        subdir/importable.cxx
+  )
 target_compile_features(export_interfaces PUBLIC cxx_std_20)
 
-install(TARGETS export_interfaces
+add_library(no_modules STATIC no_modules.cxx)
+
+install(TARGETS export_interfaces no_modules
   EXPORT CXXModules
   FILE_SET modules DESTINATION "lib/cxx/miu")
 install(EXPORT CXXModules

+ 3 - 0
Tests/RunCMake/CXXModules/examples/export-interface-install/no_modules.cxx

@@ -0,0 +1,3 @@
+void no_modules()
+{
+}

+ 6 - 0
Tests/RunCMake/CXXModules/examples/export-interface-install/subdir/importable.cxx

@@ -0,0 +1,6 @@
+export module subdir_importable;
+
+export int from_subdir()
+{
+  return 0;
+}

+ 17 - 5
Tests/RunCMake/CXXModules/examples/export-interface-install/test/CMakeLists.txt

@@ -14,19 +14,31 @@ get_property(file_sets TARGET CXXModules::export_interfaces
   PROPERTY INTERFACE_CXX_MODULE_SETS)
 if (NOT file_sets STREQUAL "modules")
   message(FATAL_ERROR
-    "Incorrect exported file sets in `CXXModules::export_interfaces`: `${file_sets}`")
+    "Incorrect exported file sets in CXXModules::export_interfaces:\n  ${file_sets}")
 endif ()
 
 get_property(file_set_files TARGET CXXModules::export_interfaces
   PROPERTY CXX_MODULE_SET_modules)
-if (NOT file_set_files STREQUAL "${expected_source_dir}/importable.cxx")
+set(expected_file_set_files
+  "${expected_source_dir}/importable.cxx"
+  "${expected_source_dir}/subdir/importable.cxx"
+  )
+if (NOT file_set_files STREQUAL "${expected_file_set_files}")
   message(FATAL_ERROR
-    "Incorrect exported file set paths in CXXModules::export_interfaces`: `${file_set_files}`")
+    "Incorrect exported file set paths in CXXModules::export_interfaces:\n  ${file_set_files}")
 endif ()
 
 get_property(imported_modules TARGET CXXModules::export_interfaces
   PROPERTY IMPORTED_CXX_MODULES_DEBUG)
-if (NOT imported_modules STREQUAL "importable=${expected_source_dir}/importable.cxx")
+set(expected_imported_modules
+  "importable=${expected_source_dir}/importable.cxx"
+  "subdir_importable=${expected_source_dir}/subdir/importable.cxx"
+  )
+if (NOT imported_modules STREQUAL "${expected_imported_modules}")
   message(FATAL_ERROR
-    "Incorrect exported modules in CXXModules::export_interfaces`: `${imported_modules}`")
+    "Incorrect exported modules in CXXModules::export_interfaces:\n"
+    "  ${imported_modules}\n"
+    "does not match:\n"
+    "  ${expected_imported_modules}"
+  )
 endif ()

+ 1 - 1
Tests/RunCMake/CXXModules/examples/export-interface-no-properties-build-stderr.txt

@@ -1,4 +1,4 @@
-CMake Warning \(dev\) at CMakeLists.txt:7 \(target_sources\):
+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.

+ 6 - 2
Tests/RunCMake/CXXModules/examples/export-interface-no-properties-build/CMakeLists.txt

@@ -18,10 +18,14 @@ target_sources(export_interfaces_no_properties
       BASE_DIRS
         "${CMAKE_CURRENT_SOURCE_DIR}"
       FILES
-        importable.cxx)
+        importable.cxx
+        subdir/importable.cxx
+  )
 target_compile_features(export_interfaces_no_properties PUBLIC cxx_std_20)
 
-install(TARGETS export_interfaces_no_properties
+add_library(no_modules STATIC no_modules.cxx)
+
+install(TARGETS export_interfaces_no_properties no_modules
   EXPORT CXXModules
   FILE_SET modules DESTINATION "lib/cxx/miu")
 export(EXPORT CXXModules

+ 3 - 0
Tests/RunCMake/CXXModules/examples/export-interface-no-properties-build/no_modules.cxx

@@ -0,0 +1,3 @@
+void no_modules()
+{
+}

+ 6 - 0
Tests/RunCMake/CXXModules/examples/export-interface-no-properties-build/subdir/importable.cxx

@@ -0,0 +1,6 @@
+export module subdir_importable;
+
+export int from_subdir()
+{
+  return 0;
+}

+ 7 - 3
Tests/RunCMake/CXXModules/examples/export-interface-no-properties-build/test/CMakeLists.txt

@@ -14,14 +14,18 @@ get_property(file_sets TARGET CXXModules::export_interfaces_no_properties
   PROPERTY INTERFACE_CXX_MODULE_SETS)
 if (NOT file_sets STREQUAL "modules")
   message(FATAL_ERROR
-    "Incorrect exported file sets in `CXXModules::export_interfaces_no_properties`: `${file_sets}`")
+    "Incorrect exported file sets in CXXModules::export_interfaces_no_properties:\n  ${file_sets}")
 endif ()
 
 get_property(file_set_files TARGET CXXModules::export_interfaces_no_properties
   PROPERTY CXX_MODULE_SET_modules)
-if (NOT file_set_files STREQUAL "${expected_dir}/importable.cxx")
+set(expected_file_set_files
+  "${expected_dir}/importable.cxx"
+  "${expected_dir}/subdir/importable.cxx"
+  )
+if (NOT file_set_files STREQUAL "${expected_file_set_files}")
   message(FATAL_ERROR
-    "Incorrect exported file set paths in CXXModules::export_interfaces_no_properties`: `${file_set_files}`")
+    "Incorrect exported file set paths in CXXModules::export_interfaces_no_properties:\n  ${file_set_files}")
 endif ()
 
 get_property(imported_modules_set TARGET CXXModules::export_interfaces_no_properties

+ 1 - 1
Tests/RunCMake/CXXModules/examples/export-interface-no-properties-install-stderr.txt

@@ -1,4 +1,4 @@
-CMake Warning \(dev\) at CMakeLists.txt:7 \(target_sources\):
+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.

+ 6 - 2
Tests/RunCMake/CXXModules/examples/export-interface-no-properties-install/CMakeLists.txt

@@ -18,10 +18,14 @@ target_sources(export_interfaces_no_properties
       BASE_DIRS
         "${CMAKE_CURRENT_SOURCE_DIR}"
       FILES
-        importable.cxx)
+        importable.cxx
+        subdir/importable.cxx
+  )
 target_compile_features(export_interfaces_no_properties PUBLIC cxx_std_20)
 
-install(TARGETS export_interfaces_no_properties
+add_library(no_modules STATIC no_modules.cxx)
+
+install(TARGETS export_interfaces_no_properties no_modules
   EXPORT CXXModules
   FILE_SET modules DESTINATION "lib/cxx/miu")
 install(EXPORT CXXModules

+ 3 - 0
Tests/RunCMake/CXXModules/examples/export-interface-no-properties-install/no_modules.cxx

@@ -0,0 +1,3 @@
+void no_modules()
+{
+}

+ 6 - 0
Tests/RunCMake/CXXModules/examples/export-interface-no-properties-install/subdir/importable.cxx

@@ -0,0 +1,6 @@
+export module subdir_importable;
+
+export int from_subdir()
+{
+  return 0;
+}

+ 7 - 3
Tests/RunCMake/CXXModules/examples/export-interface-no-properties-install/test/CMakeLists.txt

@@ -14,14 +14,18 @@ get_property(file_sets TARGET CXXModules::export_interfaces_no_properties
   PROPERTY INTERFACE_CXX_MODULE_SETS)
 if (NOT file_sets STREQUAL "modules")
   message(FATAL_ERROR
-    "Incorrect exported file sets in `CXXModules::export_interfaces_no_properties`: `${file_sets}`")
+    "Incorrect exported file sets in CXXModules::export_interfaces_no_properties:\n  ${file_sets}")
 endif ()
 
 get_property(file_set_files TARGET CXXModules::export_interfaces_no_properties
   PROPERTY CXX_MODULE_SET_modules)
-if (NOT file_set_files STREQUAL "${expected_dir}/importable.cxx")
+set(expected_file_set_files
+  "${expected_dir}/importable.cxx"
+  "${expected_dir}/subdir/importable.cxx"
+  )
+if (NOT file_set_files STREQUAL "${expected_file_set_files}")
   message(FATAL_ERROR
-    "Incorrect exported file set paths in CXXModules::export_interfaces_no_properties`: `${file_set_files}`")
+    "Incorrect exported file set paths in CXXModules::export_interfaces_no_properties:\n  ${file_set_files}")
 endif ()
 
 get_property(imported_modules_set TARGET CXXModules::export_interfaces_no_properties