-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
executable file
·148 lines (117 loc) · 5.32 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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# <Copyright Holder>. Copyright (C) <Copyright Year(s)>. <License>.
#
# Project Properties
#
CMAKE_MINIMUM_REQUIRED (VERSION 2.6.2)
PROJECT (cppbin)
SET (APPLICATION_NAME "cppbin")
SET (APPLICATION_CODENAME "${PROJECT_NAME}")
SET (APPLICATION_COPYRIGHT_YEARS "2015")
SET (APPLICATION_VERSION_MAJOR 1)
SET (APPLICATION_VERSION_MINOR 0)
SET (APPLICATION_VERSION_PATCH 0)
SET (APPLICATION_VERSION_TYPE SNAPSHOT)
SET (APPLICATION_VERSION_STRING "${APPLICATION_VERSION_MAJOR}.${APPLICATION_VERSION_MINOR}.${APPLICATION_VERSION_PATCH}-${APPLICATION_VERSION_TYPE}")
#
# Debugging Options
#
SET (CMAKE_VERBOSE_MAKEFILE 1) # Use 1 for debugging, 0 for release
#
# Project Output Paths
#
SET (MAINFOLDER ${PROJECT_SOURCE_DIR})
SET (EXECUTABLE_OUTPUT_PATH "${MAINFOLDER}/bin")
SET (LIBRARY_OUTPUT_PATH "${MAINFOLDER}/lib")
option(OPTIMIZE "build with optimization flags" ON)
option(SSE2 "build with sse2 support" ON)
option(DEBUG "build with debug stuff" OFF)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
if (SSE2)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse2")
endif()
if (DEBUG)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -Wall -Wextra -pedantic")
endif()
if (OPTIMIZE)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -fmerge-all-constants")
endif()
#############################################################################
# Project Search Paths
################################################################################
LIST (APPEND CMAKE_PREFIX_PATH "${MAINFOLDER}")
LIST (APPEND CMAKE_PREFIX_PATH "${MAINFOLDER}/tools")
LIST (APPEND CMAKE_PREFIX_PATH "${MAINFOLDER}/thirdparty")
SET (CMAKE_MODULE_PATH "${MAINFOLDER}/tools/share/cmake")
INCLUDE_DIRECTORIES("${MAINFOLDER}/include")
################################################################################
# Thirdparty libraries
################################################################################
# # xdrfile
# SET(xdrfile_LIBRARY_DIR "${MAINFOLDER}/thirdparty/xdrfile-1.1.4/src")
# SET(xdrfile_SRCS "${xdrfile_LIBRARY_DIR}/xdrfile.c" "${xdrfile_LIBRARY_DIR}/xdrfile_xtc.c" "${xdrfile_LIBRARY_DIR}/xdrfile_trr.c")
#
# ADD_LIBRARY(xdrfile ${xdrfile_SRCS})
#
# # Boost
SET(Boost_USE_MULTITHREADED ON)
find_package(Boost 1.36.0 REQUIRED COMPONENTS filesystem)
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
# SET(Boost_LIBRARY_DIR "${MAINFOLDER}/thirdparty/boost_1_59_0/libs")
# FILE(GLOB_RECURSE Boost_SYSTEM_SRCS "${Boost_LIBRARY_DIR}/system/src/*.cpp")
# FILE(GLOB_RECURSE Boost_FILESYSTEM_SRCS "${Boost_LIBRARY_DIR}/filesystem/src/*.cpp")
# FILE(GLOB_RECURSE Boost_PROGRAM_OPTIONS_SRCS "${Boost_LIBRARY_DIR}/program_options/src/*.cpp")
# FILE(GLOB_RECURSE Boost_TEST_SRCS "${Boost_LIBRARY_DIR}/test/src/*.cpp")
set(catch_DIR "${MAINFOLDER}/thirdparty/catch-1.5.9")
set(catch_HEADERS "${catch_DIR}/catch.hpp")
include_directories(SYSTEM ${catch_DIR})
#add_library (catch ${catch_HEADERS})
#find_package(catch 1.5.9 REQUIRED COMPONENTS filesystem)
#ADD_LIBRARY(boost_system ${Boost_SYSTEM_SRCS})
# ADD_LIBRARY(boost_filesystem ${Boost_FILESYSTEM_SRCS})
# TARGET_LINK_LIBRARIES(boost_filesystem boost_system)
#
# ADD_LIBRARY(boost_program_options ${Boost_PROGRAM_OPTIONS_SRCS})
#
# ADD_LIBRARY(boost_test ${Boost_TEST_SRCS})
#
# SET(Boost_LIBRARIES boost_filesystem boost_program_options boost_system)
#
# # collect libraries
#
SET(thirdparty_LIBRARIES ${Boost_LIBRARIES})
SET(thirdparty_TEST_LIBRARIES ${thirdparty_LIBRARIES})
################################################################################
# Configure Files
################################################################################
FILE (GLOB_RECURSE CONFIGINPUTS1 include/*.in.h.cmake)
FILE (GLOB_RECURSE CONFIGINPUTS2 include/*.h.in.cmake)
FILE (GLOB_RECURSE CONFIGINPUTS3 src/*.in.h.cmake)
FILE (GLOB_RECURSE CONFIGINPUTS4 src/*.h.in.cmake)
FILE (GLOB_RECURSE CONFIGINPUTS5 test/*.in.h.cmake)
FILE (GLOB_RECURSE CONFIGINPUTS6 test/*.h.in.cmake)
LIST (APPEND CONFIGINPUTS "${CONFIGINPUTS1}")
LIST (APPEND CONFIGINPUTS "${CONFIGINPUTS2}")
LIST (APPEND CONFIGINPUTS "${CONFIGINPUTS3}")
LIST (APPEND CONFIGINPUTS "${CONFIGINPUTS4}")
LIST (APPEND CONFIGINPUTS "${CONFIGINPUTS5}")
LIST (APPEND CONFIGINPUTS "${CONFIGINPUTS6}")
FOREACH (CONFIGINPUT ${CONFIGINPUTS})
STRING (REPLACE ".in.h.cmake" ".h" CONFIGOUTPUT1 "${CONFIGINPUT}")
STRING (REPLACE ".h.in.cmake" ".h" CONFIGOUTPUT2 "${CONFIGOUTPUT1}")
CONFIGURE_FILE ("${CONFIGINPUT}" "${CONFIGOUTPUT2}")
ENDFOREACH (CONFIGINPUT ${CONFIGINPUTS})
################################################################################
# Add Build Targets
################################################################################
ADD_SUBDIRECTORY(src)
ADD_SUBDIRECTORY(test)
################################################################################
# Add Install Targets
################################################################################
IF (EXISTS "${MAINFOLDER}/include/${PROJECT_NAME}" AND IS_DIRECTORY "${MAINFOLDER}/include/${PROJECT_NAME}")
INSTALL(DIRECTORY "${MAINFOLDER}/include/${PROJECT_NAME}" DESTINATION "include")
ENDIF (EXISTS "${MAINFOLDER}/include/${PROJECT_NAME}" AND IS_DIRECTORY "${MAINFOLDER}/include/${PROJECT_NAME}")
################################################################################
# Add Documentation Targets
################################################################################
# INCLUDE (DocumentationTargets)