Skip to content

Commit d70889d

Browse files
committed
Add CMake script to find MetaCall library.
1 parent 2d7be92 commit d70889d

File tree

1 file changed

+73
-0
lines changed

1 file changed

+73
-0
lines changed

FindMetaCall.cmake

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
#
2+
# CMake Find MetaCall library by Parra Studios
3+
# CMake script to find and include MetaCall library for development.
4+
#
5+
# Copyright (C) 2016 - 2019 Vicente Eduardo Ferrer Garcia <[email protected]>
6+
#
7+
# Licensed under the Apache License, Version 2.0 (the "License");
8+
# you may not use this file except in compliance with the License.
9+
# You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing, software
14+
# distributed under the License is distributed on an "AS IS" BASIS,
15+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
# See the License for the specific language governing permissions and
17+
# limitations under the License.
18+
#
19+
20+
# Find MetaCall library and include paths
21+
#
22+
# METACALL_FOUND - True if MetaCall library was found
23+
# METACALL_INCLUDE_DIRS - MetaCall headers path
24+
# METACALL_LIBRARIES - List of MetaCall libraries
25+
# METACALL_DEFINITIONS - MetaCall definitions
26+
27+
# Prevent vervosity if already included
28+
if(METACALL_FOUND)
29+
set(METACALL_FIND_QUITELY TRUE)
30+
endif()
31+
32+
# Optional root directory
33+
set(METACALL_ROOT_DIR "$ENV{WORKSPACE_ROOT}/metacall")
34+
35+
# Default includes install location
36+
set(METACALL_INCLUDE_PATHS
37+
"${METACALL_ROOT_DIR}"
38+
"/usr/local/include"
39+
)
40+
41+
# MetaCall include path
42+
find_path(METACALL_INCLUDE_DIR
43+
NAMES metacall/metacall.h
44+
PATHS ${METACALL_INCLUDE_PATHS}
45+
DOC "MetaCall includes"
46+
)
47+
48+
# Default library install location
49+
set(METACALL_LIBRARY_PATHS
50+
"${METACALL_ROOT_DIR}"
51+
"/usr/local/lib"
52+
)
53+
54+
# MetaCall library path
55+
find_library(METACALL_LIBRARY
56+
NAMES metacall
57+
PATHS ${METACALL_LIBRARY_PATHS}
58+
DOC "MetaCall library"
59+
)
60+
61+
# Find package
62+
include(FindPackageHandleStandardArgs)
63+
64+
find_package_handle_standard_args(METACALL DEFAULT_MSG METACALL_INCLUDE_DIR METACALL_LIBRARY)
65+
66+
if(METACALL_FOUND)
67+
set(METACALL_LIBRARIES ${METACALL_LIBRARY})
68+
set(METACALL_INCLUDE_DIRS ${METACALL_INCLUDE_DIR})
69+
set(METACALL_DEFINITIONS)
70+
endif()
71+
72+
# Ignore local variables
73+
mark_as_advanced(METACALL_INCLUDE_DIRS METACALL_LIBRARIES METACALL_DEFINITIONS)

0 commit comments

Comments
 (0)