-
Notifications
You must be signed in to change notification settings - Fork 5
/
CMakeLists.txt
125 lines (92 loc) · 4.54 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
# Date: 2013-01-25
# Author: Karsten Ahnert ([email protected])
project ( gpcxx )
cmake_minimum_required ( VERSION 2.8 )
set ( THIRDPARTY_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/third_party" )
option ( GPCXX_BUILD_DOCS "Enable to build the docs" ON )
option ( GPCXX_BUILD_PERFORMANCE_TESTS "Enable to build the performance tests" ON )
option ( GPCXX_BUILD_EXAMPLES "Enable to build the examples" ON )
option ( GPCXX_BUILD_TESTS "Enable to build the tests" ON )
option ( GPCXX_TEST_COVERAGE "Analyze test coverage with gcov/lcov" OFF )
option ( GPCXX_DOC_GITHUB_LINKS "Use links to github" ON )
option ( GPCXX_CHECK_HEADER_COMPILE "Check if headers compile standalone" OFF )
# Add path for custom modules
set ( CMAKE_MODULE_PATH
${CMAKE_MODULE_PATH}
${CMAKE_CURRENT_SOURCE_DIR}/cmake
${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules
)
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y -Wall -Wpedantic -pedantic -Werror" )
if ( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++" )
endif ()
# elseif (CMAKE_COMPILER_IS_GNUCXX )
# endif ()
if ( ${GPCXX_TEST_COVERAGE} )
message ( STATUS "Build with test coverage support." )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage" )
endif ()
include ( CreateVersionFile )
include ( ForwardingHeader )
include ( CheckHeaders )
message ( STATUS "Building project ${CMAKE_PROJECT_NAME}" )
message ( STATUS "Version ${GPCXX_VERSION_SHORT}" )
find_package ( Boost REQUIRED COMPONENTS thread system program_options )
include_directories ( SYSTEM ${Boost_INCLUDE_DIRS} )
include_directories ( ${CMAKE_CURRENT_SOURCE_DIR}/include )
create_forwarding_header ( include/gpcxx/app.hpp include/gpcxx/app )
create_forwarding_header ( include/gpcxx/benchmark_problems.hpp include/gpcxx/app/benchmark_problems )
create_forwarding_header ( include/gpcxx/primitive_sets.hpp include/gpcxx/app/primitive_sets )
create_forwarding_header ( include/gpcxx/eval.hpp include/gpcxx/eval )
create_forwarding_header ( include/gpcxx/evolve.hpp include/gpcxx/evolve )
create_forwarding_header ( include/gpcxx/generate.hpp include/gpcxx/generate )
create_forwarding_header ( include/gpcxx/io.hpp include/gpcxx/io )
create_forwarding_header ( include/gpcxx/operator.hpp include/gpcxx/operator )
create_forwarding_header ( include/gpcxx/stat.hpp include/gpcxx/stat )
create_forwarding_header ( include/gpcxx/tree.hpp include/gpcxx/tree include/gpcxx/tree/iterator )
create_forwarding_header ( include/gpcxx/intrusive_nodes.hpp include/gpcxx/tree/intrusive_nodes )
create_forwarding_header ( include/gpcxx/util.hpp include/gpcxx/util )
create_forwarding_header ( include/gpcxx/gpcxx.hpp include/gpcxx )
create_forwarding_header ( include/gpcxx/canonic.hpp include/gpcxx/canonic )
if ( ${GPCXX_CHECK_HEADER_COMPILE} )
check_if_headers_compile ( include/gpcxx/app )
check_if_headers_compile ( include/gpcxx/eval )
check_if_headers_compile ( include/gpcxx/evolve )
check_if_headers_compile ( include/gpcxx/generate )
check_if_headers_compile ( include/gpcxx/io )
check_if_headers_compile ( include/gpcxx/operator )
check_if_headers_compile ( include/gpcxx/stat )
check_if_headers_compile ( include/gpcxx/tree )
check_if_headers_compile ( include/gpcxx/util )
check_if_headers_compile ( include/gpcxx/canonic )
endif ()
if ( ${GPCXX_BUILD_EXAMPLES} )
add_subdirectory ( examples )
endif ()
if ( ${GPCXX_BUILD_PERFORMANCE_TESTS} )
add_subdirectory ( performance )
endif ()
if ( ${GPCXX_BUILD_DOCS} )
add_subdirectory ( doc )
endif ()
if ( ${GPCXX_BUILD_TESTS} )
set( GMOCK_ROOT "${THIRDPARTY_ROOT}/gmock" )
set( GTEST_ROOT "${THIRDPARTY_ROOT}/gmock/gtest" )
if ( IS_DIRECTORY ${GMOCK_ROOT} AND IS_DIRECTORY ${GTEST_ROOT} )
include_directories ( SYSTEM ${GTEST_ROOT} ${GTEST_ROOT}/include ${GMOCK_ROOT} ${GMOCK_ROOT}/include )
add_library ( gtest ${GTEST_ROOT}/src/gtest-all.cc )
target_link_libraries ( gtest pthread )
add_library ( gtest_main ${GTEST_ROOT}/src/gtest_main.cc )
add_library ( gmock ${GMOCK_ROOT}/src/gmock-all.cc )
enable_testing ( true )
add_subdirectory ( test )
else ()
if ( NOT IS_DIRECTORY ${GMOCK_ROOT} )
message ( STATUS "Google C++ Mockin Framework not found in \"${GMOCK_ROOT}\" tests will be disabled !" )
endif ()
if ( NOT IS_DIRECTORY ${GTEST_ROOT} )
message ( STATUS "Google C++ Testing Framework not found in \"${GTEST_ROOT}\" tests will be disabled !" )
endif ()
message ( STATUS "get googlemock: svn checkout http://googlemock.googlecode.com/svn/tags/release-1.7.0/ \"${THIRDPARTY_ROOT}/gmock\"" )
endif ()
endif ()