Add rule for release builds

remotes/origin/HEAD
Konstantinos Sideris 8 years ago
parent 34582543f6
commit e1f7ef88cd
  1. 39
      CMakeLists.txt
  2. 4
      Makefile

@ -2,10 +2,6 @@ cmake_minimum_required(VERSION 3.1)
project(nheko CXX)
set(nheko_VERSION_MAJOR 0)
set(nheko_VERSION_MINOR 1)
set(nheko_VERSION_PATCH 0)
find_package(Qt5Widgets REQUIRED)
find_package(Qt5Network REQUIRED)
@ -16,6 +12,41 @@ set(CMAKE_CXX_STANDARD_REQUIRED 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
"${CMAKE_CXX_FLAGS} \
-std=gnu++11 \

@ -5,6 +5,10 @@ build:
@cmake -H. -Bbuild
@make -C build
release:
@cmake -H. -Bbuild -DCMAKE_BUILD_TYPE=Release
@make -C build
clean:
rm -rf build

Loading…
Cancel
Save