Add rule for release builds
This commit is contained in:
parent
34582543f6
commit
e1f7ef88cd
@ -2,10 +2,6 @@ cmake_minimum_required(VERSION 3.1)
|
|||||||
|
|
||||||
project(nheko CXX)
|
project(nheko CXX)
|
||||||
|
|
||||||
set(nheko_VERSION_MAJOR 0)
|
|
||||||
set(nheko_VERSION_MINOR 1)
|
|
||||||
set(nheko_VERSION_PATCH 0)
|
|
||||||
|
|
||||||
find_package(Qt5Widgets REQUIRED)
|
find_package(Qt5Widgets REQUIRED)
|
||||||
find_package(Qt5Network REQUIRED)
|
find_package(Qt5Network REQUIRED)
|
||||||
|
|
||||||
@ -16,6 +12,41 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|||||||
|
|
||||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||||
|
|
||||||
|
IF(NOT CMAKE_BUILD_TYPE)
|
||||||
|
SET(CMAKE_BUILD_TYPE "Debug" CACHE STRING
|
||||||
|
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
|
||||||
|
FORCE)
|
||||||
|
MESSAGE("Setting build type to '${CMAKE_BUILD_TYPE}'")
|
||||||
|
ELSE(NOT CMAKE_BUILD_TYPE)
|
||||||
|
MESSAGE("Build type set to '${CMAKE_BUILD_TYPE}'")
|
||||||
|
ENDIF(NOT CMAKE_BUILD_TYPE)
|
||||||
|
|
||||||
|
IF("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
|
||||||
|
SET(PATCH_OUT "0")
|
||||||
|
ELSE("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
|
||||||
|
FIND_PROGRAM(GIT git)
|
||||||
|
IF(GIT)
|
||||||
|
EXECUTE_PROCESS(
|
||||||
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||||
|
COMMAND ${GIT} rev-parse --short HEAD
|
||||||
|
OUTPUT_VARIABLE GIT_OUT OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
|
)
|
||||||
|
SET(PATCH_OUT "0-git${GIT_OUT}")
|
||||||
|
ELSE(GIT)
|
||||||
|
SET(PATCH_OUT "0")
|
||||||
|
ENDIF(GIT)
|
||||||
|
ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
|
||||||
|
|
||||||
|
SET(PROJECT_VERSION_PATCH ${PATCH_OUT})
|
||||||
|
SET(CPACK_PACKAGE_VERSION_MAJOR "0")
|
||||||
|
SET(CPACK_PACKAGE_VERSION_MINOR "1")
|
||||||
|
SET(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
|
||||||
|
SET(CPACK_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH})
|
||||||
|
SET(PROJECT_VERSION_MAJOR ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR})
|
||||||
|
SET(PROJECT_VERSION ${CPACK_PACKAGE_VERSION})
|
||||||
|
|
||||||
|
MESSAGE(STATUS "Version: ${PROJECT_VERSION}")
|
||||||
|
|
||||||
set(CMAKE_CXX_FLAGS
|
set(CMAKE_CXX_FLAGS
|
||||||
"${CMAKE_CXX_FLAGS} \
|
"${CMAKE_CXX_FLAGS} \
|
||||||
-std=gnu++11 \
|
-std=gnu++11 \
|
||||||
|
Loading…
Reference in New Issue
Block a user