CMakeLists.txt
...
add_library( ${PROJECT_NAME} SHARED src/run_pipeline.cpp )
target_link_libraries( ${PROJECT_NAME} )
install( TARGETS ${PROJECT_NAME} DESTINATION lib )
install( FILES ${PROJECT_NAME}Config.cmake DESTINATION lib/cmake/${PROJECT_NAME} )
该${PROJECT_NAME}Config.cmake
文件是:
add_library( pipeline_controller STATIC IMPORTED)
find_library( PIPELINE_CONTROLLER_LIBRARY_PATH pipeline_controller HINTS "${CMAKE_CURRENT_LIST_DIR}/install/lib/")
set_target_properties( pipeline_controller PROPERTIES IMPORTED_LOCATION "${PIPELINE_CONTROLLER_LIBRARY_PATH}")
在哪些情况下我们需要一个单独的 .cmake 文件?提供什么不.cmake
提供CMakeLists.txt
?为什么在上述情况下使用它?