-
Notifications
You must be signed in to change notification settings - Fork 12
/
CMakeLists.txt
131 lines (107 loc) · 3.74 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# -*- cmake -*- -----------------------------------------------------------
# @@COPYRIGHT@@
#*-------------------------------------------------------------------------
# @file
# @brief
CMAKE_MINIMUM_REQUIRED(VERSION 2.4 FATAL_ERROR)
PROJECT(CML)
# Build the current CML version number:
SET(CML_MAJOR 1)
SET(CML_MINOR 0)
SET(CML_PATCH 3)
SET(CML_RELEASE_VERSION "${CML_MAJOR}.${CML_MINOR}.${CML_PATCH}")
SET(CML_FILE_VERSION "${CML_MAJOR}_${CML_MINOR}_${CML_PATCH}")
# Handy message:
MESSAGE(STATUS "Building CML ${CML_RELEASE_VERSION}")
SET(CMAKE_MODULE_PATH ${CML_SOURCE_DIR}/CMake)
# XXX Importing build settings for a header-only library leads to annoying
# "Setting CML_BUILD_TYPE to T" warnings:
# Installation configuration:
#INCLUDE(CMakeExportBuildSettings)
IF(WIN32)
# The paths relative to the installation path into which libraries and
# headers should be installed for Windows builds (there are currently no
# libraries to install):
SET(CML_LIBARARY_PATH)
SET(CML_HEADER_PATH)
ELSE(WIN32)
# The paths relative to the installation path into which libraries and
# headers should be installed for UNIX-like builds (there are currently
# no libraries to install):
SET(CML_LIBARARY_PATH lib)
SET(CML_HEADER_PATH include)
ENDIF(WIN32)
# Build examples by default:
OPTION(BUILD_EXAMPLES "Build CML examples." ON)
SET(CML_BUILD_EXAMPLES ${BUILD_EXAMPLES})
# Don't build tests by default:
OPTION(BUILD_TESTS "Build CML tests." OFF)
SET(CML_BUILD_TESTS ${BUILD_TESTS})
# Include the source CML headers before others:
INCLUDE_DIRECTORIES(BEFORE ${CML_SOURCE_DIR} ${CML_BINARY_DIR})
# Add subdirectories to build:
ADD_SUBDIRECTORY(cml)
IF(CML_BUILD_EXAMPLES)
ADD_SUBDIRECTORY(examples)
ENDIF(CML_BUILD_EXAMPLES)
IF(CML_BUILD_TESTS)
ADD_SUBDIRECTORY(tests)
ENDIF(CML_BUILD_TESTS)
# Setup configuration files:
CONFIGURE_FILE(
${CML_SOURCE_DIR}/UseCML.cmake.in
${CML_BINARY_DIR}/UseCML.cmake
@ONLY
)
CONFIGURE_FILE(
${CML_SOURCE_DIR}/CMLConfig.cmake.in
${CML_BINARY_DIR}/CMLConfig.cmake
@ONLY
)
# XXX Importing build settings for a header-only library leads to annoying
# "Setting CML_BUILD_TYPE to T" warnings:
# CMAKE_EXPORT_BUILD_SETTINGS(
# ${CML_BINARY_DIR}/CMLBuildSettings.cmake)
# INSTALL(FILES
# ${CML_BINARY_DIR}/CMLBuildSettings.cmake
# DESTINATION .
# )
INSTALL(FILES
${CML_BINARY_DIR}/UseCML.cmake
${CML_BINARY_DIR}/CMLConfig.cmake
DESTINATION .
)
INSTALL(FILES
${CML_SOURCE_DIR}/doc/parameters.txt
DESTINATION doc
)
INSTALL(FILES
${CML_SOURCE_DIR}/examples/simple.cpp
${CML_SOURCE_DIR}/examples/cml_config.h
${CML_SOURCE_DIR}/examples/makefile
${CML_SOURCE_DIR}/examples/CMakeLists.txt
DESTINATION examples
)
# Setup CPack:
IF(WIN32 AND NOT UNIX)
# Build ZIP and NSIS packages:
SET(CPACK_GENERATOR "NSIS;ZIP")
# Set the name used by NSIS to refer to the project:
SET(CPACK_NSIS_DISPLAY_NAME "CML ${CML_RELEASE_VERSION}")
SET(CPACK_PACKAGE_VERSION_MAJOR ${CML_MAJOR})
SET(CPACK_PACKAGE_VERSION_MINOR ${CML_MINOR})
SET(CPACK_PACKAGE_VERSION_PATCH ${CML_PATCH})
SET(CPACK_PACKAGE_FILE_NAME "cml-${CML_FILE_VERSION}")
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Configurable Math Libary")
SET(CPACK_PACKAGE_VENDOR "Jesse Krebs, Demian Nave")
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "cml-${CML_FILE_VERSION}")
#SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CML_SOURCE_DIR}/About.txt")
#SET(CPACK_PACKAGE_ICON "${CML_SOURCE_DIR}/<icon>")
#SET(CPACK_PACKAGE_EXECUTABLES "" "")
#SET(CPACK_RESOURCE_FILE_WELCOME "${CML_SOURCE_DIR}/Welcome.txt")
SET(CPACK_RESOURCE_FILE_LICENSE "${CML_SOURCE_DIR}/LICENSE.rtf")
#SET(CPACK_RESOURCE_FILE_README "${CML_SOURCE_DIR}/README.txt")
INCLUDE(CPack)
ENDIF(WIN32 AND NOT UNIX)
# --------------------------------------------------------------------------
# vim:ft=cmake