commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] [gnuradio] 05/14: set c/c++ standard in cmake so that


From: git
Subject: [Commit-gnuradio] [gnuradio] 05/14: set c/c++ standard in cmake so that we are not dependent on the default c/c++ standard set by the specific compiler.
Date: Mon, 30 May 2016 21:23:22 +0000 (UTC)

This is an automated email from the git hooks/post-receive script.

jcorgan pushed a commit to branch master
in repository gnuradio.

commit 7862cf2e70fa497e50e96c11f9347c7adeccfc77
Author: Stefan Wunsch <address@hidden>
Date:   Wed May 18 14:52:49 2016 +0200

    set c/c++ standard in cmake so that we are not dependent on the default 
c/c++ standard set by the specific compiler.
---
 CMakeLists.txt | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3641ab4..6e767ed 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -54,6 +54,31 @@ include(GrVersion) #setup version info
 SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O2")
 SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O2")
 
+# Set C/C++ standard for all targets
+# NOTE: Starting with cmake v3.1 this should be used:
+# set(CMAKE_C_STANDARD 90)
+# set(CMAKE_CXX_STANDARD 98)
+
+IF(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
+    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++98")
+ELSEIF(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
+    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++98")
+ELSEIF(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
+    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++98")
+ELSE()
+    message(warning "C++ standard could not be set because compiler is not 
GNU, Clang or MSVC.")
+ENDIF()
+
+IF(CMAKE_C_COMPILER_ID STREQUAL "GNU")
+    SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu11")
+ELSEIF(CMAKE_C_COMPILER_ID STREQUAL "Clang")
+    SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu11")
+ELSEIF(CMAKE_C_COMPILER_ID STREQUAL "MSVC")
+    SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11")
+ELSE()
+    message(warning "C standard could not be set because compiler is not GNU, 
Clang or MSVC.")
+ENDIF()
+
 ########################################################################
 # Environment setup
 ########################################################################



reply via email to

[Prev in Thread] Current Thread [Next in Thread]