Commit c095ec67 authored by Ben Boeckel's avatar Ben Boeckel
Browse files

RunCMake/CXXModules: test public modules requiring private modules

parent d07c11a1
Pipeline #287369 passed with stages
in 72 minutes and 59 seconds
......@@ -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.
......
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
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.
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)
export module priv;
export int g()
{
return 0;
}
export module pub;
import priv;
export int f()
{
return g();
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment