Skip to content

Commit eb2fa71

Browse files
committed
CMake: allow use of installed jrl-cmakemodule
1 parent 6760ea3 commit eb2fa71

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

CMakeLists.txt

+15-3
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,23 @@ option(HPP_FCL_ENABLE_LOGGING "Activate logging for warnings or error messages.
5555

5656
# Check if the submodule cmake have been initialized
5757
set(JRL_CMAKE_MODULES "${CMAKE_CURRENT_LIST_DIR}/cmake")
58-
if(NOT EXISTS "${CMAKE_SOURCE_DIR}/cmake/base.cmake")
59-
if(${CMAKE_VERSION} VERSION_LESS "3.14.0")
58+
if(EXISTS "${JRL_CMAKE_MODULES}/base.cmake")
59+
message(STATUS "JRL cmakemodules found in 'cmake/' git submodule")
60+
else()
61+
find_package(jrl-cmakemodules QUIET CONFIG)
62+
if(jrl-cmakemodules_FOUND)
63+
get_property(
64+
JRL_CMAKE_MODULES
65+
TARGET jrl-cmakemodules::jrl-cmakemodules
66+
PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
67+
message(STATUS "JRL cmakemodules found on system at ${JRL_CMAKE_MODULES}")
68+
elseif(${CMAKE_VERSION} VERSION_LESS "3.14.0")
6069
message(
6170
FATAL_ERROR
62-
"\nPlease run the following command first:\ngit submodule update --init\n"
71+
"\nCan't find jrl-cmakemodules. Please either:\n"
72+
" - use git submodule: 'git submodule update --init'\n"
73+
" - or install https://github.com/jrl-umi3218/jrl-cmakemodules\n"
74+
" - or upgrade your CMake version to >= 3.14 to allow automatic fetching\n"
6375
)
6476
else()
6577
message(STATUS "JRL cmakemodules not found. Let's fetch it.")

0 commit comments

Comments
 (0)