Author: brane
Date: Mon Jul  2 11:55:32 2018
New Revision: 1834837

URL: http://svn.apache.org/viewvc?rev=1834837&view=rev
Log:
* CMakeLists.txt: Set the build type first, by forcing it into the cache.

Modified:
    serf/trunk/CMakeLists.txt

Modified: serf/trunk/CMakeLists.txt
URL: 
http://svn.apache.org/viewvc/serf/trunk/CMakeLists.txt?rev=1834837&r1=1834836&r2=1834837&view=diff
==============================================================================
--- serf/trunk/CMakeLists.txt (original)
+++ serf/trunk/CMakeLists.txt Mon Jul  2 11:55:32 2018
@@ -28,6 +28,15 @@ message(WARNING
         "has not been tested on many supported platforms.")
 enable_testing()
 
+# Initialize the build type if it was not set on the command line.
+if(NOT CMAKE_BUILD_TYPE)
+  if(DEBUG)
+    set(CMAKE_BUILD_TYPE DEBUG CACHE STRING "Default to debug build.")
+  else()
+    set(CMAKE_BUILD_TYPE RELEASE CACHE STRING "Default to release build.")
+  endif()
+endif()
+
 include(SerfPlatform)
 include(SerfWindowsToolkit)
 
@@ -259,16 +268,6 @@ else()
 endif(NOT MSVC)
 
 
-# This must come *AFTER* all the compiler flags and definitioins are set.
-if(NOT CMAKE_BUILD_TYPE)
-  if(DEBUG)
-    set(CMAKE_BUILD_TYPE DEBUG)
-  else()
-    set(CMAKE_BUILD_TYPE RELEASE)
-  endif()
-endif()
-
-
 # Define all targets
 add_library(serf SHARED ${SOURCES} ${SHARED_SOURCES})
 target_link_libraries(serf ${DEPENDENCY_LIBRARIES})


Reply via email to