forked from MOLAorg/mola_common
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmola-xxx-config.cmake.in
35 lines (32 loc) · 1.42 KB
/
mola-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
include(CMakeFindDependencyMacro)
# Hints to help CMake finding my dependencies (and theirs own), as well as
# other future calls to search for other mola modules from our parent scope:
# 1: MOLA_DIR cmake var:
if (NOT "${MOLA_DIR}" STREQUAL "")
list(APPEND CMAKE_PREFIX_PATH "${MOLA_DIR}")
# If the user defines MOLA_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_mola_dir "${MOLA_DIR}" ABSOLUTE)
if ((EXISTS "${MOLA_DIR}/@[email protected]") AND (NOT "${this_dir}" STREQUAL "${user_mola_dir}"))
message("@MOLA_MODULE_NAME@_DIR was: ${@MOLA_MODULE_NAME@_DIR}")
set(@MOLA_MODULE_NAME@_DIR "${MOLA_DIR}" CACHE PATH "Path to @MOLA_MODULE_NAME@" FORCE)
include(${MOLA_DIR}/@[email protected])
return()
endif()
endif()
# 2) The current (and parent) path:
list(APPEND CMAKE_PREFIX_PATH "${CMAKE_CURRENT_LIST_DIR}")
list(APPEND CMAKE_PREFIX_PATH "${CMAKE_CURRENT_LIST_DIR}/../")
list(REMOVE_DUPLICATES CMAKE_PREFIX_PATH)
# Search for dependencies first:
set(_deps "@ALL_DEPS_LIST@")
foreach(_dep ${_deps}) # NO quotes for the list to be a CMake list!
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}/@[email protected])