Skip to content
Browse files

Add default CMAKE_CXX_FLAGS

OpenNI2-FreenectDriver: Stop clobbering CXXFLAGS

Signed-off-by: Benn Snyder <benn.snyder@gmail.com>
  • Loading branch information...
1 parent bd9e41b commit cb0254a10dbeae8bdb8095d390b4ff69a2becc6e @piedar piedar committed
Showing with 14 additions and 6 deletions.
  1. +13 −5 CMakeLists.txt
  2. +1 −1 OpenNI2-FreenectDriver/CMakeLists.txt
View
18 CMakeLists.txt
@@ -62,7 +62,7 @@ IF(PROJECT_OS_LINUX)
ENDIF(PROJECT_OS_LINUX)
######################################################################################
-# CMake Modules
+# Dependencies and Definitions
######################################################################################
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules/")
@@ -106,13 +106,22 @@ else ()
set(C_FLAGS_WARNING "-Wall")
endif (MSVC)
-# These defaults can be overriden by environment CFLAGS
-set(CMAKE_C_FLAGS "-O2 ${C_FLAGS_WARNING} ${CMAKE_C_FLAGS}")
-# Configurations
+set(C_CXX_FLAGS_DEFAULT "${C_FLAGS_WARNING} -O2")
+
+# These defaults can be overriden by -DCMAKE_C_FLAGS=""
+set(CMAKE_C_FLAGS "${C_CXX_FLAGS_DEFAULT} ${CMAKE_C_FLAGS}")
+# C Configurations
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -g -DDEBUG=1")
SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS}")
SET(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELEASE} -g")
+# These defaults can be overriden by -DCMAKE_CXX_FLAGS=""
+set(CMAKE_CXX_FLAGS "${C_CXX_FLAGS_DEFAULT} ${CMAKE_CXX_FLAGS}")
+# C++ Configurations
+SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -g -DDEBUG=1")
+SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS}")
+SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELEASE} -g")
+
# Pretty much everyone is going to need the main includes
include_directories (${CMAKE_CURRENT_SOURCE_DIR}/include)
@@ -127,7 +136,6 @@ endif()
# Add library project
add_subdirectory (src)
-# Add examples
IF(BUILD_EXAMPLES)
add_subdirectory (examples)
ENDIF()
View
2 OpenNI2-FreenectDriver/CMakeLists.txt
@@ -6,7 +6,7 @@ file(GLOB HEADERS src/*.hpp src/*.h)
file(GLOB SOURCES src/*.cpp)
add_library(FreenectDriver SHARED ${HEADERS} ${SOURCES})
-set(CMAKE_CXX_FLAGS "-Wno-gnu-static-float-init -Wno-unused-function")
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-function")
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib/OpenNI2-FreenectDriver)
set_target_properties(FreenectDriver PROPERTIES

0 comments on commit cb0254a

Please sign in to comment.
Something went wrong with that request. Please try again.