Skip to content

Commit 54850d4

Browse files
committed
fetch submodule
1 parent d835aed commit 54850d4

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

CMakeLists.txt

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,28 @@ set(CXX_DISABLE_WERROR TRUE)
3535
set(CMAKE_VERBOSE_MAKEFILE TRUE)
3636
set(PROJECT_CUSTOM_HEADER_EXTENSION "hpp")
3737

38+
# Check if the submodule cmake have been initialized
39+
set(JRL_CMAKE_MODULES "${CMAKE_CURRENT_LIST_DIR}/cmake")
40+
if(NOT EXISTS "${CMAKE_SOURCE_DIR}/cmake/base.cmake")
41+
if(${CMAKE_VERSION} VERSION_LESS "3.14.0")
42+
message(
43+
FATAL_ERROR
44+
"\nPlease run the following command first:\ngit submodule update --init\n"
45+
)
46+
else()
47+
message(STATUS "JRL cmakemodules not found. Let's fetch it.")
48+
include(FetchContent)
49+
FetchContent_Declare(
50+
"jrl-cmakemodules"
51+
GIT_REPOSITORY "https://github.com/jrl-umi3218/jrl-cmakemodules.git")
52+
FetchContent_MakeAvailable("jrl-cmakemodules")
53+
FetchContent_GetProperties("jrl-cmakemodules" SOURCE_DIR JRL_CMAKE_MODULES)
54+
endif()
55+
endif()
56+
3857
# JRL-cmakemodule setup
39-
include(cmake/base.cmake)
40-
include(cmake/boost.cmake)
58+
include("${JRL_CMAKE_MODULES}/base.cmake")
59+
include("${JRL_CMAKE_MODULES}/boost.cmake")
4160

4261
# Project definition
4362
compute_project_args(PROJECT_ARGS LANGUAGES CXX)

0 commit comments

Comments
 (0)