Added a custom flag for the level of optimization
This commit is contained in:
@ -30,13 +30,23 @@ set(CMAKE_C_FLAGS "-Wall -fPIC")
|
|||||||
set(CMAKE_CXX_FLAGS "-Wall -fPIC")
|
set(CMAKE_CXX_FLAGS "-Wall -fPIC")
|
||||||
|
|
||||||
if(BUILD_TYPE MATCHES Debug)
|
if(BUILD_TYPE MATCHES Debug)
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ggdb -O0 -pthread -pipe -DSS_DEBUG -Wformat -Werror=format-security -fstack-protector --param=ssp-buffer-size=4")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ggdb -pthread -pipe -DSS_DEBUG -Wformat -Werror=format-security -fstack-protector --param=ssp-buffer-size=4")
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ggdb -O0 -pthread -pipe -DSS_DEBUG -Wformat -Werror=format-security -fstack-protector --param=ssp-buffer-size=4")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ggdb -pthread -pipe -DSS_DEBUG -Wformat -Werror=format-security -fstack-protector --param=ssp-buffer-size=4")
|
||||||
elseif(BUILD_TYPE MATCHES Release)
|
elseif(BUILD_TYPE MATCHES Release)
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2")
|
if(NOT (DEFINED OLEVEL))
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 ")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2")
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(DEFINED OLEVEL )
|
||||||
|
if((OLEVEL GREATER -1) AND (OLEVEL LESS 4) )
|
||||||
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O${OLEVEL}")
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O${OLEVEL}")
|
||||||
|
else()
|
||||||
|
message(WARNING "Optimization level was set to a bad value, ignoring it. (Valid values are 0-3)")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
if(GCOV)
|
if(GCOV)
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage")
|
||||||
|
1
README
1
README
@ -212,6 +212,7 @@ MYSQL_DIR=<path> Path to MySQL headers
|
|||||||
ERRMSG=<path> Path to errmsg.sys file
|
ERRMSG=<path> Path to errmsg.sys file
|
||||||
STATIC_EMBEDDED=[Y|N] Link the static or the dynamic verson of the library
|
STATIC_EMBEDDED=[Y|N] Link the static or the dynamic verson of the library
|
||||||
GCOV=[Y|N] Generate gcov output
|
GCOV=[Y|N] Generate gcov output
|
||||||
|
OLEVEL=<0-3> Level of optimization
|
||||||
BUILD_TESTS=[Y|N] Build tests
|
BUILD_TESTS=[Y|N] Build tests
|
||||||
DEPS_OK=[Y|N] Check dependencies, use N when you want to force a recheck of values
|
DEPS_OK=[Y|N] Check dependencies, use N when you want to force a recheck of values
|
||||||
DEBUG_OUTPUT=[Y|N] Produce debugging output when configuring CMake
|
DEBUG_OUTPUT=[Y|N] Produce debugging output when configuring CMake
|
||||||
|
Reference in New Issue
Block a user