forked from MRPT/mrpt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmrpt-xxx-config.cmake.in
51 lines (46 loc) · 1.87 KB
/
mrpt-xxx-config.cmake.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
include(CMakeFindDependencyMacro)
if (TARGET mrpt::@MRPT_MODULE_NAME@)
return()
endif()
# Hints to help CMake finding my dependencies (and theirs own), as well as
# other future calls to search for other mrpt modules from our parent scope:
# 1: MRPT_DIR cmake var:
if (NOT "${MRPT_DIR}" STREQUAL "")
list(APPEND CMAKE_PREFIX_PATH "${MRPT_DIR}")
# If the user defines MRPT_DIR, that path overrides whatever CMake on its own
# found (this file):
get_filename_component(this_dir "${CMAKE_CURRENT_LIST_DIR}" ABSOLUTE)
get_filename_component(user_mrpt_dir "${MRPT_DIR}" ABSOLUTE)
if ((EXISTS "${MRPT_DIR}/mrpt-@MRPT_MODULE_NAME@-config.cmake") AND (NOT "${this_dir}" STREQUAL "${user_mrpt_dir}"))
message("mrpt-@MRPT_MODULE_NAME@_DIR was: ${mrpt-@MRPT_MODULE_NAME@_DIR}")
set(mrpt-@MRPT_MODULE_NAME@_DIR "${MRPT_DIR}" CACHE PATH "Path to mrpt-@MRPT_MODULE_NAME@" FORCE)
include(${MRPT_DIR}/mrpt-@MRPT_MODULE_NAME@-config.cmake)
return()
endif()
endif()
# 2) The current (and parent) path:
cmake_policy(PUSH)
cmake_policy(SET CMP0057 NEW) # cmake>=3.3: Allow if(IN_LIST)
if(NOT "${CMAKE_CURRENT_LIST_DIR}" IN_LIST CMAKE_PREFIX_PATH)
list(APPEND CMAKE_PREFIX_PATH "${CMAKE_CURRENT_LIST_DIR}")
list(REMOVE_DUPLICATES CMAKE_PREFIX_PATH)
endif()
if(NOT "${CMAKE_CURRENT_LIST_DIR}/../" IN_LIST CMAKE_PREFIX_PATH)
list(APPEND CMAKE_PREFIX_PATH "${CMAKE_CURRENT_LIST_DIR}/../")
list(REMOVE_DUPLICATES CMAKE_PREFIX_PATH)
endif()
cmake_policy(POP)
# Search for dependencies first:
set(_deps "@ALL_DEPS_LIST@")
foreach(_dep ${_deps}) # NO quotes for the list to be a CMake list!
if (${_dep}_FOUND)
continue() # already found
endif()
find_dependency(${_dep})
if(${_dep}_FOUND)
mark_as_advanced(${_dep}_DIR)
endif()
endforeach()
@EXTRA_CONFIG_CMDS@
# Include targets for this library:
include(${CMAKE_CURRENT_LIST_DIR}/mrpt-@MRPT_MODULE_NAME@-targets.cmake)