On Ubuntu, I have two directories: build
and src
. In src
, my CMakeLists.txt
file has the lines:
add_executable(Test main.cpp)
target_link_libraries(Test libCamera.so)
After running cmake in the build directory (cmake ../src
), I then copy my library file libCamera.so
into the build directory. After running make, the main.cpp.o
file compiles successfully, but I receive the following error during linking:
/usr/bin/ld: cannot find -lCamera
Why is this? The shared library is in the same directory that I am building in... and the same thing happens if I copy the library to /usr/bin
...
Linking CXX executable Test
,/usr/bin/ld: cannot find -lCamera
– Genia