mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-22 22:31:18 -05:00
386465bf83
C++ modules have two variants which are of importance to CMake:
- `CXX_MODULES`: interface modules (those using `export module M;`,
`export module M:part;`, or `module M:internal_part;`)
- `CXX_MODULE_HEADER_UNITS`: importable header units
Creating C++ modules or partitions are *not* supported in any other
source listing. This is because the source files must be installed (so
their scope matters), but not part of usage requirements (what it means
for a module source to be injected into a consumer is not clear at this
moment). Due to the way `FILE_SET` works with scopes, they are a perfect
fit as long as `INTERFACE` is not allowed (which it is not).
26 lines
799 B
CMake
26 lines
799 B
CMake
enable_language(CXX)
|
|
|
|
set(info "")
|
|
|
|
# See `Modules/Compiler/MSVC-CXX.cmake` for this. If there is explicitly no
|
|
# default, the feature list is populated to be everything.
|
|
if (DEFINED CMAKE_CXX_STANDARD_DEFAULT AND
|
|
CMAKE_CXX_STANDARD_DEFAULT STREQUAL "")
|
|
set(CMAKE_CXX_COMPILE_FEATURES "")
|
|
endif ()
|
|
|
|
# Detect if the environment forces a C++ standard, let the test selection know.
|
|
set(forced_cxx_standard 0)
|
|
if (CMAKE_CXX_FLAGS MATCHES "-std=")
|
|
set(forced_cxx_standard 1)
|
|
endif ()
|
|
|
|
# Forward information about the C++ compile features.
|
|
string(APPEND info "\
|
|
set(CMAKE_CXX_COMPILE_FEATURES \"${CMAKE_CXX_COMPILE_FEATURES}\")
|
|
set(CMAKE_MAKE_PROGRAM \"${CMAKE_MAKE_PROGRAM}\")
|
|
set(forced_cxx_standard \"${forced_cxx_standard}\")
|
|
")
|
|
|
|
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/info.cmake" "${info}")
|