summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2024-01-17 14:35:23 (GMT)
committerKitware Robot <kwrobot@kitware.com>2024-01-17 14:36:43 (GMT)
commit1e32d3118caba716040d827e8d1207388ba75b88 (patch)
tree67679074b081f4bf39431981c2d3a0296d57dc10
parent3c868a3fb4f94c6d9e8dbb3c0d11b2d603f5fdb4 (diff)
parentc09f8d27cd8aa9d44993cf39a663ca331017ed75 (diff)
downloadCMake-1e32d3118caba716040d827e8d1207388ba75b88.zip
CMake-1e32d3118caba716040d827e8d1207388ba75b88.tar.gz
CMake-1e32d3118caba716040d827e8d1207388ba75b88.tar.bz2
Merge topic 'cxxmodules-obj-lib' into release-3.28
c09f8d27cd cxxmodules: compute link information for C++ module-consuming targets Acked-by: Kitware Robot <kwrobot@kitware.com> Tested-by: buildbot <buildbot@kitware.com> Reviewed-by: Ben Boeckel <ben.boeckel@kitware.com> Merge-request: !9154
-rw-r--r--Source/cmComputeLinkInformation.cxx3
-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
5 files changed, 22 insertions, 1 deletions
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index e7bef68..47717e3 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -553,7 +553,8 @@ bool cmComputeLinkInformation::Compute()
this->Target->GetType() == cmStateEnums::MODULE_LIBRARY ||
this->Target->GetType() == cmStateEnums::STATIC_LIBRARY ||
(this->Target->CanCompileSources() &&
- (this->Target->HaveCxx20ModuleSources() ||
+ (this->Target->HaveCxxModuleSupport(this->Config) ==
+ cmGeneratorTarget::Cxx20SupportLevel::Supported ||
this->Target->HaveFortranSources())))) {
return false;
}
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;