use rohrkabel as submodule and update it to v1.2

This commit is contained in:
Malte Jürgens
2022-07-26 16:33:34 +02:00
parent 6492cb9a35
commit bc59458e19
6 changed files with 98 additions and 74 deletions

View File

@@ -22,14 +22,26 @@ set(discord-screenaudio_SRC
resources.qrc
)
include(FetchContent)
# Adapted from https://cliutils.gitlab.io/modern-cmake/chapters/projects/submodule.html
find_package(Git QUIET)
if(GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git")
option(GIT_SUBMODULE "Check submodules during build" ON)
if(GIT_SUBMODULE)
message(STATUS "Updating submodules")
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
RESULT_VARIABLE GIT_SUBMOD_RESULT)
if(NOT GIT_SUBMOD_RESULT EQUAL "0")
message(FATAL_ERROR "`git submodule update --init --recursive` failed with ${GIT_SUBMOD_RESULT}, please provide the submodules manually")
endif()
endif()
endif()
FetchContent_Declare(
rohrkabel
GIT_REPOSITORY "https://github.com/Soundux/rohrkabel"
GIT_TAG "d87403f48d3a95aa4bcf4cd60112d9e4bb090d5d"
)
FetchContent_MakeAvailable(rohrkabel)
if(NOT EXISTS "${PROJECT_SOURCE_DIR}/submodules/rohrkabel/CMakeLists.txt")
message(FATAL_ERROR "Rohrkabel was not found since you are not in a Git checkout or have GIT_SUBMODULE disabled. Please provide rohrkabel manually to `./submodules/rohrkabel`.")
endif()
add_subdirectory(submodules/rohrkabel)
add_executable(discord-screenaudio ${discord-screenaudio_SRC})