Use FetchContent() instead of submodules

This commit is contained in:
Jonathan Müller 2021-02-17 13:44:04 +01:00
commit 27ac5b7003
4 changed files with 9 additions and 17 deletions

6
.gitmodules vendored
View file

@ -1,6 +0,0 @@
[submodule "external/type_safe"]
path = external/type_safe
url = https://github.com/foonathan/type_safe
[submodule "external/cxxopts"]
path = external/cxxopts
url = https://github.com/jarro2783/cxxopts

1
external/cxxopts vendored

@ -1 +0,0 @@
Subproject commit 073dd3e645fa0c853c3836f3788ca21c39af319d

View file

@ -2,15 +2,16 @@
# This file is subject to the license terms in the LICENSE file # This file is subject to the license terms in the LICENSE file
# found in the top-level directory of this distribution. # found in the top-level directory of this distribution.
include(FetchContent)
# #
# install type safe # install type safe
# #
find_package(type_safe QUIET) find_package(type_safe QUIET)
if(NOT type_safe_FOUND) if(NOT type_safe_FOUND)
message(STATUS "Installing type_safe via submodule") message(STATUS "Fetching type_safe")
execute_process(COMMAND git submodule update --init -- external/type_safe FetchContent_Declare(type_safe GIT_REPOSITORY https://github.com/foonathan/type_safe GIT_TAG origin/main)
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) FetchContent_MakeAvailable(type_safe)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/external/type_safe EXCLUDE_FROM_ALL)
endif() endif()
# #
@ -28,12 +29,11 @@ target_link_libraries(_cppast_tiny_process INTERFACE tiny-process-library::tiny-
# install cxxopts, if needed # install cxxopts, if needed
# #
if(build_tool) if(build_tool)
message(STATUS "Installing cxxopts via submodule") set(CXXOPTS_BUILD_TESTS OFF CACHE BOOL "")
execute_process(COMMAND git submodule update --init -- external/cxxopts
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
set(CXXOPTS_BUILD_TESTS OFF) message(STATUS "Fetching cxxopts")
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/external/cxxopts EXCLUDE_FROM_ALL) FetchContent_Declare(cxxopts URL https://github.com/jarro2783/cxxopts/archive/v2.2.1.zip)
FetchContent_MakeAvailable(cxxopts)
endif() endif()
# #

1
external/type_safe vendored

@ -1 +0,0 @@
Subproject commit ac4dfc790f19f66097476bcae2fcd37d6fc05e23