How do I link a *.a file that doesn't start with "lib" to an executable? For example, if I have a library named foo.a with a function called getnum, how do I link to foo.a in CMakeLists.txt?If my executable file is---main.cpp---extern int getnum();int main(int, char**) { cout getnum()
Whoever developed foo.a should call it libfoo.a instead so it meets
standards. All libraries on Linux are supposed to start with lib
with the possible exception of dynamically loaded shared libraries
(i.e. plugins).
If you still can't rename it, you can do target_link_libraries(bar