Skip to content

Commit

Permalink
add cache_hello_imgui_paths.cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
pthom committed Dec 18, 2023
1 parent a9dd541 commit 8142dbc
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
5 changes: 2 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ endif()

set(CMAKE_CXX_STANDARD 17)

include(${CMAKE_CURRENT_LIST_DIR}/hello_imgui_cmake/utils/cache_hello_imgui_paths.cmake)

###############################################################################
# hello_imgui_add_app
###############################################################################
Expand All @@ -28,9 +30,7 @@ set(CMAKE_CXX_STANDARD 17)
# * It will automatically link the target to the required libraries (hello_imgui, OpenGl, glad, etc)
# * It will embed the assets (for desktop, mobile, and emscripten apps)
# * It will perform additional customization (app icon and name on mobile platforms, etc)
set(HELLOIMGUI_CMAKE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/hello_imgui_cmake CACHE STRING "" FORCE)
# Make cmake function `hello_imgui_add_app` available
list(APPEND CMAKE_MODULE_PATH ${HELLOIMGUI_CMAKE_PATH})
include(hello_imgui_add_app)


Expand Down Expand Up @@ -323,7 +323,6 @@ endif()
#------------------------------------------------------------------------------
# Main build actions
#------------------------------------------------------------------------------
set(HELLOIMGUI_BASEPATH ${CMAKE_CURRENT_LIST_DIR} CACHE STRING "Hello imgui base path" FORCE)
include(cmake/StandardProjectSettings.cmake)
include(cmake/StaticAnalyzers.cmake)
include(msvc/msvc_target_group)
Expand Down
2 changes: 2 additions & 0 deletions hello_imgui_cmake/hello_imgui_add_app.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
include(${CMAKE_CURRENT_LIST_DIR}/utils/cache_hello_imgui_paths.cmake)

#
# hello_imgui_add_app is a helper function, similar to cmake's "add_executable"
#
Expand Down
7 changes: 7 additions & 0 deletions hello_imgui_cmake/utils/cache_hello_imgui_paths.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
set(helloimgui_basepath ${CMAKE_CURRENT_LIST_DIR}/../..)
# change helloimgui_basepath to absolute path
get_filename_component(helloimgui_basepath ${helloimgui_basepath} ABSOLUTE)

set(HELLOIMGUI_BASEPATH ${helloimgui_basepath} CACHE STRING "Hello imgui base path" FORCE)
set(HELLOIMGUI_CMAKE_PATH ${HELLOIMGUI_BASEPATH}/hello_imgui_cmake CACHE STRING "Hello imgui cmake path" FORCE)
list(APPEND CMAKE_MODULE_PATH ${HELLOIMGUI_CMAKE_PATH})

0 comments on commit 8142dbc

Please sign in to comment.