cmTargetSourcesCommand: allow INTERFACE
C++ modules when imported
`PUBLIC` filesets become `INTERFACE` upon installation. Allow `INTERFACE` scopes for C++ modules when the target is imported.
This commit is contained in:
parent
ea3175a4eb
commit
f3cfde394a
@ -89,7 +89,7 @@ files within those directories. The acceptable types include:
|
||||
|
||||
Sources which contain C++ interface module or partition units (i.e., those
|
||||
using the ``export`` keyword). This file set type may not have an
|
||||
``INTERFACE`` scope.
|
||||
``INTERFACE`` scope except on ``IMPORTED`` targets.
|
||||
|
||||
``CXX_MODULE_HEADER_UNITS``
|
||||
|
||||
@ -98,7 +98,7 @@ files within those directories. The acceptable types include:
|
||||
Experimental. Gated by ``CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API``
|
||||
|
||||
C++ header sources which may be imported by other C++ source code. This file
|
||||
set type may not have an ``INTERFACE`` scope.
|
||||
set type may not have an ``INTERFACE`` scope except on ``IMPORTED`` targets.
|
||||
|
||||
The optional default file sets are named after their type. The target may not
|
||||
be a custom target or :prop_tgt:`FRAMEWORK` target.
|
||||
|
@ -269,7 +269,8 @@ bool TargetSourcesImpl::HandleOneFileSet(
|
||||
}
|
||||
|
||||
if (cmFileSetVisibilityIsForInterface(visibility) &&
|
||||
!cmFileSetVisibilityIsForSelf(visibility)) {
|
||||
!cmFileSetVisibilityIsForSelf(visibility) &&
|
||||
!this->Target->IsImported()) {
|
||||
if (type == "CXX_MODULES"_s || type == "CXX_MODULE_HEADER_UNITS"_s) {
|
||||
this->SetError(
|
||||
R"(File set TYPEs "CXX_MODULES" and "CXX_MODULE_HEADER_UNITS" may not have "INTERFACE" visibility)");
|
||||
|
@ -0,0 +1,6 @@
|
||||
CMake Warning \(dev\) at FileSetModuleHeaderUnitsInterfaceImported.cmake:2 \(target_sources\):
|
||||
CMake's C\+\+ module support is experimental. It is meant only for
|
||||
experimentation and feedback to CMake developers.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:6 \(include\)
|
||||
This warning is for project developers. Use -Wno-dev to suppress it.
|
@ -0,0 +1,8 @@
|
||||
add_library(module-header SHARED IMPORTED)
|
||||
target_sources(module-header
|
||||
INTERFACE
|
||||
FILE_SET fs TYPE CXX_MODULE_HEADER_UNITS FILES
|
||||
sources/module-header.h)
|
||||
target_compile_features(module-header
|
||||
INTERFACE
|
||||
cxx_std_20)
|
@ -0,0 +1,6 @@
|
||||
CMake Warning \(dev\) at FileSetModulesInterfaceImported.cmake:2 \(target_sources\):
|
||||
CMake's C\+\+ module support is experimental. It is meant only for
|
||||
experimentation and feedback to CMake developers.
|
||||
Call Stack \(most recent call first\):
|
||||
CMakeLists.txt:6 \(include\)
|
||||
This warning is for project developers. Use -Wno-dev to suppress it.
|
@ -0,0 +1,8 @@
|
||||
add_library(module SHARED IMPORTED)
|
||||
target_sources(module
|
||||
INTERFACE
|
||||
FILE_SET fs TYPE CXX_MODULES FILES
|
||||
sources/module.cxx)
|
||||
target_compile_features(module
|
||||
INTERFACE
|
||||
cxx_std_20)
|
@ -60,6 +60,7 @@ foreach (fileset_type IN LISTS fileset_types)
|
||||
foreach (scope IN LISTS scopes)
|
||||
run_cmake("FileSet${fileset_type}${scope}")
|
||||
endforeach ()
|
||||
run_cmake("FileSet${fileset_type}InterfaceImported")
|
||||
|
||||
# Test the error message when a non-C++ source file is found in the source
|
||||
# list.
|
||||
|
Loading…
Reference in New Issue
Block a user