]>
Commit | Line | Data |
---|---|---|
1 | # Copyright Louis Dionne 2013-2017 | |
2 | # Distributed under the Boost Software License, Version 1.0. | |
3 | # (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) | |
4 | # | |
5 | # This file was adapted from FindMeta.cmake at https://github.com/ericniebler/meta. | |
6 | # | |
7 | # | |
8 | # This CMake module finds the Meta include directory. This module sets the | |
9 | # following CMake variables: | |
10 | # | |
11 | # Meta_FOUND | |
12 | # Set to 1 when the Meta include directory is found, 0 otherwise. | |
13 | # | |
14 | # Meta_INCLUDE_DIR | |
15 | # If the Meta include directory is found, this is set to the path of that | |
16 | # directory. Otherwise, this is not set. | |
17 | # | |
18 | # | |
19 | # The following variables can be used to customize the behavior of the module: | |
20 | # | |
21 | # Meta_INCLUDE_DIR | |
22 | # The path to the Meta include directory. When set, this will be used as-is. | |
23 | # | |
24 | # Meta_CLONE_IF_MISSING | |
25 | # If the Meta include directory can't be found and this is set to true, | |
26 | # the Meta project will be cloned locally. | |
27 | ||
28 | if (NOT EXISTS "${Meta_INCLUDE_DIR}") | |
29 | find_path(Meta_INCLUDE_DIR NAMES meta/meta.hpp | |
30 | DOC "Meta library header files") | |
31 | endif() | |
32 | ||
33 | if (NOT EXISTS "${Meta_INCLUDE_DIR}" AND Meta_CLONE_IF_MISSING) | |
34 | include(ExternalProject) | |
35 | ExternalProject_Add(meta EXCLUDE_FROM_ALL 1 | |
36 | GIT_REPOSITORY https://github.com/ericniebler/meta | |
37 | TIMEOUT 5 | |
38 | CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS} | |
39 | PREFIX "${CMAKE_CURRENT_BINARY_DIR}" | |
40 | BUILD_COMMAND "" # Disable build step | |
41 | INSTALL_COMMAND "" # Disable install step | |
42 | TEST_COMMAND "" # Disable test step | |
43 | ) | |
44 | ||
45 | ExternalProject_Get_Property(meta SOURCE_DIR) | |
46 | set(Meta_INCLUDE_DIR "${SOURCE_DIR}/include") | |
47 | endif() | |
48 | ||
49 | include(FindPackageHandleStandardArgs) | |
50 | find_package_handle_standard_args(Meta | |
51 | FOUND_VAR Meta_FOUND | |
52 | REQUIRED_VARS Meta_INCLUDE_DIR) |