-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
97 lines (81 loc) · 2.33 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
PROJECT(cpptl)
CMAKE_MINIMUM_REQUIRED (VERSION 2.6)
FIND_PACKAGE(Boost COMPONENTS filesystem REQUIRED)
FIND_PACKAGE(Boost COMPONENTS system REQUIRED)
FIND_PACKAGE(Boost COMPONENTS unit_test_framework REQUIRED )
IF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
SET(CMAKE_CXX_FLAGS "-std=c++11 -stdlib=libc++")
ENDIF()
INCLUDE(cmake/CheckCXX11Features.cmake)
IF(MSVC)
SET( CMAKE_CXX_FLAGS "-W3 -DWIN32 -EHsc -DBOOST_ALL_NO_LIB")
ELSEIF(CMAKE_COMPILER_IS_GNUCXX)
IF(HAS_CXX11_LAMBDA)
SET(CMAKE_CXX_FLAGS "-Wextra -Wall -std=c++0x")
ELSE(HAS_CXX11_LAMBDA)
SET(CMAKE_CXX_FLAGS "-Wextra -Wall")
ENDIF(HAS_CXX11_LAMBDA)
ELSEIF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
SET(CMAKE_CXX_FLAGS "-Wextra -Wall -std=c++11 -stdlib=libc++")
ELSE(MSVC)
SET( CMAKE_CXX_FLAGS "-Wextra -Wall")
ENDIF(MSVC)
SET (HEADERS
value.h
templateasttree.h
template.h
templateengine.h
templatecontext.h
buildinhelpers.h
parser.h
scanner.h
)
SET (SOURCES
templateasttree.cpp
template.cpp
templateengine.cpp
buildinhelpers.cpp
value.cpp
scanner.c
parser.c
)
ADD_CUSTOM_COMMAND(
SOURCE scanner.l
COMMAND flex
ARGS -d ${CMAKE_CURRENT_SOURCE_DIR}/scanner.l
TARGET hts-test
OUTPUTS scanner.h scanner.c)
ADD_CUSTOM_COMMAND(
SOURCE parser.y
COMMAND bison
ARGS --debug --verbose ${CMAKE_CURRENT_SOURCE_DIR}/parser.y -o ${CMAKE_CURRENT_BINARY_DIR}/parser.c
TARGET hts-test
DEPENDS scanner.c scanner.h
OUTPUTS parser.c parser.h)
INCLUDE_DIRECTORIES(
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
)
IF(HAS_CXX11_RAW_STRING)
ADD_EXECUTABLE(cpptl-test template_test.cpp ${SOURCES} ${HEADERS})
TARGET_LINK_LIBRARIES(cpptl-test
${Boost_SYSTEM_LIBRARY}
${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}
)
ENDIF(HAS_CXX11_RAW_STRING)
ADD_EXECUTABLE(value-test value_test.cpp value.cpp value.h)
TARGET_LINK_LIBRARIES(value-test
${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}
)
ADD_LIBRARY(cpptl ${SOURCES} ${HEADERS})
TARGET_LINK_LIBRARIES(cpptl
${Boost_FILESYSTEM_LIBRARY}
${Boost_SYSTEM_LIBRARY}
)
INSTALL(TARGETS cpptl DESTINATION lib)
INSTALL(FILES value.h template.h templateengine.h DESTINATION include/cpptl)
ENABLE_TESTING()
ADD_TEST(value value-test)
IF(HAS_CXX11_RAW_STRING)
ADD_TEST(cpptl cpptl-test)
ENDIF(HAS_CXX11_RAW_STRING)