mirror of
https://github.com/seL4/seL4.git
synced 2026-03-27 10:29:57 +00:00
CMake: Error if toolchain file changes
The toolchain file given to CMake is required to be immutable after first build configuration. CMake caches certain build flags based on this assumption. We now throw an error if the platform configuration changes in a way that changes this toolchain file.
This commit is contained in:
@@ -267,6 +267,19 @@ if(
|
||||
("${CMAKE_TOOLCHAIN_FILE}" STREQUAL "")
|
||||
OR ("${CMAKE_TOOLCHAIN_FILE}" STREQUAL "${toolchain_outputfile}")
|
||||
)
|
||||
configure_file("${CMAKE_CURRENT_LIST_DIR}/../${toolchain_file}" "${toolchain_outputfile}" @ONLY)
|
||||
configure_file(
|
||||
"${CMAKE_CURRENT_LIST_DIR}/../${toolchain_file}" "${toolchain_outputfile}.temp" @ONLY
|
||||
)
|
||||
if(EXISTS "${toolchain_outputfile}")
|
||||
file(READ "${toolchain_outputfile}.temp" filea)
|
||||
file(READ "${toolchain_outputfile}" fileb)
|
||||
if(NOT "${filea}" STREQUAL "${fileb}")
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"Config changes have resulted in a different toolchain file. This is not supported"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
file(RENAME "${toolchain_outputfile}.temp" "${toolchain_outputfile}")
|
||||
set(CMAKE_TOOLCHAIN_FILE "${toolchain_outputfile}" CACHE PATH "")
|
||||
endif()
|
||||
|
||||
Reference in New Issue
Block a user