Closed ncoder-1 closed 3 years ago
I only have limited CMake experience, but perhaps @bsergean would be able to provide some directions. In #243, he significantly reworked the CMake build and I think better FetchContent
support was a motivation.
Well maybe those changes were not sufficient ... I actually haven't tested it yet, I hope I can find time soon to do so but that's unclear ...
@ncoder-1 maybe you can try with ExternalProject_Add too.
I've tried with ExternalProjects, I got it working but the issue is that ExternalProject doesn't build until I build my own project (explained here).
This causes issues with the IDE not being able to index properly and basically turns the syntax autocorrection into a nightmare.
On the other hand, nlohmann json
works properly with:
FetchContent_Declare(
json
GIT_REPOSITORY https://github.com/ArthurSonzogni/nlohmann_json_cmake_fetchcontent
GIT_TAG v3.9.1
)
FetchContent_MakeAvailable(json)
if (NOT json_POPULATED)
FetchContent_Populate(json)
add_subdirectory(${json_SOURCE_DIR} ${json_BINARY_DIR} EXCLUDE_FROM_ALL)
endif ()
as well as lifthttp
:
FetchContent_Declare(
lifthttp
GIT_REPOSITORY https://github.com/jbaldwin/liblifthttp.git
GIT_TAG v2020.5
)
FetchContent_MakeAvailable(lifthttp)
@ncoder-1, from what I can tell, 1.6.0 fixes this. Please let me know if this is not the case.
Hi,
I'm trying to build a sample project using CMake's
FetchContent
. I'm using the following block to pull and build the library so I can use it with my sample project:Normally, a similar block works for other projects out there, but I'm getting the following CMake errors:
What is the right way to use
FetchContent
within my ownCMakeLists.txt
to fetch, build and makelibmaxminddb
available for my own project?