forked from buffetboy2001/cppmanifest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
executable file
·28 lines (25 loc) · 1.19 KB
/
CMakeLists.txt
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
# Project setup
cmake_minimum_required(VERSION 3.0)
project(cppmanifest)
enable_language(CXX)
# report version based on include/version.h
include (.cmake/VersionUtils.cmake)
get_version ("${PROJECT_SOURCE_DIR}/include"
cppmanifest_version_major cppmanifest_version_minor cppmanifest_version_patch cppmanifest_version_suffix)
string(LENGTH ${cppmanifest_version_suffix} cppmanifest_version_suffix_length)
if(cppmanifest_version_suffix_length EQUAL 1)
# ignore this suffix
set(VERSION ${cppmanifest_version_major}.${cppmanifest_version_minor}.${cppmanifest_version_patch})
else()
# use the suffix
set(VERSION ${cppmanifest_version_major}.${cppmanifest_version_minor}.${cppmanifest_version_patch}-${cppmanifest_version_suffix})
endif()
message("-- Generating build for cppmanifest version ${VERSION}")
# Write the build_info
set(USERNAME $ENV{USERNAME})
set(HOSTNAME $ENV{HOSTNAME})
string(TIMESTAMP BUILDDATETIME %Y/%m/%d-%H:%M:%S) # example: 20160101.010101
configure_file(${PROJECT_SOURCE_DIR}/include/build_info.h.template ${PROJECT_SOURCE_DIR}/include/build_info.h)
# build test application
include_directories(${PROJECT_SOURCE_DIR})
add_executable(cpptestapp src/main.cpp)