-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbootstrapping.cmake
43 lines (38 loc) · 1.21 KB
/
bootstrapping.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# When building Muad itself, we need the maud_inject_regenerate
# program to be compiled and runnable *before* configuration ends.
# This can be accomplished with try_compile:
set(
_MAUD_INJECT_REGENERATE
"${MAUD_DIR}/maud_inject_regenerate"
CACHE INTERNAL
"try_compile'd maud_inject_regenerate for bootstrapping Maud"
)
if(
"${dir}/filesystem.cxx" IS_NEWER_THAN "${_MAUD_INJECT_REGENERATE}"
OR
"${dir}/cmake_modules/executable.cxx" IS_NEWER_THAN "${_MAUD_INJECT_REGENERATE}"
)
file(
WRITE "${MAUD_DIR}/maud_.cxx"
"export module maud_;\nexport import :filesystem;\n"
)
# TODO we don't even need a target for this; just install the bootstrapped one
# (rename to .maud_inject_regenerate.cxx to exclude from the glob)
try_compile(
success
SOURCES "${dir}/maud_inject_regenerate.cxx"
SOURCES_TYPE CXX_MODULE
SOURCES
"${MAUD_DIR}/maud_.cxx"
"${dir}/filesystem.cxx"
"${dir}/cmake_modules/executable.cxx"
COPY_FILE "${_MAUD_INJECT_REGENERATE}"
OUTPUT_VARIABLE errors
CXX_STANDARD 20
NO_CACHE
)
if(NOT success)
message(FATAL_ERROR "try_compile failed: ${errors}")
endif()
endif()
_maud_set(_MAUD_IN2 "ERROR_PLACEHOLDER_MAUD_IN2_NOT_BOOTSTRAPPED")