
We support non-compiled `SOURCES` on `INTERFACE` libraries, and also support `CXX_MODULES` on *imported* `INTERFACE` libraries (via synthetic targets that compile module interface units). However, we do not support `CXX_MODULES` on non-imported `INTERFACE` libraries because there is no place to hold module interface unit's object files for their module initializers. Previously this was not explicitly rejected, and so was diagnosed only by "CMake Internal Error" messages due to assumption violations in the implementation. Fixes: #26524 Co-authored-by: Ben Boeckel <ben.boeckel@kitware.com>
12 lines
241 B
CMake
12 lines
241 B
CMake
enable_language(CXX)
|
|
set(CMAKE_CXX_SCANDEP_SOURCE "")
|
|
|
|
add_library(module INTERFACE)
|
|
target_sources(module
|
|
PRIVATE
|
|
FILE_SET fs TYPE CXX_MODULES FILES
|
|
sources/module.cxx)
|
|
target_compile_features(module
|
|
INTERFACE
|
|
cxx_std_20)
|