-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathCMakeLists.txt
90 lines (80 loc) · 2.71 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
# TODO: Decide on the version.
cmake_minimum_required(VERSION 3.7)
# Create the project.
project(tree_similarity)
# Copied from https://stackoverflow.com/questions/14933172/how-can-i-add-a-minimum-compiler-version-requisite/14934542#14934542
# Use "export CXX=clang++-3.9" to point cmake to use clang.
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
# require at least gcc 7.0
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0)
message(FATAL_ERROR "GCC version must be at least 7.0!")
endif()
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
# require at least clang 3.9
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.9)
message(FATAL_ERROR "Clang version must be at least 3.9!")
endif()
elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC")
# require at least MSVC 17.0
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 17.0)
message(FATAL_ERROR "MSVC version must be at least 17.0! (Lower versions haven't been tested)")
endif()
else()
message(WARNING "You are using an unsupported compiler! Compilation has only been tested with Clang and GCC.")
endif()
# TODO: Make it compile under Windows without Visual Studio.
# Document the steps.
# Compiler flags.
# MUST be declared after project().
# TODO: Explain the flags.
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1z -Wall -Wextra -Wpedantic")
#Define CXX standard
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
#Add flags applicable to all compilers
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
#Add compiler specific flags
if(CMAKE_COMPILER_IS_GNUCXX)
message(STATUS "GCC detected, adding compile flags")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra -Wpedantic")
endif(CMAKE_COMPILER_IS_GNUCXX)
# It's possible to set compiler-specific flags.
#if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1z -Wall")
#endif()
# Create header-only library 'TreeSimilarity'.
#
# One can also use include_directories() to add all header files which would be
# added to executables created in CMakeLists files in subdirectories.
add_library(TreeSimilarity INTERFACE)
target_include_directories(TreeSimilarity INTERFACE
src/node
src/label
src/cost_model
src/ted
src/data_structures
src/parser
src/lookup
src/lookup/scan
src/lookup/index
src/join
src/join/naive
src/join/tjoin
src/join/tang
src/join/degree_histogram
src/join/leaf_dist_histogram
src/join/label_histogram
src/join/binary_branches
src/join/histogram
src/join/guha
src/tree_generator
src/ted_ub
src/ted_lb
src/json
)
# For using add_test().
include(CTest)
# Let CMake know about subdirectories.
add_subdirectory(src/)
add_subdirectory(test/)