Fixes
authorEduardo Ramos Testillano <eduardo.ramos.testillano@ericsson.com>
Tue, 6 Jun 2017 22:18:42 +0000 (00:18 +0200)
committerEduardo Ramos Testillano <eduardo.ramos.testillano@ericsson.com>
Tue, 6 Jun 2017 22:18:42 +0000 (00:18 +0200)
CMakeLists.txt
README.md

index a4bc412..1cd503d 100644 (file)
@@ -63,18 +63,25 @@ message(STATUS "The c++ compiler is ${CMAKE_CXX_COMPILER}")
 message(STATUS "The build type is ${CMAKE_BUILD_TYPE}")
 
 # Example how to set c++ compiler flags for GNU
+message(STATUS "CMAKE_CXX_COMPILER_ID = ${CMAKE_CXX_COMPILER_ID}")
 if(CMAKE_CXX_COMPILER_ID MATCHES GNU)
     #execute_process(COMMAND g++ --version >/dev/null 2>/dev/null)
-    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wno-unknown-pragmas -Wno-sign-compare -Woverloaded-virtual -Wwrite-strings -Wno-unused")
-    set(CMAKE_CXX_FLAGS_DEBUG   "-O0 -g3")
-    set(CMAKE_CXX_FLAGS_RELEASE "-O3")
+    set(CMAKE_CXX_COMPILER             "/usr/bin/g++")
+    set(CMAKE_CXX_FLAGS                "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wno-unknown-pragmas -Wno-sign-compare -Woverloaded-virtual -Wwrite-strings -Wno-unused")
+    set(CMAKE_CXX_FLAGS_DEBUG          "-O0 -g3")
+    set(CMAKE_CXX_FLAGS_MINSIZEREL     "-Os -DNDEBUG")
+    set(CMAKE_CXX_FLAGS_RELEASE        "-O3")
+    set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g")
 
 elseif(CMAKE_CXX_COMPILER_ID MATCHES Clang)
     #execute_process(COMMAND clang++ --version >/dev/null 2>/dev/null)
     add_definitions(-DIS_CLANG)
-    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wno-unknown-pragmas -Wno-sign-compare -Woverloaded-virtual -Wwrite-strings -Wno-unused -Wno-parentheses-equality")
-    set(CMAKE_CXX_FLAGS_DEBUG   "-O0 -g3")
-    set(CMAKE_CXX_FLAGS_RELEASE "-O3")
+    set(CMAKE_CXX_COMPILER             "/usr/bin/clang++")
+    set(CMAKE_CXX_FLAGS                "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wno-unknown-pragmas -Wno-sign-compare -Woverloaded-virtual -Wwrite-strings -Wno-unused -Wno-parentheses-equality")
+    set(CMAKE_CXX_FLAGS_DEBUG          "-O0 -g3")
+    set(CMAKE_CXX_FLAGS_MINSIZEREL     "-Os -DNDEBUG")
+    set(CMAKE_CXX_FLAGS_RELEASE        "-O3")
+    set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g")
 endif()
 
 
index 10d9445..06247b4 100644 (file)
--- a/README.md
+++ b/README.md
@@ -34,6 +34,9 @@ You could specify type of build, 'Debug' or 'Release', for example:
 
      > make clean
 
+## Change the compiler to Clang++
+
+     > cmake -DCMAKE_CXX_COMPILER=/usr/bin/clang++ 
 
 ## Some basic ubuntu requirements