I have a static library in /PATH directory, and when I tried to use the library with link_directories
as follows:
link_directories(/PATH)
target_link_libraries(CppHello libHelloLib.a)
I had an error message:
ld: library not found for -lHelloLib
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]: *** [/PATH] Error 1
make[2]: *** [CMakeFiles/CppHello.dir/all] Error 2
make[1]: *** [CMakeFiles/CppHello.dir/rule] Error 2
Instead, I had to specify the path as follows to make it work:
target_link_libraries(CppHello /PATH/libHelloLib.a)
What might be wrong? Is this an issue with Cmake on Mac OS X, or did I just miss something?