| 1 |
cmake_minimum_required(VERSION 3.24...3.28) |
| 2 |
project(cxx_modules_library NONE) |
| 3 |
|
| 4 |
find_package(export_interfaces_no_properties REQUIRED) |
| 5 |
|
| 6 |
if (NOT TARGET CXXModules::export_interfaces_no_properties) |
| 7 |
message(FATAL_ERROR |
| 8 |
"Missing imported target") |
| 9 |
endif () |
| 10 |
|
| 11 |
get_property(file_sets TARGET CXXModules::export_interfaces_no_properties |
| 12 |
PROPERTY INTERFACE_CXX_MODULE_SETS) |
| 13 |
if (NOT file_sets STREQUAL "modules") |
| 14 |
message(FATAL_ERROR |
| 15 |
"Incorrect exported file sets in CXXModules::export_interfaces_no_properties:\n ${file_sets}") |
| 16 |
endif () |
| 17 |
|
| 18 |
get_property(file_set_files TARGET CXXModules::export_interfaces_no_properties |
| 19 |
PROPERTY CXX_MODULE_SET_modules) |
| 20 |
set(expected_file_set_files |
| 21 |
"${expected_dir}/importable.cxx" |
| 22 |
"${expected_dir}/subdir/importable.cxx" |
| 23 |
) |
| 24 |
if (NOT file_set_files STREQUAL "${expected_file_set_files}") |
| 25 |
message(FATAL_ERROR |
| 26 |
"Incorrect exported file set paths in CXXModules::export_interfaces_no_properties:\n ${file_set_files}") |
| 27 |
endif () |
| 28 |
|
| 29 |
get_property(imported_modules_set TARGET CXXModules::export_interfaces_no_properties |
| 30 |
PROPERTY IMPORTED_CXX_MODULES_DEBUG SET) |
| 31 |
if (imported_modules_set) |
| 32 |
message(FATAL_ERROR |
| 33 |
"Unexpected C++ modules specified.") |
| 34 |
endif () |