forked from theochem/cellcutoff
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
94 lines (82 loc) · 3.81 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
# -*- coding: utf-8 -*-
# CellCutoff is a library for periodic boundary conditions and real-space cutoff calculations.
# Copyright (C) 2017 The CellCutoff Development Team
#
# This file is part of CellCutoff.
#
# CellCutoff is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# CellCutoff is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>
#
# --
cmake_minimum_required(VERSION 3.1)
project(CellCutoff CXX)
# Version information
set(CELLCUTOFF_MAJOR 0)
set(CELLCUTOFF_MINOR 0)
set(CELLCUTOFF_PATCH 0)
set(CELLCUTOFF_VERSION ${CELLCUTOFF_MAJOR}.${CELLCUTOFF_MINOR}.${CELLCUTOFF_PATCH})
set(CELLCUTOFF_SOVERSION ${CELLCUTOFF_MAJOR}.${CELLCUTOFF_MINOR})
set(PROJECT_BRIEF "Library for periodic boundary conditions and real-space cutoff calculations")
# The googletest snippets were taken from:
# http://crascit.com/2015/07/25/cmake-gtest/
# and modified to work with googletest-1.8.0 instead of the latest git revision.
# Download and unpack googletest at configure time
configure_file(CMakeListsGTest.txt.in
googletest-download/CMakeLists.txt)
execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/googletest-download)
execute_process(COMMAND ${CMAKE_COMMAND} --build .
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/googletest-download)
# Add googletest directly to our build. This adds the following targets: gtest,
# gtest_main, gmock and gmock_main
add_subdirectory(${CMAKE_BINARY_DIR}/googletest-src
${CMAKE_BINARY_DIR}/googletest-build
EXCLUDE_FROM_ALL )
# NOTE: A change request has been submitted to the GoogleTest
# project to remove the need for the following lines.
# They add the gtest and gmock include directories as
# target dependencies, since they are not added by
# googletest (yet).
target_include_directories(gtest INTERFACE
"${CMAKE_BINARY_DIR}/googletest-src/include")
target_include_directories(gtest_main INTERFACE
"${CMAKE_BINARY_DIR}/googletest-src/include")
# # Only switch this one when done with googletest.
# set(CMAKE_VERBOSE_MAKEFILE "ON")
# General compiler flags
set(CMAKE_CXX_FLAGS "-std=c++11 -Wall -Wconversion -Wextra")
# Additional compiler settings when doing a debug build
string(TOUPPER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE)
if(CMAKE_BUILD_TYPE STREQUAL "DEBUG")
# These settings are only useful in dev mode.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -pedantic")
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
# When coding (debug mode), we want to know when there might be trouble ...
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 -coverage")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_CXX_FLAGS} -coverage")
set(CELLCUTOFF_DO_COVERAGE "ON")
# Google test uses comparisons between signed and unsigned ...
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-sign-compare")
endif()
endif()
# Compilation of cellcutoff according to cellcutoff/CMakeLists.txt
add_subdirectory(cellcutoff)
# Documentation with doxygen
find_package(Doxygen)
if(DOXYGEN_FOUND)
configure_file(${PROJECT_SOURCE_DIR}/doxygen.conf.in ${PROJECT_BINARY_DIR}/doxygen.conf @ONLY)
add_custom_target(doc ${DOXYGEN_EXECUTABLE} ${PROJECT_BINARY_DIR}/doxygen.conf
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
COMMENT "Generating API documentation with Doxygen" VERBATIM
)
endif(DOXYGEN_FOUND)