I am newbie to cmake and I am pretty sure this is the problem I am facing here.
I am trying to use the yaml-cpp library which is written in cmake project into my own cmake project. I run the following commands to build and install the yaml-cpp in it's own directory. mkdir build
, cd build
, cmake ..
, make
, and then sudo make install
and no errors occured after running those commands.
now in my own project I am having a c++ code file in a proper cmake project. To use the yaml-cpp library I am including it with the #include "yaml-cpp/yaml.h"
, and in the CmakeLists.txt file in that subdirectory I am adding the following two:
find_package(yaml-cpp REQUIRED)
target_link_libraries(yaml-cpp)
however when I try to compile the project it gives me the following output:
handstandForm.cpp:(.text+0x4820): undefined reference to `YAML::LoadFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
I want to point out that the project compiles perfectly and run without any errors when deleting any lines of codes using the yaml-cpp library. what could be the problem? Please help.