From f28d977659db23f54b7a5badf6ef40b118e82ad9 Mon Sep 17 00:00:00 2001 From: Eduardo Ramos Testillano Date: Wed, 7 Jun 2017 00:18:42 +0200 Subject: [PATCH] Fixes --- CMakeLists.txt | 19 +++++++++++++------ README.md | 3 +++ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a4bc412..1cd503d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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() diff --git a/README.md b/README.md index 10d9445..06247b4 100644 --- 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 -- 2.20.1