Hi. It seems impossible to use add_subdirectory(range-v3) and find_package(range-v3) in one project. In my case there is a parent project, that contains
add_subdirectory(range-v3)
add_subdirectory(<lib that uses find_package(range-v3)>)
cmake exits with error:
CMake Error at range-v3/cmake/range-v3-config.cmake:1 (include):
include could not find requested file:
C:/projects/testCmake/range-v3/cmake/range-v3-targets.cmake
The minmal case is project that contains clone of range-v3 and CMakeLists.txt:
I think it should work and there is a commit that says that fixes this behaviour: 8473ac782a3501a399a83c3517505b1bfd2627f9
But it does not fix anything. if (TARGET range-v3::meta) should be placed before include because range-v3-targets.cmake is generated by cmake install and there is no such file in add_subdirectory mode.
The only thing we need to fix is moving one line in cmake/range-v3-config.cmake
if (TARGET range-v3::meta)
return()
endif()
include("${CMAKE_CURRENT_LIST_DIR}/range-v3-targets.cmake")
....
Hi. It seems impossible to use add_subdirectory(range-v3) and find_package(range-v3) in one project. In my case there is a parent project, that contains
cmake exits with error:
The minmal case is project that contains clone of range-v3 and CMakeLists.txt:
I think it should work and there is a commit that says that fixes this behaviour: 8473ac782a3501a399a83c3517505b1bfd2627f9 But it does not fix anything.
if (TARGET range-v3::meta)
should be placed before include because range-v3-targets.cmake is generated by cmake install and there is no such file in add_subdirectory mode.The only thing we need to fix is moving one line in cmake/range-v3-config.cmake
I can make PR soon if it helps.