cmake: Add seL4Config.cmake include CMakeLists.txt

seL4Config.cmake is responsible for generating a valid
CMAKE_TOOLCHAIN_FILE and setting up platform config options at the start
of the build. The CMAKE_TOOLCHAIN_FILE variable has to be set before the
first cmake `project()` function is processed to take effect.
Previously this file was required to be imported in a CMake script
before the kernel's CMakeLists.txt could be processed. This prevented
the main CMakeLists.txt file from being used without an additional
configuration file:
cmake -G Ninja -C ../configs/ARM_verified.cmake ../

Now it is possible to do:
cmake -G Ninja -DKernelPlatform=imx6 -DKernelARMPlatform=sabre ../

This should make it easier to invoke CMake for building kernel
configurations from other build environments.

Because this file is now imported in the Kernel's CMakeLists.txt
context, there is no longer a requirement to save all the intermediate
settings into the cache and then read them out again.

Signed-off-by: Kent McLeod <kent@kry10.com>
This commit is contained in:
Kent McLeod
2021-06-19 17:29:36 +10:00
committed by Gerwin Klein
parent 82e7a0251d
commit b05d681621
10 changed files with 15 additions and 102 deletions

View File

@@ -19,16 +19,16 @@ set(CMAKE_STAGING_PREFIX "${CMAKE_BINARY_DIR}/staging")
set(sel4_arch @KernelSel4Arch@)
set(arch @KernelArch@)
set(mode @KernelWordSize@)
set(cross_prefix @CROSS_COMPILER_PREFIX@)
set(cross_prefix @cross_prefix@)
# If this file is used without templating, then cross_prefix will
# have an invalid value and should only be assigned to CROSS_COMPILER_PREFIX
# if it has been set to something different.
# We need to build the test string dynamically otherwise the templating would
# overwrite it.
set(cross_prefix_test @CROSS_COMPILER_PREFIX)
set(cross_prefix_test @cross_prefix)
string(APPEND cross_prefix_test @)
if(NOT "${cross_prefix}" STREQUAL "${cross_prefix_test}")
if((NOT "${cross_prefix}" STREQUAL "${cross_prefix_test}") AND (NOT "${cross_prefix}" STREQUAL ""))
set(CROSS_COMPILER_PREFIX ${cross_prefix})
endif()