<div dir="ltr">I'm upgrading from cmake 3.5.1 and am trying to understand the new FetchContent command. So far I have:<br><br><blockquote style="margin:0 0 0 40px;border:none;padding:0px">cmake_minimum_required(VERSION 3.14)<br>project (json_test)<br><br>include(FetchContent)<br>set(JSON_BuildTests OFF) #if I try this I get a warning as it appears to be deprecated<br><br>FetchContent_Declare(<br>    nlohmann_json_fc<br>    GIT_REPOSITORY <a href="https://github.com/nlohmann/json.git">https://github.com/nlohmann/json.git</a><br>    GIT_TAG v3.6.1<br>    GIT_SHALLOW TRUE<br>#    CMAKE_ARGS -DJSON_BuildTests=OFF #doesn't work<br>)<br>FetchContent_MakeAvailable(nlohmann_json_fc)<br>add_executable(main src/main.cpp)<br><div><div><div>target_link_libraries(main nlohmann_json::nlohmann_json)</div></div></div></blockquote><div dir="ltr"><div><br></div><div>I first tried sending in the JSON_BuildTests=OFF with CMAKE_ARGS in the FetchContent_Declare command but that didn't work.  On this post <a href="https://cmake.org/pipermail/cmake/2018-July/067804.html">https://cmake.org/pipermail/cmake/2018-July/067804.html</a> it appears this is because only the download portion of FetchContent_Declare is enabled with the intent to not do too much during configure time. How does specifying how the external project is configured fit that rationale?  If I execute </div></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div dir="ltr"><div>cmake -DJSON_BuildTests=OFF .. </div></div></blockquote><div dir="ltr"><div>the argument successfully makes it through to the external project. I guess I'm trying to understand why it's ok to specify it on the command line but not permanently in the CMakeLists.txt, particularly if you have many libraries each potentially with their options that need to be configured.</div><div><br></div><div>Thanks,</div><div>Jason</div><div> </div><div><br></div></div></div>