添加msvc编译脚本
This commit is contained in:
@@ -3,6 +3,10 @@ cmake_minimum_required(VERSION 3.16)
|
||||
project(cxxLibrary VERSION 1.0.0 LANGUAGES CXX)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
|
||||
if (MSVC)
|
||||
add_compile_definitions(-D_WIN32_WINNT=0x0601)
|
||||
endif()
|
||||
|
||||
set(SOURCES
|
||||
src/tinyxml2.cpp
|
||||
)
|
||||
@@ -16,7 +20,7 @@ file(GLOB_RECURSE BOOST_SOURCES
|
||||
add_library(cxxLibrary STATIC ${SOURCES} ${BOOST_SOURCES})
|
||||
|
||||
# 修正1:使用相对路径,避免绝对路径警告
|
||||
target_include_directories(cxxLibrary PUBLIC
|
||||
target_include_directories(cxxLibrary PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:include>
|
||||
)
|
||||
@@ -31,7 +35,7 @@ target_compile_definitions(cxxLibrary PUBLIC
|
||||
BOOST_FILESYSTEM_NO_CXX20_ATOMIC_REF
|
||||
)
|
||||
|
||||
set_target_properties(cxxLibrary PROPERTIES
|
||||
set_target_properties(cxxLibrary PROPERTIES
|
||||
DEBUG_POSTFIX "d"
|
||||
# 可选:设置其他配置的后缀
|
||||
# RELEASE_POSTFIX ""
|
||||
@@ -84,4 +88,4 @@ install(FILES
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/cxxLibraryConfig.cmake"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/cxxLibraryConfigVersion.cmake"
|
||||
DESTINATION lib/cmake/cxxLibrary
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user