We need to configure project in the project file CMakeLists.txt to support to use shared library or static library.
Here is an example to build a project based on the library uchardet.

Use shared library

set(uchardet_DIR "/root/uchardet-0.0.7")


link_directories( ${uchardet_DIR}/build/src ) #add library path
target_link_libraries( ${PROJECT_NAME} uchardet ) #import libuchardet.so

Use static library

add_library(uchardet STATIC IMPORTED)
set_property(TARGET uchardet PROPERTY IMPORTED_LOCATION <path-to-libuchardet.a>)  #eg. ${uchardet_DIR}/build/src/libuchardet.a
target_link_libraries(${PROJECT_NAME} uchardet ) #import libuchardet.a

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments

Content Summary
: Input your strings, the tool can get a brief summary of the content for you.

X
0
Would love your thoughts, please comment.x
()
x