From 3c976c040b48caa9f3e75d12a6502e39193ce9a6 Mon Sep 17 00:00:00 2001 From: Didier Raboud Date: Wed, 19 Dec 2012 16:52:11 +0100 Subject: Don't enforce CMake build type on users. Only set CMAKE_BUILD_TYPE to Debug when no value is provided. --- CMakeLists.txt | 4 +++- src/CBot/tests/CBot_console/CMakeLists.txt | 4 +++- src/common/test/CMakeLists.txt | 4 +++- src/graphics/engine/test/CMakeLists.txt | 4 +++- src/graphics/opengl/test/CMakeLists.txt | 4 +++- src/math/test/CMakeLists.txt | 4 +++- src/plugins/test/CMakeLists.txt | 4 +++- src/sound/plugins/oalsound/test/CMakeLists.txt | 4 +++- src/ui/test/CMakeLists.txt | 4 +++- 9 files changed, 27 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4640db6..96ae055 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,7 +16,9 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${colobot_SOURCE_DIR}/cmake") ## # Global build type -set(CMAKE_BUILD_TYPE debug) +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE debug) +endif(NOT CMAKE_BUILD_TYPE) # Global compile flags # These are specific to GCC/MinGW; for other compilers, change as necessary diff --git a/src/CBot/tests/CBot_console/CMakeLists.txt b/src/CBot/tests/CBot_console/CMakeLists.txt index 7d9f034..3ba118d 100644 --- a/src/CBot/tests/CBot_console/CMakeLists.txt +++ b/src/CBot/tests/CBot_console/CMakeLists.txt @@ -3,7 +3,9 @@ cmake_minimum_required(VERSION 2.8) project(CBot_console C CXX) # Build with debugging symbols -set(CMAKE_BUILD_TYPE debug) +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE debug) +endif(NOT CMAKE_BUILD_TYPE) # Global compile flags set(CMAKE_CXX_FLAGS_RELEASE "-O2 -Wall -Wold-style-cast -std=gnu++0x") diff --git a/src/common/test/CMakeLists.txt b/src/common/test/CMakeLists.txt index 08efdb3..370213d 100644 --- a/src/common/test/CMakeLists.txt +++ b/src/common/test/CMakeLists.txt @@ -1,6 +1,8 @@ cmake_minimum_required(VERSION 2.8) -set(CMAKE_BUILD_TYPE debug) +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE debug) +endif(NOT CMAKE_BUILD_TYPE) set(CMAKE_CXX_FLAGS_DEBUG "-g -O0 -Wall -Wold-style-cast -std=gnu++0x") include_directories( diff --git a/src/graphics/engine/test/CMakeLists.txt b/src/graphics/engine/test/CMakeLists.txt index 775abe5..b08e02d 100644 --- a/src/graphics/engine/test/CMakeLists.txt +++ b/src/graphics/engine/test/CMakeLists.txt @@ -1,6 +1,8 @@ cmake_minimum_required(VERSION 2.8) -set(CMAKE_BUILD_TYPE debug) +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE debug) +endif(NOT CMAKE_BUILD_TYPE) set(CMAKE_CXX_FLAGS_DEBUG "-g -O0 -Wall -Wold-style-cast -std=gnu++0x") set(MODELFILE_TEST_SOURCES diff --git a/src/graphics/opengl/test/CMakeLists.txt b/src/graphics/opengl/test/CMakeLists.txt index be33ac6..3a0cc2a 100644 --- a/src/graphics/opengl/test/CMakeLists.txt +++ b/src/graphics/opengl/test/CMakeLists.txt @@ -5,7 +5,9 @@ find_package(SDL REQUIRED) find_package(SDL_image REQUIRED) find_package(PNG REQUIRED) -set(CMAKE_BUILD_TYPE debug) +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE debug) +endif(NOT CMAKE_BUILD_TYPE) set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g -O0 -Wold-style-cast -std=gnu++0x") set(ADD_LIBS "") diff --git a/src/math/test/CMakeLists.txt b/src/math/test/CMakeLists.txt index 5bc9027..4f7813e 100644 --- a/src/math/test/CMakeLists.txt +++ b/src/math/test/CMakeLists.txt @@ -1,6 +1,8 @@ cmake_minimum_required(VERSION 2.8) -set(CMAKE_BUILD_TYPE debug) +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE debug) +endif(NOT CMAKE_BUILD_TYPE) set(CMAKE_CXX_FLAGS_DEBUG "-g -O0 -Wall -Wold-style-cast -std=gnu++0x") include_directories( diff --git a/src/plugins/test/CMakeLists.txt b/src/plugins/test/CMakeLists.txt index a68de2c..ff4f67b 100644 --- a/src/plugins/test/CMakeLists.txt +++ b/src/plugins/test/CMakeLists.txt @@ -1,6 +1,8 @@ cmake_minimum_required(VERSION 2.8) -set(CMAKE_BUILD_TYPE debug) +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE debug) +endif(NOT CMAKE_BUILD_TYPE) set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g -O0 -std=c++11 -rdynamic") add_executable(manager_test manager_test.cpp ../../common/logger.cpp ../../common/profile.cpp ../../common/iman.cpp ../pluginmanager.cpp ../pluginloader.cpp) diff --git a/src/sound/plugins/oalsound/test/CMakeLists.txt b/src/sound/plugins/oalsound/test/CMakeLists.txt index f7b165c..27ab756 100644 --- a/src/sound/plugins/oalsound/test/CMakeLists.txt +++ b/src/sound/plugins/oalsound/test/CMakeLists.txt @@ -1,6 +1,8 @@ cmake_minimum_required(VERSION 2.8) -set(CMAKE_BUILD_TYPE debug) +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE debug) +endif(NOT CMAKE_BUILD_TYPE) set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g -O0 -std=c++11 -rdynamic") add_executable(plugin_test plugin_test.cpp ../../../../common/iman.cpp ../../../../common/logger.cpp ../../../../plugins/pluginloader.cpp) diff --git a/src/ui/test/CMakeLists.txt b/src/ui/test/CMakeLists.txt index 7562a04..ca976b7 100644 --- a/src/ui/test/CMakeLists.txt +++ b/src/ui/test/CMakeLists.txt @@ -1,6 +1,8 @@ cmake_minimum_required(VERSION 2.8) -set(CMAKE_BUILD_TYPE debug) +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE debug) +endif(NOT CMAKE_BUILD_TYPE) set(CMAKE_CXX_FLAGS_DEBUG "-g -O0 -Wall -Wold-style-cast -std=gnu++0x") include_directories( -- cgit v1.2.3-1-g7c22 From 7e9ef0c042fd14373a129ca8a5ac94e9679daee9 Mon Sep 17 00:00:00 2001 From: Didier Raboud Date: Wed, 19 Dec 2012 16:54:58 +0100 Subject: Put common CXX flags in common variables CMAKE_CXX_FLAGS is taken into account in all builds; build-type-specific flags are appended to it. --- CMakeLists.txt | 5 +++-- src/CBot/tests/CBot_console/CMakeLists.txt | 5 +++-- src/common/test/CMakeLists.txt | 3 ++- src/graphics/engine/test/CMakeLists.txt | 3 ++- src/graphics/opengl/test/CMakeLists.txt | 3 ++- src/math/test/CMakeLists.txt | 3 ++- src/plugins/test/CMakeLists.txt | 3 ++- src/sound/plugins/oalsound/CMakeLists.txt | 3 ++- src/sound/plugins/oalsound/test/CMakeLists.txt | 3 ++- src/ui/test/CMakeLists.txt | 3 ++- 10 files changed, 22 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 96ae055..78298a5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,8 +22,9 @@ endif(NOT CMAKE_BUILD_TYPE) # Global compile flags # These are specific to GCC/MinGW; for other compilers, change as necessary -set(CMAKE_CXX_FLAGS_RELEASE "-O2 -Wall -Wold-style-cast -std=gnu++0x") -set(CMAKE_CXX_FLAGS_DEBUG "-g -O0 -Wall -Wold-style-cast -std=gnu++0x") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wold-style-cast -std=gnu++0x") +set(CMAKE_CXX_FLAGS_RELEASE "-O2") +set(CMAKE_CXX_FLAGS_DEBUG "-g -O0") # Asserts can be enabled/disabled regardless of build type option(ASSERTS "Enable assert()s" ON) diff --git a/src/CBot/tests/CBot_console/CMakeLists.txt b/src/CBot/tests/CBot_console/CMakeLists.txt index 3ba118d..9f0f244 100644 --- a/src/CBot/tests/CBot_console/CMakeLists.txt +++ b/src/CBot/tests/CBot_console/CMakeLists.txt @@ -8,8 +8,9 @@ if(NOT CMAKE_BUILD_TYPE) endif(NOT CMAKE_BUILD_TYPE) # Global compile flags -set(CMAKE_CXX_FLAGS_RELEASE "-O2 -Wall -Wold-style-cast -std=gnu++0x") -set(CMAKE_CXX_FLAGS_DEBUG "-g -O0 -Wall -Wold-style-cast -std=gnu++0x") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wold-style-cast -std=gnu++0x") +set(CMAKE_CXX_FLAGS_RELEASE "-O2") +set(CMAKE_CXX_FLAGS_DEBUG "-g -O0") # Include cmake directory SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${colobot_SOURCE_DIR}/cmake") diff --git a/src/common/test/CMakeLists.txt b/src/common/test/CMakeLists.txt index 370213d..26a31c9 100644 --- a/src/common/test/CMakeLists.txt +++ b/src/common/test/CMakeLists.txt @@ -3,7 +3,8 @@ cmake_minimum_required(VERSION 2.8) if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE debug) endif(NOT CMAKE_BUILD_TYPE) -set(CMAKE_CXX_FLAGS_DEBUG "-g -O0 -Wall -Wold-style-cast -std=gnu++0x") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wold-style-cast -std=gnu++0x") +set(CMAKE_CXX_FLAGS_DEBUG "-g -O0") include_directories( . diff --git a/src/graphics/engine/test/CMakeLists.txt b/src/graphics/engine/test/CMakeLists.txt index b08e02d..46509f4 100644 --- a/src/graphics/engine/test/CMakeLists.txt +++ b/src/graphics/engine/test/CMakeLists.txt @@ -3,7 +3,8 @@ cmake_minimum_required(VERSION 2.8) if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE debug) endif(NOT CMAKE_BUILD_TYPE) -set(CMAKE_CXX_FLAGS_DEBUG "-g -O0 -Wall -Wold-style-cast -std=gnu++0x") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wold-style-cast -std=gnu++0x") +set(CMAKE_CXX_FLAGS_DEBUG "-g -O0") set(MODELFILE_TEST_SOURCES modelfile_test.cpp diff --git a/src/graphics/opengl/test/CMakeLists.txt b/src/graphics/opengl/test/CMakeLists.txt index 3a0cc2a..154fec8 100644 --- a/src/graphics/opengl/test/CMakeLists.txt +++ b/src/graphics/opengl/test/CMakeLists.txt @@ -8,7 +8,8 @@ find_package(PNG REQUIRED) if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE debug) endif(NOT CMAKE_BUILD_TYPE) -set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g -O0 -Wold-style-cast -std=gnu++0x") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wold-style-cast -std=gnu++0x") +set(CMAKE_CXX_FLAGS_DEBUG "-g -O0") set(ADD_LIBS "") diff --git a/src/math/test/CMakeLists.txt b/src/math/test/CMakeLists.txt index 4f7813e..dae4018 100644 --- a/src/math/test/CMakeLists.txt +++ b/src/math/test/CMakeLists.txt @@ -3,7 +3,8 @@ cmake_minimum_required(VERSION 2.8) if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE debug) endif(NOT CMAKE_BUILD_TYPE) -set(CMAKE_CXX_FLAGS_DEBUG "-g -O0 -Wall -Wold-style-cast -std=gnu++0x") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wold-style-cast -std=gnu++0x") +set(CMAKE_CXX_FLAGS_DEBUG "-g -O0") include_directories( . diff --git a/src/plugins/test/CMakeLists.txt b/src/plugins/test/CMakeLists.txt index ff4f67b..31b4163 100644 --- a/src/plugins/test/CMakeLists.txt +++ b/src/plugins/test/CMakeLists.txt @@ -3,7 +3,8 @@ cmake_minimum_required(VERSION 2.8) if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE debug) endif(NOT CMAKE_BUILD_TYPE) -set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g -O0 -std=c++11 -rdynamic") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11 -rdynamic") +set(CMAKE_CXX_FLAGS_DEBUG "-g -O0") add_executable(manager_test manager_test.cpp ../../common/logger.cpp ../../common/profile.cpp ../../common/iman.cpp ../pluginmanager.cpp ../pluginloader.cpp) diff --git a/src/sound/plugins/oalsound/CMakeLists.txt b/src/sound/plugins/oalsound/CMakeLists.txt index 0bc9482..bb7e9ff 100644 --- a/src/sound/plugins/oalsound/CMakeLists.txt +++ b/src/sound/plugins/oalsound/CMakeLists.txt @@ -6,7 +6,8 @@ set(SOURCES channel.cpp ) -SET (CMAKE_CXX_FLAGS "-Wall -g -std=c++0x -fPIC") +SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++0x -fPIC") +SET (CMAKE_CXX_FLAGS_DEBUG "-g") include(FindPkgConfig) include(FindOpenAL) diff --git a/src/sound/plugins/oalsound/test/CMakeLists.txt b/src/sound/plugins/oalsound/test/CMakeLists.txt index 27ab756..dd208ea 100644 --- a/src/sound/plugins/oalsound/test/CMakeLists.txt +++ b/src/sound/plugins/oalsound/test/CMakeLists.txt @@ -3,7 +3,8 @@ cmake_minimum_required(VERSION 2.8) if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE debug) endif(NOT CMAKE_BUILD_TYPE) -set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g -O0 -std=c++11 -rdynamic") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11 -rdynamic") +set(CMAKE_CXX_FLAGS_DEBUG "-g -O0") add_executable(plugin_test plugin_test.cpp ../../../../common/iman.cpp ../../../../common/logger.cpp ../../../../plugins/pluginloader.cpp) diff --git a/src/ui/test/CMakeLists.txt b/src/ui/test/CMakeLists.txt index ca976b7..e411067 100644 --- a/src/ui/test/CMakeLists.txt +++ b/src/ui/test/CMakeLists.txt @@ -3,7 +3,8 @@ cmake_minimum_required(VERSION 2.8) if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE debug) endif(NOT CMAKE_BUILD_TYPE) -set(CMAKE_CXX_FLAGS_DEBUG "-g -O0 -Wall -Wold-style-cast -std=gnu++0x") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wold-style-cast -std=gnu++0x") +set(CMAKE_CXX_FLAGS_DEBUG "-g -O0") include_directories( . -- cgit v1.2.3-1-g7c22