Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Anton3 committed Dec 12, 2024
1 parent 1c7dfee commit 1e8dfd4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ jobs:
restore-keys: |
${{matrix.os}} ${{matrix.info}} ccache-dir ${{github.ref}} run-'
${{matrix.os}} ${{matrix.info}} ccache-
- name: Install packages
run: |
DEPS_FILE="https://raw.githubusercontent.com/userver-framework/userver/refs/heads/develop/scripts/docs/en/deps/${{matrix.os}}.md"
Expand Down
11 changes: 8 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,16 @@ project(service_template CXX)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
include(DownloadUserver)

find_package(userver COMPONENTS core postgresql QUIET)
find_package(userver COMPONENTS core QUIET)
if(NOT userver_FOUND)
# download_userver() tries TRY_DIR first, fallbacks to downloading userver from github
download_userver(TRY_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/userver")
# Tries TRY_DIR first, fallbacks to downloading userver using CPM.
download_userver(
TRY_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/userver"
GITHUB_REPOSITORY userver-framework/userver
GIT_TAG develop
)
endif()

userver_setup_environment()


Expand Down
10 changes: 3 additions & 7 deletions cmake/DownloadUserver.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,11 @@ include_guard(GLOBAL)

function(download_userver)
set(OPTIONS)
set(ONE_VALUE_ARGS VERSION TRY_DIR)
set(ONE_VALUE_ARGS TRY_DIR)
set(MULTI_VALUE_ARGS OPTIONS)
cmake_parse_arguments(
ARG "${OPTIONS}" "${ONE_VALUE_ARGS}" "${MULTI_VALUE_ARGS}" ${ARGN}
)
if(NOT ARG_VERSION)
set(ARG_VERSION develop)
endif()

if(ARG_TRY_DIR AND EXISTS "${ARG_TRY_DIR}")
foreach(OPTION IN LIST ARG_OPTIONS)
Expand All @@ -27,8 +24,7 @@ function(download_userver)
include(get_cpm)
CPMAddPackage(
NAME userver
GITHUB_REPOSITORY userver-framework/userver
GIT_TAG "${ARG_VERSION}"
OPTIONS ${ARG_OPTIONS}
${ARG_UNPARSED_ARGUMENTS}
OPTIONS ${OPTIONS}
)
endfunction()

0 comments on commit 1e8dfd4

Please sign in to comment.