generated from HDFGroup/vol-template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
100 lines (82 loc) · 3 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
include(cmake_utils/PreventInSouceBuilds.cmake.in)
include(FetchContent)
cmake_minimum_required(VERSION 3.11.0 FATAL_ERROR)
project(
parallax_vol
VERSION 1.0.0
DESCRIPTION "parallax VOL connector"
LANGUAGES C)
list(APPEND CMAKE_PREFIX_PATH "/usr/local/hdf5")
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# string(APPEND CMAKE_C_FLAGS " -Werror")
string(APPEND CMAKE_C_FLAGS "-fPIC")
# string( APPEND CMAKE_C_FLAGS " -Wstrict-prototypes -Wall -Wextra
# -fno-omit-frame-pointer -Wunused -Wuninitialized" ) string( APPEND
# CMAKE_C_FLAGS " -Wimplicit-function-declaration -Wshadow -pedantic
# -pedantic-errors -Wmisleading-indentation -pipe" )
# Figure out the build type of the plugin
set(default_build_type "Debug")
string(APPEND CMAKE_C_FLAGS_RELEASE " -O2 -DNDEBUG -finline-functions")
string(APPEND CMAKE_C_FLAGS_DEBUG " -g -ggdb3 -Og -gz")
if(CMAKE_BUILD_TYPE)
message(STATUS "Setting build type to '${CMAKE_BUILD_TYPE}' as specified.")
else()
message(
STATUS
"Setting build type to '${default_build_type}' as none was specified.")
set(CMAKE_BUILD_TYPE "${default_build_type}")
endif()
message(STATUS "Source dir = '${CMAKE_SOURCE_DIR}'")
message(STATUS "Release flags are '${CMAKE_C_FLAGS_RELEASE}'")
message(STATUS "DEBUG flags are '${CMAKE_C_FLAGS_DEBUG}'")
message(STATUSLIB_TEST_ "CMAKE install libdir is '${CMAKE_INSTALL_LIBDIR}'")
set_property(GLOBAL PROPERTY USE_ADDR_SANITIZER OFF)
# Enable testing enable_testing () include (CTest)
# Find HDF5
find_package(
HDF5 1.13
COMPONENTS C
REQUIRED)
link_directories(${HDF5_LIBRARY_DIRS})
FetchContent_Declare(
uthash
GIT_REPOSITORY https://github.com/troydhanson/uthash
GIT_PROGRESS TRUE)
FetchContent_GetProperties(uthash)
# Do not add uthash in the DEPENDENCIES variable. Uthash is a special case
# because it is a header only library & does not support cmake.
if(NOT uthash_POPULATED)
FetchContent_Populate(uthash)
# add_subdirectory(${uthash_SOURCE_DIR}/include)
include_directories(${uthash_SOURCE_DIR}/src ${HDF5_INCLUDE_DIR})
FetchContent_MakeAvailable(uthash)
endif()
set(LINK_LIBS ${LINK_LIBS} ${HDF5_C_${LIB_TYPE}_LIBRARY})
# It's really easy to pick up the wrong HDF5 library if you set the path wrong.
# Turn this on for added confirmation that you got it right. message
# (DEPRECATION "Include: ${HDF5_INCLUDE_DIR}")
add_subdirectory(src)
add_subdirectory(test)
add_subdirectory(tools)
set(FETCHCONTENT_QUIET FALSE)
FetchContent_Declare(
log
GIT_REPOSITORY https://github.com/innerout/log.c.git
GIT_PROGRESS TRUE)
FetchContent_GetProperties(log)
if(NOT log_POPULATED)
FetchContent_Populate(log)
add_subdirectory(${log_SOURCE_DIR} ${log_BINARY_DIR})
FetchContent_MakeAvailable(log)
endif()
# Fetch Parallax project
FetchContent_Declare(
parallax
GIT_REPOSITORY [email protected]:CARV-ICS-FORTH/parallax.git
GIT_TAG extra_hdf5_functionality
GIT_PROGRESS TRUE)
if(NOT parallax_POPULATED)
FetchContent_Populate(parallax)
add_subdirectory(${parallax_SOURCE_DIR} ${parallax_BINARY_DIR})
FetchContent_MakeAvailable(parallax)
endif()