Skip to content

Commit

Permalink
Use CMake variable to control release vs. debug vs. profile
Browse files Browse the repository at this point in the history
SVN-Revision: 5801
  • Loading branch information
tuxdev committed Oct 22, 2008
1 parent 6103be8 commit afd5f1b
Showing 1 changed file with 7 additions and 18 deletions.
25 changes: 7 additions & 18 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -194,26 +194,15 @@ ENDIF(PRECOMPILE_HEADERS)

## Debug options

OPTION(DEBUG "Build with debugging options" OFF)
OPTION(PROFILE "Build with profiling information" OFF)
OPTION(WERROR "Stops on first compiler warning in debug mode" ON)
IF(CMAKE_COMPILER_IS_GNUCC)
ADD_DEFINITIONS(-Wall -W)
IF (DEBUG)
REMOVE_DEFINITIONS(-O2)
ADD_DEFINITIONS(-O0 -g)
IF(WERROR)
ADD_DEFINITIONS(-Werror)
ENDIF(WERROR)
ELSE (DEBUG)
ADD_DEFINITIONS(-O2)
REMOVE_DEFINITIONS(-O0 -g)
ENDIF (DEBUG)
IF (PROFILE)
ADD_DEFINITIONS(-pg)
ELSE (PROFILE)
REMOVE_DEFINITIONS(-pg)
ENDIF (PROFILE)
ADD_DEFINITIONS(-Wall -Wextra)
SET(CMAKE_CXX_FLAGS_PROFILE "-pg")
SET(CMAKE_C_FLAGS_PROFILE "-pg")
SET(CMAKE_LD_FLAGS_PROFILE "-pg")
IF(WERROR)
ADD_DEFINITIONS(-Werror)
ENDIF(WERROR)
ENDIF(CMAKE_COMPILER_IS_GNUCC)

## Add in squirrel debug stuff
Expand Down

0 comments on commit afd5f1b

Please sign in to comment.