From 35d9c4dd6743d706ed9382c021923ef790e7c446 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Sun, 11 Aug 2019 15:47:10 +0900 Subject: Configure MSVC warnings in CMakeLists.txt; build in AppVeyor with Qt 5.13 --- .appveyor.yml | 6 +++--- CMakeLists.txt | 16 ++++++++++------ 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 76f6b70f..1dbdf237 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -3,10 +3,10 @@ image: Visual Studio 2017 environment: #DEPLOY_DIR: libqmatrixclient-%APPVEYOR_BUILD_VERSION% matrix: - - QTDIR: C:\Qt\5.12\msvc2017_64 + - QTDIR: C:\Qt\5.13\msvc2017_64 VCVARS: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Auxiliary\\Build\\vcvars64.bat" PLATFORM: - - QTDIR: C:\Qt\5.12\msvc2017 + - QTDIR: C:\Qt\5.13\msvc2017 VCVARS: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Auxiliary\\Build\\vcvars32.bat" PLATFORM: x86 @@ -21,7 +21,7 @@ before_build: - cd 3rdparty/libQtOlm - git clone https://gitlab.matrix.org/matrix-org/olm.git - cd ../.. -- cmake -G "NMake Makefiles JOM" -H. -Bbuild -DCMAKE_CXX_FLAGS="/EHsc /W3" -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX="%DEPLOY_DIR%" +- cmake -G "NMake Makefiles JOM" -H. -Bbuild -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX="%DEPLOY_DIR%" build_script: - cmake --build build diff --git a/CMakeLists.txt b/CMakeLists.txt index d0ce98a6..d90b2d88 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,12 +36,16 @@ endif() set(CMAKE_CXX_STANDARD 17) -foreach (FLAG all "" pedantic extra error=return-type no-unused-parameter no-gnu-zero-variadic-macro-arguments) - CHECK_CXX_COMPILER_FLAG("-W${FLAG}" WARN_${FLAG}_SUPPORTED) - if ( WARN_${FLAG}_SUPPORTED AND NOT CMAKE_CXX_FLAGS MATCHES "(^| )-W?${FLAG}($| )") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -W${FLAG}") - endif () -endforeach () +if (MSVC) + add_compile_options(/EHsc /W4) +else() + foreach (FLAG all "" pedantic extra error=return-type no-unused-parameter no-gnu-zero-variadic-macro-arguments) + CHECK_CXX_COMPILER_FLAG("-W${FLAG}" WARN_${FLAG}_SUPPORTED) + if ( WARN_${FLAG}_SUPPORTED AND NOT CMAKE_CXX_FLAGS MATCHES "(^| )-W?${FLAG}($| )") + add_compile_options(-W${FLAG}) + endif () + endforeach () +endif() find_package(Qt5 5.9 REQUIRED Network Gui Multimedia) get_filename_component(Qt5_Prefix "${Qt5_DIR}/../../../.." ABSOLUTE) -- cgit v1.2.3