update cmakelists

This commit is contained in:
2021-05-05 15:24:52 +08:00
parent f1cf25db22
commit 85de73131c
3 changed files with 13 additions and 13 deletions

View File

@@ -14,23 +14,23 @@ aux_source_directory(. LIBTESS_SRC)
# 以下部分为库的编译
# 注意目标名必须唯一 所以不能直接生成相同名称的动态库与静态库
# 注意此处不必为目标名称添加lib前缀和相应后缀cmake会自行添加
add_library(tesseroids SHARED ${LIBTESS_SRC})
add_library(tess SHARED ${LIBTESS_SRC})
# 首先添加静态库的生成命令
add_library(tesseroids_static STATIC ${LIBTESS_SRC})
add_library(tess_static STATIC ${LIBTESS_SRC})
# 设置静态库的输出名称从而获得与动态库名称相同的静态库
set_target_properties(tesseroids_static PROPERTIES OUTPUT_NAME "tesseroids")
set_target_properties(tess_static PROPERTIES OUTPUT_NAME "tess")
# 设置输出目标属性以同时输出动态库与静态库
set_target_properties(tesseroids PROPERTIES CLEAN_DIRECT_OUTPUT 1)
set_target_properties(tesseroids_static PROPERTIES CLEAN_DIRECT_OUTPUT 1)
set_target_properties(tess PROPERTIES CLEAN_DIRECT_OUTPUT 1)
set_target_properties(tess_static PROPERTIES CLEAN_DIRECT_OUTPUT 1)
# 设置动态库的版本号
set_target_properties(tesseroids PROPERTIES VERSION 1.6 SOVERSION 1.6)
set_target_properties(tess PROPERTIES VERSION 1.6 SOVERSION 1.6)
# 库的安装命令
if(WIN32)
install(TARGETS tesseroids DESTINATION lib)
install(TARGETS tesseroids_static DESTINATION lib)
install(TARGETS tess DESTINATION lib)
install(TARGETS tess_static DESTINATION lib)
else()
install(TARGETS tesseroids tesseroids_static
install(TARGETS tess tess_static
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
endif()
@@ -38,4 +38,4 @@ endif()
# 头文件安装命令
file(GLOB LIBTESS_HEAD *.h)
install(FILES ${LIBTESS_HEAD} DESTINATION include/tesseroids)
install(FILES ${LIBTESS_HEAD} DESTINATION include/tess)