-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathCMakeLists.txt
91 lines (71 loc) · 3.41 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
project (RJObject C CXX)
cmake_minimum_required (VERSION 2.8.0)
# Setting this explicitly avoids warnings from versions of CMake >= 3
# regarding policy CMP0042; it should be ignored versions of CMake which don't
# support it. (Setting the policy explicitly will break with old CMakes.)
set (CMAKE_MACOSX_RPATH TRUE)
set (CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
if (CMAKE_COMPILER_IS_GNUCC)
# if using gcc use gcc-ar and gcc-ranlib rather than ar and ranlib
set (CMAKE_AR "gcc-ar")
set (CMAKE_RANLIB "gcc-ranlib")
endif (CMAKE_COMPILER_IS_GNUCC)
set (CMAKE_CXX_FLAGS "-Wall -Wextra -pedantic")
set (CMAKE_CXX_FLAGS_RELEASE "-m64 -O3 -flto -march=native -funroll-loops")
set (CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
if (NOT CMAKE_BUILD_TYPE)
set (CMAKE_BUILD_TYPE "release")
endif (NOT CMAKE_BUILD_TYPE)
# Initialize the dependencies to an empty list.
set (RJOBJ_DEPS)
# ==========================================================================
# DNest3
# ==========================================================================
find_package (DNest3 REQUIRED)
list (APPEND RJOBJ_DEPS ${DNEST3_LIBRARY})
include_directories (SYSTEM ${DNEST3_INCLUDES})
# ==========================================================================
# GSL
# ==========================================================================
find_package (GSL REQUIRED)
list (APPEND RJOBJ_DEPS ${GSL_LIBRARIES})
include_directories (SYSTEM ${GSL_INCLUDES})
# ==========================================================================
# BOOST
# ==========================================================================
find_package (Boost COMPONENTS thread system REQUIRED)
list (APPEND RJOBJ_DEPS ${Boost_LIBRARIES})
include_directories (SYSTEM ${Boost_INCLUDES})
# ==========================================================================
# THE LIBRARY
# ==========================================================================
set (RJOBJ_SRC
Distributions/BasicCircular.cpp
Distributions/ClassicMassInf.cpp
Distributions/Distribution.cpp
Distributions/Pareto.cpp
)
set (RJOBJ_INCLUDES
Distributions/BasicCircular.h
Distributions/ClassicMassInf.h
Distributions/Distribution.h
Distributions/Pareto.h
RJObject.h
RJObjectImpl.h
)
add_library (rjobject ${RJOBJ_SRC})
target_link_libraries (rjobject ${RJOBJ_DEPS})
install (TARGETS rjobject DESTINATION lib)
install (FILES ${RJOBJ_INCLUDES} DESTINATION include/rjobject)
# ==========================================================================
# DEMO EXECUTABLE
# ==========================================================================
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR})
add_executable (main main.cpp)
target_link_libraries (main rjobject ${RJOBJ_DEPS})
# ==========================================================================
# THE EXAMPLES
# ==========================================================================
# The examples refer to the headers relative to the project root directory.
include_directories (${PROJECT_SOURCE_DIR})
add_subdirectory (Examples)