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)
6 # This CMake module finds the MPL11 include directory. This module sets the
7 # following CMake variables:
10 # Set to 1 when the MPL11 include directory is found, 0 otherwise.
13 # If the MPL11 include directory is found, this is set to the path of that
14 # directory. Otherwise, this is not set.
17 # The following variables can be used to customize the behavior of the module:
20 # The path to the MPL11 include directory. When set, this will be used as-is.
22 # MPL11_CLONE_IF_MISSING
23 # If the MPL11 include directory can't be found and this is set to true,
24 # the MPL11 project will be cloned locally.
26 if (NOT EXISTS "${MPL11_INCLUDE_DIR}")
27 find_path(MPL11_INCLUDE_DIR NAMES boost/mpl11/mpl11.hpp
28 DOC "MPL11 library header files")
31 if (NOT EXISTS "${MPL11_INCLUDE_DIR}" AND MPL11_CLONE_IF_MISSING)
32 include(ExternalProject)
33 ExternalProject_Add(MPL11 EXCLUDE_FROM_ALL 1
34 GIT_REPOSITORY https://github.com/ldionne/mpl11
36 CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
37 PREFIX "${CMAKE_CURRENT_BINARY_DIR}"
38 BUILD_COMMAND "" # Disable build step
39 INSTALL_COMMAND "" # Disable install step
40 TEST_COMMAND "" # Disable test step
43 ExternalProject_Get_Property(MPL11 SOURCE_DIR)
44 set(MPL11_INCLUDE_DIR "${SOURCE_DIR}/include")
47 include(FindPackageHandleStandardArgs)
48 find_package_handle_standard_args(MPL11 DEFAULT_MSG MPL11_INCLUDE_DIR)