Skip to content

Commit c4ab9d3

Browse files
committed
Identify Clang compiler when used as an MSVC extension
1 parent 8f7a263 commit c4ab9d3

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

CMakeLists.txt

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,24 @@ option(UTPP_AMPLIFY_WARNINGS
1111
"Set this to OFF if you wish to use CMake default warning levels; should generally only use to work around support issues for your specific compiler"
1212
ON)
1313

14-
message(STATUS "CMAKE_CXX_COMPILER_ID = ${CMAKE_CXX_COMPILER_ID}")
15-
if(MSVC14 OR MSVC12)
16-
message(STATUS "Using MSVC compiler")
17-
# has the support we need
14+
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
15+
# CHECK_CXX_COMPILER_FLAG could be used
16+
# but MSVC version is preferred for feature requirements
17+
if (MSVC14 OR MSVC12)
18+
# has the support we need
19+
else()
20+
message(WARNING "The MSVC compiler version does not support required C++11 features. Please use a different C++ compiler.")
21+
endif()
1822
else()
1923
include(CheckCXXCompilerFlag)
2024
CHECK_CXX_COMPILER_FLAG("-std=c++14" COMPILER_SUPPORTS_CXX14)
2125
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
2226
if(COMPILER_SUPPORTS_CXX14)
23-
message(STATUS "Specify C++14")
2427
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
2528
elseif(COMPILER_SUPPORTS_CXX11)
26-
message(STATUS "Specify C++11")
2729
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
2830
else()
29-
message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
31+
message(WARNING "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
3032
endif()
3133
endif()
3234

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy