summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolodymyr Zibarov <gogan419@gmail.com>2020-05-26 11:16:26 +0300
committerVolodymyr Zibarov <gogan419@gmail.com>2020-05-29 06:51:45 +0000
commit28a999be522af2be568f86c10af8cceab4b8a20c (patch)
tree86df27554b5d5dcabc60246a6bfdcb5e96313556
parent93e7629ef6c83655fbfcf397a127fea630277f1a (diff)
downloadqt-creator-28a999be522af2be568f86c10af8cceab4b8a20c.tar.gz
CMake Build: Set /permissive- (standards conformance mode) for MSVC
To make errors appear faster when developing on Windows MSVC 2017 and later have this flag to disallow MSVC-specific C++ language extensions. Use it to make code more correct and more portable. Set this option with add_compile_options() in root CMakeLists.txt to apply it to all targets. Add one #include to unittest/gtest-clang-printing.cpp as workaround for forward template declaration bug in MSVC http://tiny.cc/fa4tpz Change-Id: Ie0b19701ad773c79ffd2fed24fffbb1dcb29538c Reviewed-by: Cristian Adam <cristian.adam@qt.io> Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
-rw-r--r--CMakeLists.txt5
-rw-r--r--tests/unit/unittest/gtest-clang-printing.cpp1
2 files changed, 6 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e355b1d0f2..ee0e0051d3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -60,6 +60,11 @@ endfunction()
set_if_target(_has_svg_target Qt5::Svg)
option(ENABLE_SVG_SUPPORT "Enable SVG support" "${_has_svg_target}")
+# specify standards conformance mode to MSVC 2017 and later
+if (MSVC AND MSVC_VERSION GREATER_EQUAL 1910)
+ add_compile_options(/permissive-)
+endif()
+
add_library(OptionalSvg INTERFACE)
if (TARGET Qt5::Svg AND ENABLE_SVG_SUPPORT)
target_link_libraries(OptionalSvg INTERFACE Qt5::Svg)
diff --git a/tests/unit/unittest/gtest-clang-printing.cpp b/tests/unit/unittest/gtest-clang-printing.cpp
index 4c10958f52..c7004d25c5 100644
--- a/tests/unit/unittest/gtest-clang-printing.cpp
+++ b/tests/unit/unittest/gtest-clang-printing.cpp
@@ -31,6 +31,7 @@
#include <clangdocumentsuspenderresumer.h>
#include <clangreferencescollector.h>
+#include <filepathview.h>
#include <fulltokeninfo.h>
#include <tokenprocessor.h>