FindMPL11.cmake 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. if (NOT EXISTS "${MPL11_INCLUDE_DIR}")
  26. find_path(MPL11_INCLUDE_DIR NAMES boost/mpl11/mpl11.hpp
  27. DOC "MPL11 library header files")
  28. endif()
  29. if (NOT EXISTS "${MPL11_INCLUDE_DIR}" AND MPL11_CLONE_IF_MISSING)
  30. include(ExternalProject)
  31. ExternalProject_Add(MPL11 EXCLUDE_FROM_ALL 1
  32. GIT_REPOSITORY https://github.com/ldionne/mpl11
  33. TIMEOUT 5
  34. CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
  35. PREFIX "${CMAKE_CURRENT_BINARY_DIR}"
  36. BUILD_COMMAND "" # Disable build step
  37. INSTALL_COMMAND "" # Disable install step
  38. TEST_COMMAND "" # Disable test step
  39. )
  40. ExternalProject_Get_Property(MPL11 SOURCE_DIR)
  41. set(MPL11_INCLUDE_DIR "${SOURCE_DIR}/include")
  42. endif()
  43. include(FindPackageHandleStandardArgs)
  44. find_package_handle_standard_args(MPL11 DEFAULT_MSG MPL11_INCLUDE_DIR)