I am trying to use FetchContent
to include a dependency that is a header-only C++ project. It does not need to be built. However, it contains a CMakeLists.txt file that builds its tests, and it is not doing it in a standard way. I would like to bypass the make step entirely, so as not to build the extraneous binary and not to see the warnings that it emits.
My code is currently:
FetchContent_Declare(
TheProject
GIT_REPOSITORY <the git repo>
GIT_TAG <the git commit>
)
FetchContent_MakeAvailable(TheProject)
This correctly downloads the project, but it invokes the make system on it, which is what I don’t want. I can fix the problem by changing it to this:
FetchContent_Declare(
TheProject
GIT_REPOSITORY <the git repo>
GIT_TAG <the git commit>
)
FetchContent_Populate(TheProject)
This works, and it does not invoke the build system. Fabulous. But it emits a cursed warning stating that calling FetchContent_Populate
by itself is deprecated and will be removed from a future version of cmake. Is there a proper way to accomplish what I want without using a deprecated feature?