-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
31 lines (26 loc) · 1.17 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
29
30
31
cmake_minimum_required(VERSION 2.6)
# Set the project name.
project(ANIMALS)
# Fetch info from version.h.
configure_file(
${CMAKE_SOURCE_DIR}/version.h
${CMAKE_BINARY_DIR}/version.h.cmake
COPYONLY
)
file(STRINGS ${CMAKE_BINARY_DIR}/version.h.cmake _VERSION_MAJOR REGEX "VERSION_MAJOR")
file(STRINGS ${CMAKE_BINARY_DIR}/version.h.cmake _VERSION_MINOR REGEX "VERSION_MINOR")
file(STRINGS ${CMAKE_BINARY_DIR}/version.h.cmake _VERSION_PATCH REGEX "VERSION_PATCH")
file(STRINGS ${CMAKE_BINARY_DIR}/version.h.cmake _VERSION_BUILD REGEX "VERSION_BUILD")
string(REGEX MATCH "[1-9][0-9]*" VERSION_MAJOR ${_VERSION_MAJOR})
string(REGEX MATCH "[0-9][0-9]*" VERSION_MINOR ${_VERSION_MINOR})
string(REGEX MATCH "[0-9][0-9]*" VERSION_PATCH ${_VERSION_PATCH})
string(REGEX MATCH "[1-9][0-9]*" VERSION_BUILD ${_VERSION_BUILD})
set(VERSION_MAJOR_MINOR "${VERSION_MAJOR}.${VERSION_MINOR}")
set(VERSION_MAJOR_MINOR_PATCH_BUILD "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}.${VERSION_BUILD}")
# Set compiler flags.
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
# Add subdirectories.
add_subdirectory(animals)
add_subdirectory(testapp)
# pkg subdirectory must come last.
add_subdirectory(pkg)