-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
89 lines (69 loc) · 2.32 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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
project(Hypodermic)
cmake_minimum_required(VERSION 2.6)
set(HYPODERMIC_VERSION_MAJOR "0")
set(HYPODERMIC_VERSION_MINOR "1")
set(HYPODERMIC_VERSION_PATCH "4")
set(HYPODERMIC_VERSION
"${HYPODERMIC_VERSION_MAJOR}.${HYPODERMIC_VERSION_MINOR}.${HYPODERMIC_VERSION_PATCH}"
)
enable_testing()
# enable gcc specific stuff
if(CMAKE_COMPILER_IS_GNUCXX)
if (NOT CXX0x_ENABLED)
message(STATUS "Checking for g++ version >= 4.5")
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
if (GCC_VERSION VERSION_LESS 4.5)
message(FATAL_ERROR "g++ version is ${GCC_VERSION}")
endif()
include(CheckCXXCompilerFlag)
check_cxx_compiler_flag(-std=c++0x FLAG_CXX0x)
if(FLAG_CXX0x)
message(STATUS "C++0x features enabled")
set(CXX0x_ENABLED ON CACHE INTERNAL "C++0x features enabled")
else(FLAG_CXX0x)
message(FATAL_ERROR "g++ does not support the -std=c++0x flag")
endif(FLAG_CXX0x)
endif()
set(COMPILER_FLAGS "-std=c++0x")
set(WARNING_FLAGS "-W -Wall")
if (CMAKE_BUILD_TYPE STREQUAL "debug")
message(STATUS "Enabling debugging symbols")
set(COMPILER_FLAGS "${COMPILER_FLAGS} -g")
else()
set(COMPILER_FLAGS "${COMPILER_FLAGS} -O2")
endif()
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMPILER_FLAGS} ${WARNING_FLAGS}")
add_subdirectory(Hypodermic)
add_subdirectory(Hypodermic.Tests)
# uninstall target
##################
#
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY
)
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
)
# Packaging stuff
#################
#
set(CPACK_PACKAGE_VERSION_MAJOR "${HYPODERMIC_VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${HYPODERMIC_VERSION_MINOR}")
set(CPACK_PACKAGE_VERSION_PATCH "${HYPODERMIC_VERSION_PATCH}")
set(CPACK_SOURCE_PACKAGE_FILE_NAME
"${CMAKE_PROJECT_NAME}-${HYPODERMIC_VERSION}"
)
set(CPACK_SOURCE_GENERATOR "TBZ2")
set(CPACK_SOURCE_IGNORE_FILES
"/.hg/"
"/.hgignore$"
"build/"
"ipch/"
"/resources/"
".sdf$;.suo$;.tss$"
)
include(CPack)
add_custom_target(dist COMMAND ${CMAKE_MAKE_PROGRAM} package_source)