In Ubuntu, I have downloaded a third-party shared library, mylibrary.so, which I have placed in the directory /home/karnivaurus/Libraries. I have also placed the associated header file, myheader.h, in the directory /home/karnivaurus/Headers. I now want to link to this library in my C++ code, using CMake. Here is my CMakeLists.txt file:
cmake_minimum_required(VERSION 2.0.0) project(DemoProject) include_directories(/home/karnivaurus/Headers) add_executable(demo demo.cpp) target_link_libraries(demo /home/karnivaurus/Libraries/mylibrary) However, this gives me the error message:
:-1: error: No rule to make target `/home/karnivaurus/Libraries/mylibrary', needed by `demo'. Stop. What's going on?
libmylibrary.so? If it's not, you might try adding the.soextension totarget_link_libraries(), it might help unconfuse it..soextension, it then gives me the error:cannot find -lmylibraryadd_librarybuild a new library from source? I have already been given the compiledmylibrary.sofile...