Using the FetchContent setup from the docs currently fails with :
CMake Error at build/_deps/sl3-src/CMakeLists.txt:101 (include):
include could not find requested file:
lib/find_sqlite
CMake Error at build/_deps/sl3-src/CMakeLists.txt:133 (include):
include could not find requested file:
lib/install
Reproducer :
cmake_minimum_required(VERSION 3.31)
project(sl3_consumer LANGUAGES C CXX)
include(FetchContent)
FetchContent_Declare(
sl3
GIT_REPOSITORY https://github.com/a4z/libsl3.git
GIT_TAG main
OVERRIDE_FIND_PACKAGE
)
set(BUILD_TESTING OFF)
set(sl3_USE_INTERNAL_SQLITE3 ON)
set(sl3_USE_COMMON_COMPILER_WARNINGS OFF)
find_package(sl3 CONFIG REQUIRED)
Looks like CMAKE_MODULE_PATH is only updated inside if(PROJECT_IS_TOP_LEVEL) in cmake/project-setup.cmake
When sl3 is consumed through FetchContent that condition is false, but lib/find_sqlite and lib/install are still included from the main CMakeLists.txt.
Adding ${libsl3_SOURCE_DIR}/cmake to CMAKE_MODULE_PATH fixes the issue locally
It looks like this should be outside the top lvl check
list(PREPEND CMAKE_MODULE_PATH "${libsl3_SOURCE_DIR}/cmake")
Using the FetchContent setup from the docs currently fails with :
Reproducer :
Looks like
CMAKE_MODULE_PATHis only updated insideif(PROJECT_IS_TOP_LEVEL)in cmake/project-setup.cmakeWhen sl3 is consumed through FetchContent that condition is false, but
lib/find_sqliteandlib/installare still included from the main CMakeLists.txt.Adding
${libsl3_SOURCE_DIR}/cmaketoCMAKE_MODULE_PATHfixes the issue locallyIt looks like this should be outside the top lvl check