1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
cmake_minimum_required(VERSION 2.8.12)
project(bustools)
SET(CMAKE_CXX_FLAGS "-std=c++11 -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2")
SET(CMAKE_C_FLAGS "-std=c99 -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2")
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
endif()
if(CMAKE_BUILD_TYPE MATCHES Debug)
message("debug mode")
add_compile_options(-g)
add_compile_options(-flto)
set(CMAKE_SHARED_LINKER_FLAGS "-flto")
set(CMAKE_EXE_LINKER_FLAGS "-flto")
else(CMAKE_BUILD_TYPE MATCHES Debug)
if(CMAKE_BUILD_TYPE MATCHES Profile)
message("profile mode")
add_compile_options(-pg)
set(CMAKE_SHARED_LINKER_FLAGS "-pg")
set(CMAKE_EXE_LINKER_FLAGS "-pg")
else(CMAKE_BUILD_TYPE MATCHES Profile)
message("release mode")
add_compile_options(-O3)
endif(CMAKE_BUILD_TYPE MATCHES Profile)
endif(CMAKE_BUILD_TYPE MATCHES Debug)
add_subdirectory(src)
|