- project(myprogram)
- find_package(PkgConfig REQUIRED)
- pkg_check_modules(JSONCPP jsoncpp)
- link_libraries(${JSONCPP_LIBRARIES})
- add_executable(myprogram myprogram.cpp)
- target_link_libraries(myprogram ${JSONCPP_LIBRARIES}) # this must come after add_executable(...)
With building using the IDF (I am on 4v3), we don't have the add_executable(...) command in our project, but I can see it in the project.cmake file in the IDF tools. https://github.com/espressif/esp-idf/bl ... cmake#L443
What would be the proper way to include & link external libraries into an IDF project?
Using jsoncpp as an example here which is a full library but I also want to use the GSL from Microsoft which is a header only interface.
When I say the "proper" way, I mean the CMake way. So that I can have a `libraries` directory in my project, with `git submodules` of all the libraries I want. As opposed to just copy and pasting source and header files from a library into my project, which is not as maintainable nor as elegant for open source projects.
Ref
jsoncpp: https://github.com/open-source-parsers/jsoncpp
GSL: https://github.com/microsoft/GSL