From 081dc312debbf28cf8630c76031c1d23cf16d6da Mon Sep 17 00:00:00 2001 From: Ricardo Quesada Date: Fri, 4 Mar 2016 12:49:40 -0800 Subject: [PATCH] CMAKE_BUILD_TYPE has precedence over DEBUG_MODE cmake fixes --- CMakeLists.txt | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e4fcb67b0a..7add2e3647 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -95,11 +95,15 @@ if(USE_PREBUILT_LIBS AND MINGW) message(FATAL_ERROR "Prebuilt windows libs can't be used with mingw, please use packages.") endif() -if(DEBUG_MODE) - set(CMAKE_BUILD_TYPE DEBUG) -else(DEBUG_MODE) - set(CMAKE_BUILD_TYPE RELEASE) -endif(DEBUG_MODE) +# CMAKE_BUILD_TYPE has precedence over DEBUG_MODE +# Still supporting DEBUG_MODE for backwards compatibility +if (NOT CMAKE_BUILD_TYPE) + if(DEBUG_MODE) + set(CMAKE_BUILD_TYPE DEBUG) + else(DEBUG_MODE) + set(CMAKE_BUILD_TYPE RELEASE) + endif(DEBUG_MODE) +endif(NOT CMAKE_BUILD_TYPE) set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DCOCOS2D_DEBUG=1") set(CMAKE_CXX_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG})