Different Linking Methods for CMake Libraries

Different Linking Methods for CMake Libraries

1. Different Libraries Have Different Linking Methods OpenCV uses ${OpenCV_LIBS} target_link_libraries(${PROJECT_NAME} ${OpenCV_LIBS}) protobuf uses ${PROTOBUF_LIBRARIES} target_link_libraries(${PROJECT_NAME} ${PROTOBUF_LIBRARIES}) jpeg-turbo uses the target name libjpeg-turbo::turbojpeg-static target_link_libraries(${PROJECT_NAME} libjpeg-turbo::turbojpeg-static) 2. How to Determine Which Method to Use Generally, the following methods can be used: Check the CMake file for usage instructions. (Well-written CMake files usually include usage instructions) Look … Read more