我有一堆我必须构建的库。对于每个库,我创建 3 个符号链接。我使用创建两个符号链接:
add_library(${PROJECT_NAME} ${SRC})
set_target_properties(${PROJECT_NAME} PROPERTIES SOVERSION ${perception_kit_VERSION})
target_link_libraries(${PROJECT_NAME} ${OpenCV_LIBS} ${Boost_LIBS})
但其余两个是使用创建的:
#code for generating symlink. will work with make install
if (CMAKE_HOST_UNIX)
set (libname_major_minor_patch "lib${PROJECT_NAME}.so.${perception_kit_VERSION_MAJOR}.${perception_kit_VERSION_MINOR}.${perception_kit_VERSION_PATCH}")
set (libname_major_minor "lib${PROJECT_NAME}.so.${perception_kit_VERSION_MAJOR}.${perception_kit_VERSION_MINOR}")
set (libname_major "lib${PROJECT_NAME}.so.${perception_kit_VERSION_MAJOR}")
set (libname "lib${PROJECT_NAME}.so")
install(CODE "
EXECUTE_PROCESS (COMMAND ln -sf ${libname_major_minor_patch} ${libname_major_minor} WORKING_DIRECTORY ${LIBRARY_OUTPUT_PATH} )
")
install(CODE "
EXECUTE_PROCESS (COMMAND ln -sf ${libname_major_minor_patch} ${libname_major} WORKING_DIRECTORY ${LIBRARY_OUTPUT_PATH} )
")
endif(CMAKE_HOST_UNIX)
最后两个仅在使用 make install 时创建。有没有办法在不使用 make install 的情况下制作所有的符号链接。?