change install directory to /opt

This commit is contained in:
张壹
2021-07-31 16:07:15 +08:00
parent bc5671c373
commit e59ec89fed
3 changed files with 6 additions and 5 deletions

View File

@@ -7,7 +7,8 @@ if(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Linux")
set(CMAKE_INSTALL_PREFIX /usr/local)
elseif (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Darwin")
message(STATUS "Platform: " ${CMAKE_HOST_SYSTEM_NAME})
set(CMAKE_INSTALL_PREFIX /usr/local)
# 安装到系统级用户软件目录
set(CMAKE_INSTALL_PREFIX /opt)
elseif (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Windows")
message(STATUS "Platform: " ${CMAKE_HOST_SYSTEM_NAME})
# 使用MinGW GCC编译时需取消注释

View File

@@ -38,7 +38,7 @@ if(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Linux")
target_link_libraries(tess_static m.a)
endif()
# 库的安装命令
# 库的安装命令 安装到/opt/lib
if(WIN32)
install(TARGETS tess DESTINATION lib)
install(TARGETS tess_static DESTINATION lib)
@@ -50,5 +50,5 @@ endif()
# 头文件安装命令
file(GLOB LIBTESS_HEAD *.h)
# 安装到/opt/include/tess
install(FILES ${LIBTESS_HEAD} DESTINATION include/tess)

View File

@@ -22,8 +22,8 @@ macro(add_tools name)
set_target_properties(${name} PROPERTIES INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib)
# 链接动态库
target_link_libraries(${name} PUBLIC tess)
# 将可执行程序安装到/usr/local/sbin
install(TARGETS ${name} RUNTIME DESTINATION sbin/tess)
# 将可执行程序安装到/opt/bin/tess
install(TARGETS ${name} RUNTIME DESTINATION bin/tess)
endmacro()
# 添加tools