-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
85 lines (69 loc) · 2.16 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
cmake_minimum_required(VERSION 3.0.0)
if(POLICY CMP0069)
cmake_policy(SET CMP0069 NEW)
endif()
project(HDF4CPP LANGUAGES CXX)
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
find_package(HDF4 REQUIRED)
find_package(Doxygen)
if (DOXYGEN_FOUND)
configure_file(Doxyfile_user.in ${PROJECT_BINARY_DIR}/Doxyfile_user @ONLY IMMEDIATE)
add_custom_target(docs_user
COMMAND ${DOXYGEN_EXECUTABLE} ${PROJECT_BINARY_DIR}/Doxyfile_user
SOURCES ${PROJECT_BINARY_DIR}/Doxyfile_user
)
configure_file(Doxyfile_all.in ${PROJECT_BINARY_DIR}/Doxyfile_all @ONLY IMMEDIATE)
add_custom_target(docs_all
COMMAND ${DOXYGEN_EXECUTABLE} ${PROJECT_BINARY_DIR}/Doxyfile_all
SOURCES ${PROJECT_BINARY_DIR}/Doxyfile_all
)
else ()
message(WARNING "Doxygen not found")
endif ()
set(HEADERS
include/hdf4cpp/hdf.h
include/hdf4cpp/HdfObject.h
include/hdf4cpp/HdfAttribute.h
include/hdf4cpp/HdfException.h
include/hdf4cpp/HdfFile.h
include/hdf4cpp/HdfItem.h
include/hdf4cpp/HdfDefines.h)
add_library(hdf4cpp
lib/HdfFile.cpp
lib/HdfItem.cpp
lib/HdfAttribute.cpp
lib/HdfException.cpp
${HEADERS}
)
target_include_directories(hdf4cpp
PUBLIC
include/
${HDF4_INCLUDE_DIRS}
)
target_link_libraries(hdf4cpp
${HDF4_LIBRARIES}
)
if (MSVC)
target_compile_definitions(hdf4cpp PUBLIC
NEEDS_NORETURN
)
endif ()
option(HDF4CPP_BUILD_TESTS "Enable building tests" ON)
option(HDF4CPP_BUILD_EXAMPLES "Enable building examples" ON)
if (NOT DEFINED TEST_DATA_PATH)
set(TEST_DATA_PATH "${PROJECT_SOURCE_DIR}/tests/test_data/")
message(STATUS "No path to test data defined, using ${TEST_DATA_PATH} as default")
endif ()
if (HDF4CPP_BUILD_TESTS)
add_subdirectory(tests)
endif()
if (HDF4CPP_BUILD_EXAMPLES)
add_subdirectory(examples)
endif()
install(TARGETS hdf4cpp DESTINATION lib)
install(FILES ${HEADERS}
DESTINATION "include/hdf4cpp"
)