-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
79 lines (63 loc) · 2.07 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
cmake_minimum_required (VERSION 2.8)
project (hdf5++)
set (mapiSim_VERSION_MAJOR 1)
set (mapiSim_VERSION_MINOR 0)
include(CheckCXXSourceCompiles)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/CMakeModules/")
add_subdirectory (CMakeModules)
## find necessary libraries
find_package(Boost REQUIRED)
set(LDFLAGS ${LDFLAGS} ${Boost_LDFLAGS})
set(CXXFLAGS ${CXXFLAGS} ${Boost_CPPFLAGS})
include_directories (${ROOT_INCLUDE_DIR})
find_package(HDF5 REQUIRED)
message(STATUS "HDF5_LIBRARY_DIRS: ${HDF5_LIBRARY_DIRS}")
message(STATUS "HDF5_INCLUDE_DIRS: ${HDF5_INCLUDE_DIRS}")
link_directories(${HDF5_LIBRARY_DIRS})
include_directories(${HDF5_INCLUDE_DIRS})
## removing trailing whitespaces
foreach (a ${LDFLAGS})
set(b "${b} ${a}")
endforeach(a)
set(LDFLAGS ${b})
string(REGEX REPLACE "^[ \t]+|[ \t]+$" "" LDFLAGS "${LDFLAGS}")
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O3 -march=native -mtune=native --fast-math -Wall -std=c++0x -Wno-deprecated")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ggdb -Wall -std=c++0x -Wno-deprecated -Xlinker -zmuldefs")
## define libraries and programs
set(LIBRARIES boost_regex boost_program_options xerces-c hdf5)
## define subdirectories
set(LDFLAGS "${LDFLAGS}")
# buildin library and defining header files for installation purpose
SET (hdf5++_HEADERS
ContainerInterface.h
DataConverter.h
Dataset.h
DataTypes.h
Exception.h
File.h
Group.h
hdfLLReading.h
Object.h
)
SET (hdf5++_OOFILES
Object.cpp
File.cpp
Group.cpp
Dataset.cpp
hdfLLReading.cpp
)
add_library(hdf5++ SHARED ${hdf5++_OOFILES} )
# building and linking executable test file
add_executable(hdfTest hdfTest.cpp)
target_link_libraries(hdfTest ${LIBRARIES} "${LDFLAGS}" hdf5++)
## set install dirs
IF (DEFINED prefix)
SET (prefix ${prefix} CACHE PATH "Installation directory")
ELSE (DEFINED prefix)
SET (prefix /usr/local CACHE PATH "Installation directory")
ENDIF (DEFINED prefix)
SET (CMAKE_INSTALL_PREFIX ${prefix} CACHE INTERNAL "")
# install library
INSTALL (TARGETS hdf5++ LIBRARY DESTINATION lib)
# install headers
INSTALL (FILES ${hdf5++_HEADERS} DESTINATION include/hdf5++)