Hi,
I am trying to use FetchContent_Declare to ‘create’ a package I can later use with find_package but haven’t had any luck so far. Here’s my little bit of test code:
FetchContent_Declare(json11-pkg
GIT_REPOSITORY https://github.com/blitz-research/json11.git
GIT_TAG master
GIT_SUBMODULES ""
GIT_SHALLOW TRUE
OVERRIDE_FIND_PACKAGE
)
FetchContent_MakeAvailable(json11-pkg)
message("### CMAKE_FIND_PACKAGE_REDIRECTS_DIR: ${CMAKE_FIND_PACKAGE_REDIRECTS_DIR}")
find_package(json11-pkg)
CMAKE_FIND_PACKAGE_REDIRECTS_DIR is always empty, and the find_package(json11-pkg) always fails.
I haven’t had much experience with either FetchContent or find_package so I suspect I’ve got entirely the wrong idea of what’s supposed to happen here (json11-pkg needs to be written ‘to be’ a package perhaps?), but I was hoping there was a way to get at the targets in json11-pkg so I could add their own include dirs and libs to my targets, they way I used to with eg: find_package(OpenGL), OpenGL_INCLUDE_DIRS and OpenGL_LIBRARIES.
Bye,
Mark