-
Notifications
You must be signed in to change notification settings - Fork 0
/
FindArkMath.cmake
55 lines (48 loc) · 1.45 KB
/
FindArkMath.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
# - Try to find ArkMath
# Once done, this will define
#
# ARKMATH_FOUND : library found
# ARKMATH_INCLUDE_DIRS : include directories
# ARKMATH_LIBRARIES : libraries to link to
# ARKMATH_DATADIR : data directory
# ARKMATH_VERSION : version
# macros
include(FindPackageHandleStandardArgs)
set(_ARKMATH_EXTRA_SEARCH_PATHS
/usr/local
/opt/local
)
# find the include directory
find_path(_ARKMATH_INCLUDE_DIR
NAMES arkmath/storage_adaptors.hpp
PATHS ${_ARKMATH_EXTRA_SEARCH_PATHS}
PATH_SUFFIXES include
)
# find the library
find_library(_ARKMATH_LIBRARY
NAMES arkmath
PATHS ${_ARKMATH_EXTRA_SEARCH_PATHS}
PATH_SUFFIXES lib
)
# find the data directory
find_path(ARKMATH_DATADIR
NAMES arkmath/data/WMM.COF
PATHS ${_ARKMATH_EXTRA_SEARCH_PATHS}
PATH_SUFFIXES share
)
# read the version
if (EXISTS ${_ARKMATH_INCLUDE_DIR}/arkmath/config.h)
file(READ ${_ARKMATH_INCLUDE_DIR}/arkmath/config.h ARKMATH_CONFIG_FILE)
string(REGEX MATCH "#define ARKMATH_VERSION[ ]+\"(([0-9]+\\.)+[0-9]+)\""
ARKMATH_VERSION_MATCH ${ARKMATH_CONFIG_FILE})
set(ARKMATH_VERSION ${CMAKE_MATCH_1})
else()
set(ARKMATH_VERSION "")
endif()
# handle arguments
set(ARKMATH_INCLUDE_DIRS ${_ARKMATH_INCLUDE_DIR})
set(ARKMATH_LIBRARIES ${_ARKMATH_LIBRARY})
find_package_handle_standard_args(ArkMath
REQUIRED_VARS ARKMATH_LIBRARIES ARKMATH_INCLUDE_DIRS ARKMATH_DATADIR ARKMATH_VERSION
VERSION_VAR ARKMATH_VERSION
)