From 12ef73a73836b906223eb0f3c9cde77f063962e4 Mon Sep 17 00:00:00 2001 From: tgfrerer Date: Mon, 8 Jan 2024 11:09:47 +0000 Subject: [PATCH] [cmake] add error and warning if missing submodule if we're missing the imgui submodule immediately issue a warning that tells us that this is the case instead of proceeding and writing into the non-existant directory. writing into the directory causes the directory to exist, which means that subsequent attempts at updating and cloning the submodule will fail. These changes mitigate this by printing out a relevant error message and halting cmake generation at the earliest possible moment. --- modules/le_imgui/CMakeLists.txt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/modules/le_imgui/CMakeLists.txt b/modules/le_imgui/CMakeLists.txt index caa19803e..b9ff676fa 100644 --- a/modules/le_imgui/CMakeLists.txt +++ b/modules/le_imgui/CMakeLists.txt @@ -2,9 +2,15 @@ depends_on_island_module(le_pipeline_builder) depends_on_island_module(le_renderer) depends_on_island_module(le_ui_event) + # n.b. configure_file will replace any cmake variables it finds in the file with their values. -configure_file("CMakeLists.txt.imgui.in" ${ISLAND_BASE_DIR}/modules/le_imgui/3rdparty/imgui/CMakeLists.txt @ONLY) -configure_file("imconfig.h" ${ISLAND_BASE_DIR}/modules/le_imgui/3rdparty/imgui/imconfig.h COPYONLY) +if (EXISTS ${ISLAND_BASE_DIR}/modules/le_imgui/3rdparty/imgui/LICENSE.txt) + configure_file("CMakeLists.txt.imgui.in" ${ISLAND_BASE_DIR}/modules/le_imgui/3rdparty/imgui/CMakeLists.txt @ONLY) + configure_file("imconfig.h" ${ISLAND_BASE_DIR}/modules/le_imgui/3rdparty/imgui/imconfig.h COPYONLY) +else() + message( FATAL_ERROR "\nImgui git submodule not found. \nHint: Run `git submodule init; git submodule update`; first...") + +endif() add_subdirectory( 3rdparty/imgui )