From 80650ecfe2016d2a333b553dca079cb9ef6d8499 Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Fri, 19 Feb 2016 21:48:43 +0000 Subject: [PATCH] Problem: need to check for C++ standard in cmake Solution: use CheckCXXCompilerFlag to check for support for -std=gnu++11 --- CMakeLists.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index e0e06d19..6556539d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,6 +5,17 @@ project (ZeroMQ) list (INSERT CMAKE_MODULE_PATH 0 "${CMAKE_SOURCE_DIR}") +include(CheckCXXCompilerFlag) +CHECK_CXX_COMPILER_FLAG("-std=gnu++11" COMPILER_SUPPORTS_CXX11) +if(COMPILER_SUPPORTS_CXX11) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11") +endif() +include(CheckCCompilerFlag) +CHECK_C_COMPILER_FLAG("-std=gnu11" COMPILER_SUPPORTS_C11) +if(COMPILER_SUPPORTS_C11) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu11") +endif() + option (WITH_OPENPGM "Build with support for OpenPGM" OFF) option (WITH_VMCI "Build with support for VMware VMCI socket" OFF)