mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-09 15:20:56 -06:00
RunCMake/CXXModules: test public modules requiring private modules
This commit is contained in:
@@ -130,6 +130,7 @@ 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(generated)
|
||||
run_cxx_module_test(public-req-private)
|
||||
endif ()
|
||||
|
||||
# Tests which use named modules in shared libraries.
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -0,0 +1 @@
|
||||
CMake Error: Public C\+\+ module source `.*/Tests/RunCMake/CXXModules/examples/public-req-private/pub.cxx` requires the `priv` C\+\+ module which is provided by a private source
|
||||
@@ -0,0 +1,9 @@
|
||||
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.
|
||||
|
||||
CMake Warning \(dev\):
|
||||
C\+\+20 modules support via CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP is
|
||||
experimental. It is meant only for compiler developers to try.
|
||||
This warning is for project developers. Use -Wno-dev to suppress it.
|
||||
@@ -0,0 +1,22 @@
|
||||
cmake_minimum_required(VERSION 3.24)
|
||||
project(cxx_modules_public_req_private CXX)
|
||||
|
||||
include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake")
|
||||
|
||||
add_library(public_req_private)
|
||||
target_sources(public_req_private
|
||||
PRIVATE
|
||||
FILE_SET private TYPE CXX_MODULES
|
||||
BASE_DIRS
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
FILES
|
||||
priv.cxx
|
||||
PUBLIC
|
||||
FILE_SET public TYPE CXX_MODULES
|
||||
BASE_DIRS
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
FILES
|
||||
pub.cxx)
|
||||
target_compile_features(public_req_private PUBLIC cxx_std_20)
|
||||
|
||||
add_test(NAME cmake-version COMMAND "${CMAKE_COMMAND}" --version)
|
||||
@@ -0,0 +1,6 @@
|
||||
export module priv;
|
||||
|
||||
export int g()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
export module pub;
|
||||
|
||||
import priv;
|
||||
|
||||
export int f()
|
||||
{
|
||||
return g();
|
||||
}
|
||||
Reference in New Issue
Block a user