jsoncpp.cmake 1.3 KB

1234567891011121314151617181920212223242526272829
  1. #include(ExternalProject)
  2. #ExternalProject_Add(jsoncpp-project
  3. # PREFIX deps/jsoncpp
  4. # URL https://github.com/open-source-parsers/jsoncpp/archive/1.7.7.tar.gz
  5. # URL_HASH SHA256=087640ebcf7fbcfe8e2717a0b9528fff89c52fcf69fa2a18cc2b538008098f97
  6. # CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
  7. # # Build static lib but suitable to be included in a shared lib.
  8. # -DCMAKE_POSITION_INDEPENDENT_CODE=On
  9. # -DJSONCPP_WITH_TESTS=Off
  10. # -DJSONCPP_WITH_PKGCONFIG_SUPPORT=Off
  11. # # Overwtire build and install commands to force Release build on MSVC.
  12. # BUILD_COMMAND cmake --build <BINARY_DIR> --config Release
  13. # INSTALL_COMMAND cmake --build <BINARY_DIR> --config Release --target install
  14. #)
  15. # Create jsoncpp imported library
  16. #ExternalProject_Get_Property(jsoncpp-project INSTALL_DIR)
  17. # ./x86_64-linux-gnu/libjsoncpp.so
  18. add_library(jsoncpp STATIC IMPORTED)
  19. set(JSONCPP_LIBRARY /usr/lib/x86_64-linux-gnu/libjsoncpp.so)
  20. set(JSONCPP_INCLUDE_DIR /usr/include)
  21. # worth a shot
  22. #file(MAKE_DIRECTORY ${JSONCPP_INCLUDE_DIR}) # Must exist.
  23. set_property(TARGET jsoncpp PROPERTY IMPORTED_LOCATION ${JSONCPP_LIBRARY})
  24. set_property(TARGET jsoncpp PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${JSONCPP_INCLUDE_DIR})
  25. add_dependencies(jsoncpp jsoncpp-project)
  26. #unset(INSTALL_DIR)
  27. #