-
Notifications
You must be signed in to change notification settings - Fork 58
/
globjects-config.cmake
65 lines (52 loc) · 1.5 KB
/
globjects-config.cmake
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# This config script tries to locate the project either in its source tree
# or from an install location.
#
# Please adjust the list of submodules to search for.
# find dependencies for globjects
# - glbindings must searched for before MODULE_NAMES declaration, otherwise it
# glbinding-config.cmake overwrites the variable MODULE_NAMES
include(CMakeFindDependencyMacro)
if (NOT TARGET glm::glm)
find_dependency(glm)
endif ()
if (NOT TARGET glbinding::glbinding)
find_dependency(glbinding)
endif ()
find_package(Eigen3 3.3 QUIET)
# List of modules
set(MODULE_NAMES
globjects
)
# Macro to search for a specific module
macro(find_module FILENAME)
if(EXISTS "${FILENAME}")
set(MODULE_FOUND TRUE)
include("${FILENAME}")
endif()
endmacro()
# Macro to search for all modules
macro(find_modules PREFIX)
foreach(module_name ${MODULE_NAMES})
if(TARGET ${module_name})
set(MODULE_FOUND TRUE)
else()
find_module("${CMAKE_CURRENT_LIST_DIR}/${PREFIX}/${module_name}/${module_name}-export.cmake")
endif()
endforeach(module_name)
endmacro()
# Try install location
set(MODULE_FOUND FALSE)
find_modules("cmake")
if(MODULE_FOUND)
return()
endif()
# Try common build locations
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
find_modules("build-debug/cmake")
find_modules("build/cmake")
else()
find_modules("build/cmake")
find_modules("build-debug/cmake")
endif()
# Signal success/failure to CMake
set(globjects_FOUND ${MODULE_FOUND})