TartanLlama / expected

C++11/14/17 std::expected with functional-style extensions
https://tl.tartanllama.xyz
Creative Commons Zero v1.0 Universal
1.55k stars 135 forks source link

include could not find requested file: tl-expected-targets.cmake #115

Open Petross404 opened 2 years ago

Petross404 commented 2 years ago

Hi,

I am using FetchContent to use expected as an external dependency like this:

include(FetchContent)

FetchContent_Declare(tl-expected
                    GIT_REPOSITORY https://github.com/TartanLlama/expected.git
)

FetchContent_GetProperties(tl-expected)
if(NOT "${tl-expected_POPULATED}")
    FetchContent_Populate(tl-expected)
    add_subdirectory(${tl-expected_SOURCE_DIR} ${tl-expected_BINARY_DIR})
endif()

set(tl-expected_DIR "${CMAKE_BINARY_DIR}/_deps/tl-expected-build/")

find_package(tl-expected CONFIG REQUIRED)

But when configuring I get this error:

/mnt/Volume_3/Gentoo/projects/Cplus/SymbolFinder/build> make -j8
CMake Error at build/_deps/tl-expected-build/tl-expected-config.cmake:27 (include):
  include could not find requested file:

    /mnt/Volume_3/Gentoo/projects/Cplus/SymbolFinder/build/_deps/tl-expected-build/tl-expected-targets.cmake
Call Stack (most recent call first):
  cmake/Modules/Tl-expected.cmake:16 (find_package)
  CMakeLists.txt:31 (handle_tl_expected)

The problematic cmake file is this:

####### Expanded from @PACKAGE_INIT@ by configure_package_config_file() #######
####### Any changes to this file will be overwritten by the next CMake run ####
####### The input file was tl-expected-config.cmake.in                            ########

get_filename_component(PACKAGE_PREFIX_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../" ABSOLUTE)

macro(set_and_check _var _file)
  set(${_var} "${_file}")
  if(NOT EXISTS "${_file}")
    message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !")
  endif()
endmacro()

macro(check_required_components _NAME)
  foreach(comp ${${_NAME}_FIND_COMPONENTS})
    if(NOT ${_NAME}_${comp}_FOUND)
      if(${_NAME}_FIND_REQUIRED_${comp})
        set(${_NAME}_FOUND FALSE)
      endif()
    endif()
  endforeach()
endmacro()

####################################################################################

include("${CMAKE_CURRENT_LIST_DIR}/tl-expected-targets.cmake") #<- This isn't found.

When I try to grep in the "${CMAKE_BINARY_DIR}", I can't find any relevant file. Where can I search for this file?

Thank you for your time.