I am still learning cmake and am struggling with a dependency I am trying to set up.
I discovered FetchContent while setting up googletest, and that worked fine so I am trying to do the same thing for a new dependency I am trying to configure for can-utils.
In the CMakeLists.txt file in the source directory for the code that I want to use can-utils with, I added:
include(FetchContent)
FetchContent_Declare(
can-utils
GIT_REPOSITORY https://github.com/linux-can/can-utils.git
GIT_TAG e602e391a56e681b03506c2f0890eb128192ec3d
)
FetchContent_MakeAvailable(can-utils)
The project configures and builds,and I can see that cmake put the can-utils repo in to my build directory... However, unlike with googletest, where after doing the FetchContent I was able to #include <gtest/gtest.h>
, I can't seem to #include "anything/resembling/can-utils"
I suspect that the difference is that googletest is set up with FetchContent in mind and can-utils is not. My question is: How would I know if I can use FetchContent for a given library?
Any guidance is very much appreciated!