Skip to content

Commit

Permalink
MSVC: Enable the detection of C++14 and 17 in MSVC 2017 15.7
Browse files Browse the repository at this point in the history
We need -Zc:__cplusplus in order to enable the __cplusplus macro having
the correct value. This causes configure to now print:

 Checking for C++14 support... yes
 Checking for C++1z support... yes

and

  Using C++ standard ..................... C++1z

Change-Id: I5d0ee9389a794d80983efffd152c95a4d9d8adbc
Reviewed-by: Oswald Buddenhagen <[email protected]>
Reviewed-by: Thiago Macieira <[email protected]>
  • Loading branch information
thiagomacieira committed Jun 11, 2018
1 parent 427e5d6 commit 3e201d6
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions mkspecs/common/msvc-version.conf
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,16 @@ greaterThan(QMAKE_MSC_VER, 1909) {
# API is used in direct2d, but also in multimedia, positioning and sensors.
# We can try again with a later version of Visual Studio.
# QMAKE_CXXFLAGS_STRICTCXX = -permissive-

# MSVC partially supports the following, but '__cplusplus' definition is set
# as for C++98 until MSVC fully conforms with C++14, see
# https://developercommunity.visualstudio.com/content/problem/139261/msvc-incorrectly-defines-cplusplus.html
# QMAKE_CXXFLAGS_CXX14 = -std:c++14
# QMAKE_CXXFLAGS_CXX1Z = -std:c++latest
# Support became available in MSVC 2017 15.7:
greaterThan(QMAKE_MSC_VER, 1913) {
QMAKE_CXXFLAGS += -Zc:__cplusplus
QMAKE_CXXFLAGS_CXX14 = -std:c++14
QMAKE_CXXFLAGS_CXX1Z = -std:c++17
}
}

greaterThan(QMAKE_MSC_VER, 1910) {
Expand Down

0 comments on commit 3e201d6

Please sign in to comment.