并入zoost库。
This commit is contained in:
@@ -1,11 +1,17 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
project(cxxLibrary VERSION 1.0.0 LANGUAGES CXX)
|
||||
project(cxxLibrary VERSION 1.0.1 LANGUAGES CXX)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
|
||||
option(CXXLIBRARY_UTF8 "Add /utf-8 compile option for MSVC" ON)
|
||||
option(CXXLIBRARY_TEST "Use test mode" OFF)
|
||||
|
||||
if (MSVC)
|
||||
add_compile_definitions(-D_WIN32_WINNT=0x0601)
|
||||
endif()
|
||||
if(MSVC AND CXXLIBRARY_UTF8)
|
||||
add_compile_options(/utf-8)
|
||||
endif()
|
||||
|
||||
set(SOURCES
|
||||
src/tinyxml2.cpp
|
||||
@@ -16,8 +22,18 @@ file(GLOB_RECURSE BOOST_SOURCES
|
||||
src/boost-src/*.hpp
|
||||
src/boost-src/*.h
|
||||
)
|
||||
file(GLOB_RECURSE ZOOST_SOURCES
|
||||
src/zoost-src/zt.common.cpp
|
||||
src/zoost-src/zt.utils.cpp
|
||||
src/zoost-src/zt.mem.cpp
|
||||
)
|
||||
if(WIN32)
|
||||
list(APPEND ZOOST_SOURCES
|
||||
src/zoost-src/zt.os_win.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
add_library(cxxLibrary STATIC ${SOURCES} ${BOOST_SOURCES})
|
||||
add_library(cxxLibrary STATIC ${SOURCES} ${BOOST_SOURCES} ${ZOOST_SOURCES})
|
||||
|
||||
# 修正1:使用相对路径,避免绝对路径警告
|
||||
target_include_directories(cxxLibrary PUBLIC
|
||||
@@ -43,6 +59,13 @@ set_target_properties(cxxLibrary PROPERTIES
|
||||
# MINSIZEREL_POSTFIX "s"
|
||||
)
|
||||
|
||||
if (DEFINED CXXLIBRARY_TEST AND CXXLIBRARY_TEST)
|
||||
message(STATUS "USE CXXLIBRARY_TEST ${CXXLIBRARY_TEST}")
|
||||
include(CTest)
|
||||
enable_testing()
|
||||
add_subdirectory(test)
|
||||
endif()
|
||||
|
||||
# 修正2:添加头文件安装
|
||||
# 如果include目录中有头文件,需要单独安装它们
|
||||
install(DIRECTORY include/
|
||||
|
||||
Reference in New Issue
Block a user