target_sources FILE_SET ... TYPE CXX_MODULES stopped working in cmake 3.27
I have a cmake file to build a modular hello world example that looks like this:
cmake_minimum_required(VERSION 3.26)
set(CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API "2182bf5c-ef0d-489a-91da-49dbc3090d2a")
set(CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP 1)
project(modules_ex0)
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
add_executable(modules_ex0_exe main.cpp)
target_sources(modules_ex0_exe PUBLIC FILE_SET cxx_modules TYPE CXX_MODULES FILES
console.cppm
)
Which worked well in 3.26.x
. With cmake 3.27.0
it breaks with the following error message:
target_sources File set TYPE may only be "HEADERS"