Skip to content

Commit 3ebdd9c

Browse files
committed
CMake: allow use of installed jrl-cmakemodule
1 parent d7857d8 commit 3ebdd9c

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

CMakeLists.txt

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,23 @@ set(PROJECT_COMPATIBILITY_VERSION AnyNewerVersion)
1414

1515
# Check if the submodule cmake have been initialized
1616
set(JRL_CMAKE_MODULES "${CMAKE_CURRENT_LIST_DIR}/cmake")
17-
if(NOT EXISTS "${CMAKE_SOURCE_DIR}/cmake/base.cmake")
18-
if(${CMAKE_VERSION} VERSION_LESS "3.14.0")
17+
if(EXISTS "${JRL_CMAKE_MODULES}/base.cmake")
18+
message(STATUS "JRL cmakemodules found in 'cmake/' git submodule")
19+
else()
20+
find_package(jrl-cmakemodules QUIET CONFIG)
21+
if(jrl-cmakemodules_FOUND)
22+
get_property(
23+
JRL_CMAKE_MODULES
24+
TARGET jrl-cmakemodules::jrl-cmakemodules
25+
PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
26+
message(STATUS "JRL cmakemodules found on system at ${JRL_CMAKE_MODULES}")
27+
elseif(${CMAKE_VERSION} VERSION_LESS "3.14.0")
1928
message(
2029
FATAL_ERROR
21-
"\nPlease run the following command first:\ngit submodule update --init\n"
30+
"\nCan't find jrl-cmakemodules. Please either:\n"
31+
" - use git submodule: 'git submodule update --init'\n"
32+
" - or install https://github.com/jrl-umi3218/jrl-cmakemodules\n"
33+
" - or upgrade your CMake version to >= 3.14 to allow automatic fetching\n"
2234
)
2335
else()
2436
message(STATUS "JRL cmakemodules not found. Let's fetch it.")

0 commit comments

Comments
 (0)