-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
71 lines (67 loc) · 2.05 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
cmake_minimum_required (VERSION 2.8)
# 项目信息
project (MFormator)
set (Demo_VERSION_MAJOR 1)
set (Demo_VERSION_MINOR 0)
set (CMAKE_INCLUDE_CURRENT_DIR ON)
ADD_EXECUTABLE(MFormator MFormator.cpp)
# # 检查系统是否支持 pow 函数
# include (${CMAKE_ROOT}/Modules/CheckFunctionExists.cmake)
# check_function_exists (pow HAVE_POW)
#
# # 加入一个配置头文件,用于处理 CMake 对源码的设置
# configure_file (
# "${PROJECT_SOURCE_DIR}/config.h.in"
# "${PROJECT_BINARY_DIR}/config.h"
# )
#
# # 是否加入 MathFunctions 库
# if (NOT HAVE_POW)
# include_directories ("${PROJECT_SOURCE_DIR}/math")
# add_subdirectory (math)
# set (EXTRA_LIBS ${EXTRA_LIBS} MathFunctions)
# endif (NOT HAVE_POW)
#
# # 查找当前目录下的所有源文件
# # 并将名称保存到 DIR_SRCS 变量
# aux_source_directory(. DIR_SRCS)
#
# # 指定生成目标
# add_executable(Demo ${DIR_SRCS})
# target_link_libraries (Demo ${EXTRA_LIBS})
#
# # 指定安装路径
# install (TARGETS Demo DESTINATION bin)
# install (FILES "${PROJECT_BINARY_DIR}/config.h"
# DESTINATION include)
#
# # 启用测试
# enable_testing()
#
# # 测试程序是否成功运行
# add_test (test_run Demo 5 2)
#
# # 测试帮助信息是否可以正常提示
# add_test (test_usage Demo)
# set_tests_properties (test_usage
# PROPERTIES PASS_REGULAR_EXPRESSION "Usage: .* base exponent")
#
# # 定义一个宏,用来简化测试工作
# macro (do_test arg1 arg2 result)
# add_test (test_${arg1}_${arg2} Demo ${arg1} ${arg2})
# set_tests_properties (test_${arg1}_${arg2}
# PROPERTIES PASS_REGULAR_EXPRESSION ${result})
# endmacro (do_test)
#
# # 利用 do_test 宏,测试一系列数据
# do_test (5 2 "is 25")
# do_test (10 5 "is 100000")
# do_test (2 10 "is 1024")
#
# # 构建一个 CPack 安装包
# include (InstallRequiredSystemLibraries)
# set (CPACK_RESOURCE_FILE_LICENSE
# "${CMAKE_CURRENT_SOURCE_DIR}/License.txt")
# set (CPACK_PACKAGE_VERSION_MAJOR "${Demo_VERSION_MAJOR}")
# set (CPACK_PACKAGE_VERSION_MINOR "${Demo_VERSION_MINOR}")
# include (CPack)