diff --git a/CMakeLists.txt b/CMakeLists.txt index 78be3ae9e9d3c7ff7f5a2baeb3797e057c0715c5..e10c0eae577263704d877d9dee88c19fbae142b1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,8 +18,27 @@ endif(NOT INSTALL_PYTHON_INTERFACE_ONLY) set(CUSTOM_HEADER_DIR ${PROJECT_NAME}) set(PROJECT_COMPATIBILITY_VERSION AnyNewerVersion) +# Check if the submodule cmake have been initialized +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() + # JRL-cmakemodule setup -include(cmake/base.cmake) +include("${JRL_CMAKE_MODULES}/base.cmake") # Print initial message message(STATUS "${PROJECT_DESCRIPTION}, version ${PROJECT_VERSION}")