sel4test
sel4test copied to clipboard
CMake: allow skipping include of settings.cmake
My build system currently sets up everything and then uses add_subdirectory() to include sel4test. This patch allow building sel4test then. Maybe there is a smarter solution here by impersonating settings.cmake somehow to this does nothing?
What is your build system setting up before including sel4test? Could you instead include add_subdirectory(apps/sel4test-driver) instead of the toplevel CMakeLists.txt that currently expects to setup the elfloader and kernel.elf targets?
Our build system basically does what settings.cmake does and that conflicts. The goal is being able to use existing seL4 projects like this without modification, so we don't have to create another wrapper project. Having the switch SEL4TEST_DONT_USE_SEL4_DEFAULT_BUILD_SYSTEM nicely solves this.
The goal is being able to use existing seL4 projects like this without modification, so we don't have to create another wrapper project.
But isn't this already a modification? The coupling between settings.cmake and CMakeLists.txt isn't a stable public interface. settings.cmake contains many sel4test specific options and options can be moved between CMakeLists.txt and settings.cmake without causing external breakages.
add_subdirectory(apps/sel4test-driver) or even using https://cmake.org/cmake/help/latest/variable/CMAKE_PROJECT_PROJECT-NAME_INCLUDE_BEFORE.html#variable:CMAKE_PROJECT_%3CPROJECT-NAME%3E_INCLUDE_BEFORE will let you include the sel4test applications into another project without requiring special modifications upstream.
Thanks, I will give this a try.
@axel-h, feel free to merge this if you still need the change
I have not found a better solution yet for our use case with a different/custom build system. I will check our internal CI one more tomorrow and merge this then. Thanks.
I think this can be merged.
@axel-h this PR should either be closed or merged — happy to merge it if it’s useful for you, otherwise I’d close it.