Reputation: 1941
I have a library called mylib.a
in the path /home/test/libs/
.
How can I add it to the project??
find_library(IDA_LIB
NAMES "mylib.a"
PATHS "/home/test/libs"
NO_DEFAULT_PATH)
Since it does not have the prefix lib
cmake does not find it. If I change the library name to libmylib.a
if finds it fine.
Upvotes: 6
Views: 4145
Reputation: 1611
Try this:
add_library(mylib STATIC IMPORTED)
set_target_properties(mylib PROPERTIES IMPORTED_LOCATION /home/test/mylib.a)
then you can use "mylib" in:
target_link_libraries(myapp
mylib )
Upvotes: 0
Reputation: 3657
Use following command with absolute file path of your library
target_link_libraries(IDA_LIB /home/test/libs/mylib.a)
Upvotes: 2