-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathFindCADET.cmake
109 lines (93 loc) · 3.66 KB
/
FindCADET.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# =============================================================================
# CADET
#
# Copyright © 2008-present: The CADET-Core Authors
# Please see the AUTHORS.md file.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the GNU Public License v3.0 (or, at
# your option, any later version) which accompanies this distribution, and
# is available at http://www.gnu.org/licenses/gpl.html
# =============================================================================
# Find CADET.
#
# On UNIX systems, this module will read the variable CADET_USE_STATIC_LIBRARIES
# to determine whether or not to prefer a static link over a dynamic link for CADET
# and all of it's dependencies. To use this feature, make sure that the
# CADET_USE_STATIC_LIBRARIES variable is set before the call to find_package.
#
# To provide the module with a hint about where to find your CADET installation,
# you can set the environment variable CADET_ROOT. The FindCADET module will then
# look in this path when searching for CADET paths and libraries.
#
# This module will define the following variables:
# CADET_INCLUDE_DIRS - Location of the CADET includes
# CADET_FOUND - true if CADET was found on the system
# CADET_LIBRARIES - Required libraries for all requested components
include(FindPackageHandleStandardArgs)
set (CADET_LIB_NAME cadet)
# Option that allows users to specify custom CADET path
if (NOT "$ENV{CADET_ROOT}" STREQUAL "")
list (APPEND CMAKE_INCLUDE_PATH "$ENV{CADET_ROOT}")
list (APPEND CMAKE_LIBRARY_PATH "$ENV{CADET_ROOT}")
#else ()
# message (STATUS "No valid environment variable 'CADET_ROOT' found, you can specify custom path in 'PATH_CADET_ROOT' cache variable")
endif ()
#if (NOT PATH_CADET_ROOT)
# set (PATH_CADET_ROOT "" CACHE STRING "Optional path to the CADET library and include direrctory" FORCE)
#else ()
# list (APPEND CMAKE_INCLUDE_PATH "${PATH_CADET_ROOT}")
# list (APPEND CMAKE_LIBRARY_PATH "${PATH_CADET_ROOT}")
#endif ()
# List of user definable search paths
set (CADET_USER_PATHS
$ENV{HOME}/.local
$ENV{HOME}
$ENV{HOME}/libs/cadet
$ENV{HOME}/opt/cadet
)
#if( CADET_INCLUDE_DIRS AND CADET_LIBRARIES )
# # Do nothing: we already have CADET_INCLUDE_PATH and CADET_LIBRARIES in the
# # cache, it would be a shame to override them
#else()
# find the CADET include directories
find_path( CADET_INCLUDE_DIRS Simulator.hpp
PATHS
${CADET_USER_PATHS}
ENV
CADET_ROOT
PATH_SUFFIXES
include
Include
)
# find the CADET libraries
if( UNIX AND CADET_USE_STATIC_LIBRARIES )
# According to bug 1643 on the CMake bug tracker, this is the
# preferred method for searching for a static library.
# See http://www.cmake.org/Bug/view.php?id=1643. We search
# first for the full static library name, but fall back to a
# generic search on the name if the static search fails.
set( THIS_LIBRARY_SEARCH lib${CADET_LIB_NAME}.a ${CADET_LIB_NAME} )
else()
set( CMAKE_FIND_LIBRARY_SUFFIXES ".lib;.dll" )
set( THIS_LIBRARY_SEARCH ${CADET_LIB_NAME} )
endif()
find_library( CADET_LIBRARIES
NAMES ${THIS_LIBRARY_SEARCH}
PATHS
${CADET_USER_PATHS}
ENV
CADET_ROOT
PATH_SUFFIXES
lib
Lib
)
#endif()
find_package_handle_standard_args( CADET DEFAULT_MSG
CADET_LIBRARIES
CADET_INCLUDE_DIRS
)
mark_as_advanced(
CADET_LIBRARIES
CADET_INCLUDE_DIRS
)