Skip to content

Commit

Permalink
Merge pull request #269 from BurningEnlightenment/dev/system-status-c…
Browse files Browse the repository at this point in the history
…ode-fixes

Fix inclusion of system provided status code
  • Loading branch information
ned14 authored Aug 18, 2022
2 parents c3dfcf4 + 34a0967 commit ad18234
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
23 changes: 10 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,6 @@ include(QuickCppLibRequireOutOfSourceBuild)
include(QuickCppLibUtils)
include(QuickCppLibPolicies)

if(OUTCOME_BUNDLE_EMBEDDED_STATUS_CODE)
ensure_git_subrepo("${CMAKE_CURRENT_SOURCE_DIR}/include/outcome/experimental/status-code/include" "https://github.com/ned14/status-code.git")
else()
find_quickcpplib_library(status-code
GIT_REPOSITORY "https://github.com/ned14/status-code.git"
GIT_TAG "${OUTCOME_DEPENDENCY_STATUS_CODE_GIT_TAG}"
REQUIRED
IS_HEADER_ONLY
)
endif()

# Parse the version we tell cmake directly from the version header file
ParseProjectVersionFromHpp("${CMAKE_CURRENT_SOURCE_DIR}/include/outcome/detail/version.hpp" VERSIONSTRING)
# Sets the usual PROJECT_NAME etc
Expand Down Expand Up @@ -99,8 +88,16 @@ else()
IS_HEADER_ONLY
)
endif()
if (NOT OUTCOME_BUNDLE_EMBEDDED_STATUS_CODE)
list_filter(${PROJECT_NAME}_HEADERS EXCLUDE REGEX /status-code/include/)
if(OUTCOME_BUNDLE_EMBEDDED_STATUS_CODE)
ensure_git_subrepo("${CMAKE_CURRENT_SOURCE_DIR}/include/outcome/experimental/status-code/include" "https://github.com/ned14/status-code.git")
else()
find_quickcpplib_library(status-code
GIT_REPOSITORY "https://github.com/ned14/status-code.git"
GIT_TAG "${OUTCOME_DEPENDENCY_STATUS_CODE_GIT_TAG}"
REQUIRED
IS_HEADER_ONLY
)
list_filter(${PROJECT_NAME}_HEADERS EXCLUDE REGEX include/outcome/experimental/status-code/)
endif()

# Make an interface only library so dependent CMakeLists can bring in this header-only library
Expand Down
4 changes: 4 additions & 0 deletions include/outcome/experimental/coroutine_support.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ Distributed under the Boost Software License, Version 1.0.
OUTCOME_V2_NAMESPACE_END

#ifdef __cpp_exceptions
#if !OUTCOME_USE_SYSTEM_STATUS_CODE && __has_include("status-code/include/status-code/system_code_from_exception.hpp")
#include "status-code/include/status-code/system_code_from_exception.hpp"
#else
#include <status-code/system_code_from_exception.hpp>
#endif
OUTCOME_V2_NAMESPACE_BEGIN
namespace awaitables
{
Expand Down

0 comments on commit ad18234

Please sign in to comment.