Skip to content

Commit

Permalink
[cmake] add error and warning if missing submodule
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
tgfrerer committed Jan 8, 2024
1 parent 2102510 commit 12ef73a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions modules/le_imgui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 )

Expand Down

0 comments on commit 12ef73a

Please sign in to comment.