Commit 8cb73e1b by Xiaofeng Wang

修正 Windows 编译问题

parent 310b6027
...@@ -158,7 +158,7 @@ endif() ...@@ -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
......
...@@ -66,7 +66,8 @@ message(STATUS "编译类型: ${CMAKE_BUILD_TYPE}") ...@@ -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) ...@@ -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)
# TODO: /wd4819 应该是不会生效 set(COMPILE_OPTIONS_DEFAULT
set(COMPILE_OPTIONS_DEFAULT "/wd4566;/wd4819") # TODO: /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 依赖
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论