-
Notifications
You must be signed in to change notification settings - Fork 10
/
CMakeLists.txt
54 lines (41 loc) · 1.45 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
CMAKE_MINIMUM_REQUIRED (VERSION 2.8.8)
PROJECT (dwgrep C CXX)
CMAKE_POLICY(SET CMP0075 NEW)
INCLUDE (${CMAKE_SOURCE_DIR}/VERSION.cmake)
SET (VERSION ${DWGREP_MAJOR}.${DWGREP_MINOR})
CONFIGURE_FILE ("${CMAKE_CURRENT_SOURCE_DIR}/version.h.in"
"${CMAKE_CURRENT_BINARY_DIR}/version.h"
@ONLY)
INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/libzwerg)
INCLUDE_DIRECTORIES (${CMAKE_BINARY_DIR})
SET (CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)
INCLUDE (CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG ("-std=c++14" COMPILER_SUPPORTS_CXX14)
IF (COMPILER_SUPPORTS_CXX14)
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
ELSE ()
MESSAGE (FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++14 support.")
ENDIF ()
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wnon-virtual-dtor -O2 -g")
FIND_PACKAGE (DWARF REQUIRED)
FIND_PACKAGE (FLEX REQUIRED)
FIND_PACKAGE (BISON REQUIRED)
FIND_PACKAGE (GTest)
IF (GTEST_FOUND)
INCLUDE_DIRECTORIES (${GTEST_INCLUDE_DIRS})
ENDIF ()
FIND_PACKAGE (Sphinx)
IF (SPHINX_EXECUTABLE)
ADD_SUBDIRECTORY (doc)
ELSE ()
MESSAGE (STATUS "Sphinx not found, documentation will NOT be built.")
ENDIF ()
ENABLE_TESTING ()
SET (ARCHIVE_NAME ${CMAKE_PROJECT_NAME}-${VERSION})
ADD_CUSTOM_TARGET (dist
COMMAND git archive --prefix=${ARCHIVE_NAME}/ HEAD
| bzip2 > ${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}.tar.bz2
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
ADD_SUBDIRECTORY (libzwerg)
ADD_SUBDIRECTORY (dwgrep)
ADD_SUBDIRECTORY (tests)