blob: 2f3a2e30aa37b031c612b33ac576bfdcf1f54387 (
plain)
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
31
32
|
# Set default build flags
IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
SET(CMAKE_BUILD_TYPE "Release")
ENDIF()
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -g")
SET(CMAKE_C_FLAGS_DEBUG "-O0")
SET(CMAKE_C_FLAGS_RELEASE "-O2")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--as-needed")
SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--as-needed")
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--as-needed")
MESSAGE(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
MESSAGE(STATUS "Compile flags: ${CMAKE_C_FLAGS}")
MESSAGE(STATUS "Exe linker flags: ${CMAKE_EXE_LINKER_FLAGS}")
MESSAGE(STATUS "Module linker flags: ${CMAKE_MODULE_LINKER_FLAGS}")
MESSAGE(STATUS "Shared linker flags: ${CMAKE_SHARED_LINKER_FLAGS}")
IF("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
ADD_DEFINITIONS("-DDEBUG")
ENDIF()
MACRO(get_version _file _ver _ver_maj)
FILE(STRINGS ${_file} __log LIMIT_COUNT 1 REGEX "(.*)")
STRING(REGEX REPLACE ".*\\(\([0-9]+:\)*\([0-9a-zA-Z.]*\).*\\).*" "\\2" __ver ${__log})
STRING(REGEX REPLACE "^\([0-9]+\)\\..*" "\\1" __ver_maj ${__ver})
SET(${_ver} ${__ver})
SET(${_ver_maj} ${__ver_maj})
ENDMACRO(get_version)
|