mirror of
https://github.com/zeromq/libzmq.git
synced 2024-12-12 18:40:27 +01:00
Merge pull request #3909 from nyfix/std
allow C/C++ standard to be specified at build time, default to C++11 if supported
This commit is contained in:
commit
4a863e334a
@ -68,16 +68,21 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL Darwin)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (NOT MSVC)
|
if (NOT MSVC)
|
||||||
|
if(NOT CMAKE_CXX_FLAGS MATCHES "-std=")
|
||||||
|
# use C++11 by default if supported
|
||||||
check_cxx_compiler_flag("-std=gnu++11" COMPILER_SUPPORTS_CXX11)
|
check_cxx_compiler_flag("-std=gnu++11" COMPILER_SUPPORTS_CXX11)
|
||||||
if(COMPILER_SUPPORTS_CXX11)
|
if(COMPILER_SUPPORTS_CXX11)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
|
||||||
endif()
|
endif()
|
||||||
|
endif()
|
||||||
|
if(NOT CMAKE_C_FLAGS MATCHES "-std=")
|
||||||
check_c_compiler_flag("-std=gnu11" COMPILER_SUPPORTS_C11)
|
check_c_compiler_flag("-std=gnu11" COMPILER_SUPPORTS_C11)
|
||||||
if(COMPILER_SUPPORTS_C11)
|
if(COMPILER_SUPPORTS_C11)
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu11")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu11")
|
||||||
else()
|
else()
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99")
|
||||||
endif()
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
# clang 6 has a warning that does not make sense on multi-platform code
|
# clang 6 has a warning that does not make sense on multi-platform code
|
||||||
check_cxx_compiler_flag("-Wno-tautological-constant-compare" CXX_HAS_TAUT_WARNING)
|
check_cxx_compiler_flag("-Wno-tautological-constant-compare" CXX_HAS_TAUT_WARNING)
|
||||||
|
Loading…
Reference in New Issue
Block a user