From 87ab394510cb58aee6fcafdaf87d06323d81157c Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Fri, 27 Dec 2019 03:46:56 +0200 Subject: [PATCH] Fetch BoostFetch.cmake from boostorg/cmake --- CMakeLists.txt | 9 +++- cmake/BoostFetch.cmake | 97 ------------------------------------------ 2 files changed, 8 insertions(+), 98 deletions(-) delete mode 100644 cmake/BoostFetch.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index f636a11..5f39d42 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,7 +18,14 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) # Fetch support files - include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/BoostFetch.cmake") + message(STATUS "Fetching BoostFetch.cmake") + + file(DOWNLOAD + "https://raw.githubusercontent.com/boostorg/cmake/develop/include/BoostFetch.cmake" + "${CMAKE_BINARY_DIR}/fetch_and_include/BoostFetch.cmake" + ) + + include("${CMAKE_BINARY_DIR}/fetch_and_include/BoostFetch.cmake") boost_fetch(boostorg/cmake TAG develop NO_ADD_SUBDIR) diff --git a/cmake/BoostFetch.cmake b/cmake/BoostFetch.cmake deleted file mode 100644 index 32dcf83..0000000 --- a/cmake/BoostFetch.cmake +++ /dev/null @@ -1,97 +0,0 @@ -# Copyright 2018, 2019 Peter Dimov -# Distributed under the Boost Software License, Version 1.0. -# See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt - -if(NOT CMAKE_VERSION VERSION_LESS 3.10) - include_guard() -endif() - -if(NOT COMMAND FetchContent_Populate) - - if(CMAKE_VERSION VERSION_LESS 3.11) - - message(STATUS "Fetching FetchContent.cmake") - - file(DOWNLOAD - "https://gitlab.kitware.com/cmake/cmake/raw/v3.11.3/Modules/FetchContent.cmake" - "${CMAKE_BINARY_DIR}/Modules/FetchContent.cmake" - ) - - file(DOWNLOAD - "https://gitlab.kitware.com/cmake/cmake/raw/v3.11.3/Modules/FetchContent/CMakeLists.cmake.in" - "${CMAKE_BINARY_DIR}/Modules/FetchContent/CMakeLists.cmake.in" - ) - - include(${CMAKE_BINARY_DIR}/Modules/FetchContent.cmake) - - else() - - include(FetchContent) - - endif() - -endif() - -function(boost_fetch) - - cmake_parse_arguments(_ "EXCLUDE_FROM_ALL;NO_ADD_SUBDIR" "TAG" "" ${ARGN}) - - if(NOT __UNPARSED_ARGUMENTS) - - message(FATAL_ERROR "boost_fetch: missing required argument, repository name") - return() - - endif() - - list(GET __UNPARSED_ARGUMENTS 0 REPO) - list(REMOVE_AT __UNPARSED_ARGUMENTS 0) - - if(__UNPARSED_ARGUMENTS) - - message(WARNING "boost_fetch: extra arguments ignored: ${__UNPARSED_ARGUMENTS}") - - endif() - - if(NOT __TAG) - - set(__TAG master) - - endif() - - string(MAKE_C_IDENTIFIER ${REPO} NAME) - - if(CMAKE_VERSION VERSION_LESS 3.6) - - FetchContent_Declare(${NAME} QUIET GIT_REPOSITORY "https://github.com/${REPO}" GIT_TAG ${__TAG}) - - else() - - FetchContent_Declare(${NAME} QUIET GIT_REPOSITORY "https://github.com/${REPO}" GIT_TAG ${__TAG} GIT_SHALLOW 1) - - endif() - - FetchContent_GetProperties(${NAME}) - - if(NOT ${NAME}_POPULATED) - - message(STATUS "Fetching ${REPO}:${__TAG}") - - FetchContent_Populate(${NAME}) - - if(__NO_ADD_SUBDIR) - - # Skip add_subdirectory - - elseif(__EXCLUDE_FROM_ALL) - - add_subdirectory(${${NAME}_SOURCE_DIR} ${${NAME}_BINARY_DIR} EXCLUDE_FROM_ALL) - - else() - - add_subdirectory(${${NAME}_SOURCE_DIR} ${${NAME}_BINARY_DIR}) - - endif() - - endif() - -endfunction(boost_fetch)