Browse Source

compiler flag handling

Thomas Buck 10 years ago
parent
commit
8f2aa2da89
1 changed files with 21 additions and 10 deletions
  1. 21
    10
      CMakeLists.txt

+ 21
- 10
CMakeLists.txt View File

@@ -9,7 +9,7 @@ set (OpenRaider_VERSION_MICRO 2)
9 9
 # Build Host
10 10
 set (OpenRaider_BUILD_HOST ${CMAKE_HOST_SYSTEM})
11 11
 
12
-# Apple specific
12
+# Apple specific bundling
13 13
 if (APPLE)
14 14
 
15 15
     # Mac Bundle Data
@@ -36,10 +36,7 @@ configure_file (
36 36
 )
37 37
 include_directories ("${PROJECT_BINARY_DIR}")
38 38
 
39
-# Preprocessor Flags
40
-set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
41
-
42
-# Source Files, Executable
39
+# Executable, Source files
43 40
 add_executable (OpenRaider MACOSX_BUNDLE
44 41
     src/Camera.cpp
45 42
     src/Emitter.cpp
@@ -65,13 +62,26 @@ add_executable (OpenRaider MACOSX_BUNDLE
65 62
     ${SRCS}
66 63
 )
67 64
 
68
-# Definitions for Debug build
69
-set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG -DEXPERIMENTAL")
65
+# Default to Debug build
66
+set (CMAKE_BUILD_TYPE "Debug")
67
+
68
+# Flags for all builds
69
+set (OpenRaider_CXX_FLAGS "${OpenRaider_CXX_FLAGS} -std=c++11")
70
+set (OpenRaider_CXX_FLAGS "${OpenRaider_CXX_FLAGS} -DUSING_EMITTER")
71
+
72
+# Flags for Debug build
73
+set (OpenRaider_CXX_FLAGS_DEBUG "${OpenRaider_CXX_FLAGS_DEBUG} -DDEBUG")
74
+set (OpenRaider_CXX_FLAGS_DEBUG "${OpenRaider_CXX_FLAGS_DEBUG} -DEXPERIMENTAL")
75
+
76
+# Flags for Releasae builds
77
+set (OpenRaider_CXX_FLAGS_RELEASE "${OpenRaider_CXX_FLAGS_RELEASE}")
70 78
 
71
-# Definitions for all builds
72
-set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUSING_EMITTER")
79
+# Apply Flags
80
+set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenRaider_CXX_FLAGS}")
81
+set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${OpenRaider_CXX_FLAGS} ${OpenRaider_CXX_FLAGS_DEBUG}")
82
+set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${OpenRaider_CXX_FLAGS} ${OpenRaider_CXX_FLAGS_RELEASE}")
73 83
 
74
-# Include Directory
84
+# Include directory
75 85
 include_directories ("${PROJECT_SOURCE_DIR}/include")
76 86
 
77 87
 # Include External Modules
@@ -112,6 +122,7 @@ target_link_libraries (OpenRaider ${LIBS})
112 122
 
113 123
 # Preparing the bundle on install
114 124
 # http://www.cmake.org/Wiki/BundleUtilitiesExample
125
+# Why does it even work?
115 126
 if (APPLE)
116 127
     set (plugin_dest_dir OpenRaider.app/Contents/MacOS)
117 128
     set (APPS "${PROJECT_BINARY_DIR}/OpenRaider.app")

Loading…
Cancel
Save