How to link a static library to an executable using CMake

后端 未结 2 1603
梦毁少年i
梦毁少年i 2021-01-11 20:34

In CMake, we use TARGET_LINK_LIBRARIES() to link a shared library to an library/executable.

For example:
TARGET_LINK_LIBRARIES(ExecutableName xxx)
   where E         


        
2条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-11 21:30

    Just specifying the library filename should work:

    TARGET_LINK_LIBRARIES(ExecutableName libxxx.a)
    

    and

    TARGET_LINK_LIBRARIES(ExecutableName xxx)
    

    actually should work too as that would not look for the .so but for a libxxx.a file in the search paths.

提交回复
热议问题