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# 6# This CMake module finds the MPL11 include directory. This module sets the 7# following CMake variables: 8# 9# MPL11_FOUND 10# Set to 1 when the MPL11 include directory is found, 0 otherwise. 11# 12# MPL11_INCLUDE_DIR 13# If the MPL11 include directory is found, this is set to the path of that 14# directory. Otherwise, this is not set. 15# 16# 17# The following variables can be used to customize the behavior of the module: 18# 19# MPL11_INCLUDE_DIR 20# The path to the MPL11 include directory. When set, this will be used as-is. 21# 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. 25 26if (NOT EXISTS "${MPL11_INCLUDE_DIR}") 27 find_path(MPL11_INCLUDE_DIR NAMES boost/mpl11/mpl11.hpp 28 DOC "MPL11 library header files") 29endif() 30 31if (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 35 TIMEOUT 5 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 41 ) 42 43 ExternalProject_Get_Property(MPL11 SOURCE_DIR) 44 set(MPL11_INCLUDE_DIR "${SOURCE_DIR}/include") 45endif() 46 47include(FindPackageHandleStandardArgs) 48find_package_handle_standard_args(MPL11 DEFAULT_MSG MPL11_INCLUDE_DIR) 49