From 310b60276c8c8acab29ab3248cf826146a15689c Mon Sep 17 00:00:00 2001 From: Xiaofeng Wang Date: Tue, 26 Jul 2022 13:24:22 +0800 Subject: [PATCH] cmake: try to disable compile warning of C4819 --- CMakeLists.txt | 2 +- server/CMakeLists.txt | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b98921e3..39863dc9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -171,7 +171,7 @@ if(UNIX) "-Wno-error=extra;-Wno-error=missing-field-initializers;-Wno-error=type-limits") elseif(WIN32) # TODO: /wd4819 应该是不会生效 - set(COMPILE_OPTIONS_DEFAULT "/wd4819") + set(COMPILE_OPTIONS_DEFAULT "/wd4566;/wd4819") endif() # mediakit 以及各个 runtime 依赖 diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt index 5d482da5..f0dea82b 100644 --- a/server/CMakeLists.txt +++ b/server/CMakeLists.txt @@ -41,11 +41,13 @@ endif() add_executable(MediaServer ${MediaServer_SRC_LIST}) target_compile_definitions(MediaServer PRIVATE ${COMPILE_DEFINITIONS}) - -install(TARGETS MediaServer DESTINATION ${INSTALL_PATH_RUNTIME}) +target_compile_options(MediaServer + PRIVATE ${COMPILE_OPTIONS_DEFAULT}) if(CMAKE_SYSTEM_NAME MATCHES "Linux") target_link_libraries(MediaServer -Wl,--start-group ${MK_LINK_LIBRARIES} -Wl,--end-group) else() target_link_libraries(MediaServer ${MK_LINK_LIBRARIES}) endif() + +install(TARGETS MediaServer DESTINATION ${INSTALL_PATH_RUNTIME})