Hi,
I am trying to work with FetchContent in cmake 3.11.
I want to use the jsoncpp library and use FetchContent to get and build it.
I also want to configure the jsoncpp build with some cmake arguments and I
can't seem to get that right.
My CMakeLists.txt looks like this:
**************************************************************
cmake_minimum_required(VERSION 3.11)
project(Foo)
include(FetchContent)
FetchContent_Declare(jsoncpp
URL "c:/project/jsoncpp-src"
CMAKE_ARGS
"-DJSONCPP_WITH_CMAKE_PACKAGE=ON;-DJSONCPP_WITH_PKGCONFIG_SUPPORT=OFF"
)
FetchContent_Populate(jsoncpp)
add_executable(Foo main.cpp)
**************************************************************
FetchContent downloads and configures the jsoncpp as an ExternalProject.
That part looks like this:
*********************************************
ExternalProject_Add(jsoncpp-populate
"UPDATE_DISCONNECTED" "False" "URL"
"c:/project/jsoncpp-src" "CMAKE_ARGS" "-DJSONCPP_WITH_CMAKE_PACKAGE=ON"
"-DJSONCPP_WITH_PKGCONFIG_SUPPORT=OFF"
SOURCE_DIR
"C:/temp/foo/build/_deps/jsoncpp-src"
BINARY_DIR
"C:/temp/foo/build/_deps/jsoncpp-build"
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
TEST_COMMAND ""
)
*******************************************************
For the external project - the CMAKE_ARGS are no longer a list, but
individual arguments.
I have tried different things, like escaping the ; with \\; and stuff like
that, and I can't get it to work.
I'm thinking there is something obvious I am missing?
Best regards,
Mads
--
Powered by www.kitware.com
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Kitware offers various services to support the CMake community. For more
information on each offering, please visit:
CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake