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