-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
93 lines (87 loc) · 3.84 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
## CMake project file for LibPhysics v1.0
################################################################################
## PROJECT: LibPhysics
################################################################################
cmake_minimum_required (VERSION 2.8)
project (LibPhysics)
set (LIBRARY "physics")
set (VERSION "1")
set (SOVERSION "1.0")
################################################################################
## Sources and headers
################################################################################
set (SOURCES "physics/util/configuration.cc"
"physics/util/io.cc"
"physics/util/logger.cc")
set (HEADERS "physics/unit/constants.hh"
"physics/unit/detail.hh"
"physics/unit/io.hh"
"physics/unit/math.hh"
"physics/unit/prefix.hh"
"physics/unit/prototype.hh"
"physics/unit/standard.hh"
"physics/unit/type_traits.hh"
"physics/unit.hh"
"physics/util/assert.hh"
"physics/util/configuration.hh"
"physics/util/exception.hh"
"physics/util/io.hh"
"physics/util/logger.hh"
"physics/util/math.hh"
"physics/util/mixin.hh"
"physics/util/root.hh"
"physics/util/stringify.hh"
"physics/util/type_traits.hh"
"physics/vector/io.hh"
"physics/vector/prototype.hh"
"physics/vector.hh")
################################################################################
## CMAKE and Compiler Settings
################################################################################
## make sure that the default is RELEASE
if (NOT CMAKE_BUILD_TYPE)
set (CMAKE_BUILD_TYPE RELEASE CACHE STRING
"Choose the type of build, options are: None Debug Release."
FORCE)
endif (NOT CMAKE_BUILD_TYPE)
## extra cmake modules
#set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
# "${CMAKE_SOURCE_DIR}/cmake/Modules/")
## CXX FLAGS (currently only supports gcc (>=4.8) and clang)
## -O1 for debug to take care of a problem with constexpr in gcc
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -std=c++1y -fPIC")
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O1 -std=c++1y -fPIC")
set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -fPIC")
set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -fPIC")
## Project source dir is in the include path
include_directories(BEFORE ${PROJECT_SOURCE_DIR})
## Unit testing for this project
enable_testing()
add_subdirectory(test)
################################################################################
## External Libraries
################################################################################
## require BOOST program_options library
find_package(Boost COMPONENTS program_options filesystem system REQUIRED)
include_directories(AFTER ${Boost_INCLUDE_DIRS})
#set(EXT_LIBRARIES "")
################################################################################
## Compile and Link (if there is anything to build)
################################################################################
#if (NOT ${SOURCES} STREQUAL "")
add_library(${LIBRARY} SHARED ${SOURCES} ${HEADERS})
target_link_libraries(${LIBRARY} ${EXT_LIBRARIES} ${Boost_LIBRARIES})
set_target_properties(${LIBRARY} PROPERTIES VERSION ${VERSION} SOVERSION ${SOVERSION})
#endif ()
################################################################################
## Install
################################################################################
## 1. install all headers
foreach (header ${HEADERS})
get_filename_component(header_path ${header} PATH)
install (FILES ${header} DESTINATION include/${header_path})
endforeach()
## 2. install the shared library if it was built
#if (NOT ${SOURCES} STREQUAL "")
install (TARGETS ${LIBRARY} DESTINATION lib)
#endif ()