Omitting cmake_minimum_required(VERSION 3.28) causes module compile to fail, even with 3.28
I have a simple c++20 module test setup, and it builds and works fine with CMake 3.28 and clang 17.
cmake_minimum_required(VERSION 3.28)
project(moduleToy)
message(STATUS "CMAKE_ROOT is ${CMAKE_ROOT}")
message(STATUS "CMAKE_CXX_COMPILER is ${CMAKE_CXX_COMPILER}")
set(CMAKE_CXX_STANDARD 20)
add_executable(moduleToy main.cpp)
target_sources(moduleToy
PUBLIC
FILE_SET cxx_modules TYPE CXX_MODULES FILES
modA.mpp
modB.mpp
PUBLIC
)
However, if you forget to update cmake_minimum_required() to specify 3.28 (I had it at 3.27), it will fail to compile correctly - it won't specify the modmap parameter when compiling main.cpp.
It took a while to determine (ie guess) why this was failing, given that I'd satisfied all the dependencies required. I think it'd be more useful to give an explicit error, or even better work, and not depend on cmake_minimum_required() to implicitly change behaviour.