ned14 / outcome

Provides very lightweight outcome<T> and result<T> (non-Boost edition)
https://ned14.github.io/outcome
Other
676 stars 62 forks source link

Error when downloading outcome with CMake FetchContent #200

Closed DaanDeMeyer closed 4 years ago

DaanDeMeyer commented 4 years ago

Reproduce:

cmake_minimum_required(VERSION 3.15)

project(outcome-reproduce)

include(FetchContent)

FetchContent_Declare(
  outcome
  GIT_REPOSITORY https://github.com/ned14/outcome/
  GIT_TAG v2.1
)

FetchContent_MakeAvailable(outcome)
DaanDeMeyer commented 4 years ago

Same problem when using the archive:

cmake_minimum_required(VERSION 3.15)

project(outcome-reproduce)

include(FetchContent)

FetchContent_Declare(
  outcome
  URL https://dedi5.nedprod.com/static/files/outcome-v2.0-source-latest.tar.xz
)

FetchContent_MakeAvailable(outcome)

Trying v2.1 in the url gave me a 404 so I'm assuming v2.0 is the latest archive available. The error here happens because CMake tries to get a git submodule which isn't available from the archive since it has no git information available.

When using FetchContent with git it crashes because some CMake script thinks an in-source build is happening even though FetchContent puts source and binary directories completely separate in the build folder.

ned14 commented 4 years ago

Bug reproduced. Thanks for the BR.

ned14 commented 4 years ago

Fixed. Thanks for the BR!