A CMake module allowing project authors to have dependent projects downloaded and set up during the dependent project's configuration phase.
Questions tagged [fetchcontent]
33 questions
1
vote
1 answer
cmake FetchContent not downloading with DOWNLOAD_NO_EXTRACT in docker
My CMakeLists.txt downloads a JAR file with FetchContent, which works as expected in Ubuntu 18.04 WSL. Running cmake in docker, does however not download the file.
I specify DOWNLOAD_NO_EXTRACT TRUE, since it otherwise extracts the JAR file. Without…

Jeppe
- 1,830
- 3
- 24
- 33
0
votes
1 answer
CMake skips fetching directory with FetchContent when output directory is changed
Trying to configure a multi repository project with CMake.
Project A is an graphical application which uses Project B for all hardware related details and code. Project B is a device controller / HAL layer.
When CMake is configuring it should fetch…

Daniel Beliavskij
- 11
- 2
0
votes
1 answer
cmake FetchContent SOURCE_DIR
I am trying to use a small subproject in a cmake master project using the FetchContent method. Specifically, in the CMakeLists.txt of my master project, I have the lines
include(FetchContent)
FetchContent_Declare(subproject GIT_REPOSITORY…

hfhc2
- 4,182
- 2
- 27
- 56
0
votes
0 answers
How to import spdlog into a CMake project?
I'm desperately trying to understand how cmake works. I inherited a project that uses cmake, and needs spdlog, but I simply cannot make cmake be able to generate the makefiles, because I cannot produce a working Findspdlog.cmake for find_package to…

Gergely Nagy
- 73
- 1
- 5
0
votes
1 answer
How can I FetchContent with no warnings for developers (with -Wno-dev)?
I am trying to add zmq as a third party library with FetchContent.
However, I am uninterested on the warnings meant for devs.
As I have taken the tag for a verified release, it should be working without any errors or warnings ideally.
I do not want…

Kikadass
- 314
- 1
- 3
- 14
0
votes
1 answer
SDL2d.dll not found on windows with CMake using fetchcontent
I am working on a cross platform application with CMake. The project builds on Linux, but not on windows. Any help would be appreciated.
The error I get is a popup that says:
The code execution cannot proceed because SDL2d.dll was not found.…

Joseph Vargas
- 772
- 5
- 17
0
votes
1 answer
Does FetchContent build with optimisations?
I am moving from including my dependencies using VCPKG to using FetchContent to make building my docker images slightly easer. I now get my dependencies in a file called get_dependencies.cmake like:
include(FetchContent)
message(STATUS "Getting…

Tom McLean
- 5,583
- 1
- 11
- 36
0
votes
0 answers
Run boost bootstrap.sh after FetchContent_MakeAvailable(boost)
I'm writing a CMakeLists.txt, and it needs boost library. So I plan to download boost and run bootstrap_sh and b2.
But the problem is that it fails every first time I run cmake. After that, it succeeds every time. I don't know why.
Below is the…

weareff
- 1
- 2
0
votes
1 answer
What is the meson equivalent of cmake's `FetchContent`?
How would I fetch a dependency from GitHub in meson? I am trying to convert the following cmake snippet into meson
FetchContent_Declare(
some_dep
GIT_REPOSITORY https://github.com/some/repo
GIT_TAG sometag
SOURCE_SUBDIR …

prnvbn
- 700
- 2
- 7
- 25
0
votes
2 answers
Issue building opencv using FetchContent cmake command
I really need your help because I really don't understand what I am doing wrong.
Using the very simple attached CMakeLists.txt, I got the following error (a lot of times):
CMake Error in build/_deps/opencv-src/modules/core/CMakeLists.txt:
Target…

skeleton18
- 11
- 1
0
votes
1 answer
Cmake Fetchcontent not finding dependency
Im trying to use two external git projects in my project, where one depends on the other. However I cannot make it work.
FetchContent_Declare(
spdlog
GIT_REPOSITORY https://github.com/gabime/spdlog.git
GIT_TAG…

Frank
- 2,446
- 7
- 33
- 67
0
votes
0 answers
FetchContent is not setting include path
I'm trying to link a fortran project against jsonfortran. Below is a mwe which fails because the module file cannot be found. This happens when the include path is not properly set.
main.F90
program thing_program
use json_module, only : json_ck
…

K. Shores
- 875
- 1
- 18
- 46
0
votes
0 answers
Installation issue with a `FetchContent`ed library
I am trying to install and export the target defined by the following CMakeLists.txt in a Windows environment. It uses FetchContent to download a library from github. I can build the library with no problem and generate nfd.lib. My goal is to use…

afp_2008
- 1,940
- 1
- 19
- 46
0
votes
0 answers
Using FetchContent with interdependent libraries yields "prefixed in the build directory" error
Consider the following: I have a project which depends on libwebsockets which is itself dependends on mbedtls. I pull everything in from github using FetchContent, which establishes the dependencies in the build folder (_deps).
As I want to build…

glades
- 3,778
- 1
- 12
- 34
0
votes
1 answer
FetchContent access to private Git repository
Has anybody faced with such a issue while trying to get private repository via FetchContent?
CMakeLists.txt:
include(FetchContent)
FetchContent_Declare(
{repository}
GIT_REPOSITORY https://{username}@github.com/{company}/{repository}
…

lfk
- 57
- 7