diff --git a/CMakeLists.txt b/CMakeLists.txt index c3ad58070b8e3e6ec270b0711463fe473fae4a3c..91d4eb532c2b87ac1d56dff3bd909c0629da5576 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,9 +53,27 @@ set(DOXYGEN_USE_MATHJAX YES) set(CMAKE_VERBOSE_MAKEFILE TRUE) # JRL-cmakemodule setup -include(cmake/base.cmake) -include(cmake/ide.cmake) -include(cmake/apple.cmake) +set(JRL_CMAKE_MODULES "${CMAKE_CURRENT_LIST_DIR}/cmake") +if(NOT EXISTS "${CMAKE_SOURCE_DIR}/cmake/base.cmake") + if(${CMAKE_VERSION} VERSION_LESS "3.14.0") + message( + FATAL_ERROR + "\nPlease run the following command first:\ngit submodule update --init\n" + ) + else() + message(STATUS "JRL cmakemodules not found. Let's fetch it.") + include(FetchContent) + FetchContent_Declare( + "jrl-cmakemodules" + GIT_REPOSITORY "https://github.com/jrl-umi3218/jrl-cmakemodules.git") + FetchContent_MakeAvailable("jrl-cmakemodules") + FetchContent_GetProperties("jrl-cmakemodules" SOURCE_DIR JRL_CMAKE_MODULES) + endif() +endif() + +include("${JRL_CMAKE_MODULES}/base.cmake") +include("${JRL_CMAKE_MODULES}/ide.cmake") +include("${JRL_CMAKE_MODULES}/apple.cmake") # Handle APPLE Cmake policy if(APPLE)