修正 Windows 编译问题

This commit is contained in:
Xiaofeng Wang 2022-07-28 00:25:50 +08:00
parent 310b60276c
commit 8cb73e1bc3
2 changed files with 13 additions and 4 deletions

View File

@ -158,7 +158,7 @@ endif()
add_library(zltoolkit STATIC ${ToolKit_SRC_LIST}) add_library(zltoolkit STATIC ${ToolKit_SRC_LIST})
add_library(ZLMediaKit::ToolKit ALIAS zltoolkit) add_library(ZLMediaKit::ToolKit ALIAS zltoolkit)
target_compile_definitions(zltoolkit target_compile_definitions(zltoolkit
PRIVATE ${COMPILE_DEFINITIONS}) PUBLIC ${COMPILE_DEFINITIONS})
target_compile_options(zltoolkit target_compile_options(zltoolkit
PRIVATE ${COMPILE_OPTIONS_DEFAULT}) PRIVATE ${COMPILE_OPTIONS_DEFAULT})
target_include_directories(zltoolkit target_include_directories(zltoolkit

View File

@ -66,7 +66,8 @@ message(STATUS "编译类型: ${CMAKE_BUILD_TYPE}")
# 便, FORCE CACHE, # 便, FORCE CACHE,
set(CMAKE_VERBOSE_MAKEFILE ON CACHE INTERNAL "" FORCE) set(CMAKE_VERBOSE_MAKEFILE ON CACHE INTERNAL "" FORCE)
set(CMAKE_INCLUDE_CURRENT_DIR ON) # TODO: include server ,
set(CMAKE_INCLUDE_CURRENT_DIR OFF)
# #
if(NOT CMAKE_INSTALL_PREFIX) if(NOT CMAKE_INSTALL_PREFIX)
@ -170,8 +171,16 @@ if(UNIX)
"-Wno-unused-function;-Wno-unused-parameter;-Wno-unused-variable" "-Wno-unused-function;-Wno-unused-parameter;-Wno-unused-variable"
"-Wno-error=extra;-Wno-error=missing-field-initializers;-Wno-error=type-limits") "-Wno-error=extra;-Wno-error=missing-field-initializers;-Wno-error=type-limits")
elseif(WIN32) elseif(WIN32)
set(COMPILE_OPTIONS_DEFAULT
# TODO: /wd4819 # TODO: /wd4819
set(COMPILE_OPTIONS_DEFAULT "/wd4566;/wd4819") "/wd4566;/wd4819"
# warning C4530: C++ exception handler used, but unwind semantics are not enabled.
"/EHsc")
if (MSVC)
# disable Windows logo
list(APPEND COMPILE_OPTIONS_DEFAULT "/nologo")
list(APPEND CMAKE_STATIC_LINKER_FLAGS "/nologo")
endif()
endif() endif()
# mediakit runtime # mediakit runtime