Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,20 @@ target_include_directories(${PROJECT_NAME} PUBLIC "include")
# Link required libraries
# --------------------------------------------------------------------------------------------------------

include(FetchContent)
find_path(EXPECTED_INCLUDE_DIRS "tl/expected.hpp")

FetchContent_Declare(expected GIT_REPOSITORY "https://github.com/TartanLlama/expected")

option(EXPECTED_BUILD_TESTS "" OFF)
option(EXPECTED_BUILD_PACKAGE "" OFF)
FetchContent_MakeAvailable(expected)
if(EXPECTED_INCLUDE_DIRS)
message(STATUS "Using system-installed tl::expected")
add_library(tl_expected INTERFACE)
target_include_directories(tl_expected INTERFACE ${EXPECTED_INCLUDE_DIRS})
add_library(tl::expected ALIAS tl_expected)
else()
message(STATUS "Fetching tl::expected from GitHub")
include(FetchContent)
FetchContent_Declare(expected GIT_REPOSITORY "https://github.com/TartanLlama/expected")
option(EXPECTED_BUILD_TESTS "" OFF)
option(EXPECTED_BUILD_PACKAGE "" OFF)
FetchContent_MakeAvailable(expected)

target_link_libraries(${PROJECT_NAME} PUBLIC tl::expected)

Expand Down