| 1 |
cmake_minimum_required(VERSION 3.24...3.28) |
| 2 |
project(cxx_modules_library NONE) |
| 3 |
|
| 4 |
find_package(export_include_directories REQUIRED) |
| 5 |
find_package(export_include_directories_cps REQUIRED) |
| 6 |
|
| 7 |
function(test_target target set_name) |
| 8 |
if (NOT TARGET ${target}) |
| 9 |
message(FATAL_ERROR |
| 10 |
"Missing imported target") |
| 11 |
endif () |
| 12 |
|
| 13 |
get_property(file_sets TARGET ${target} |
| 14 |
PROPERTY INTERFACE_CXX_MODULE_SETS) |
| 15 |
if (NOT file_sets STREQUAL ${set_name}) |
| 16 |
message(FATAL_ERROR |
| 17 |
"Incorrect exported file sets in ${target}:\n ${file_sets}") |
| 18 |
endif () |
| 19 |
endfunction() |
| 20 |
|
| 21 |
test_target(CXXModules::export_include_directories "modules") |
| 22 |
test_target(export_include_directories_cps::export_include_directories "CXX_MODULES") |