forked from BlueBrain/HighFive
-
Notifications
You must be signed in to change notification settings - Fork 0
/
HighFiveConfig.cmake.in
67 lines (59 loc) · 2.75 KB
/
HighFiveConfig.cmake.in
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
function(copy_interface_properties target source)
foreach(prop
INTERFACE_COMPILE_DEFINITIONS
INTERFACE_COMPILE_FEATURES
INTERFACE_COMPILE_OPTIONS
INTERFACE_INCLUDE_DIRECTORIES
INTERFACE_LINK_LIBRARIES
INTERFACE_SOURCES
INTERFACE_SYSTEM_INCLUDE_DIRECTORIES)
set_property(TARGET ${target} APPEND PROPERTY ${prop} $<TARGET_PROPERTY:${source},${prop}>)
endforeach()
endfunction()
if(TARGET HighFive)
return()
endif()
# Get HighFive targets
include("${CMAKE_CURRENT_LIST_DIR}/HighFiveTargets.cmake")
# Recreate combined HighFive
add_library(HighFive INTERFACE IMPORTED)
set_property(TARGET HighFive APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS MPI_NO_CPPBIND) # No c++ bindings
# Ensure we activate required C++ std
if(NOT DEFINED CMAKE_CXX_STANDARD)
if(CMAKE_VERSION VERSION_LESS 3.8)
message(WARNING "HighFive requires minimum C++11. (C++14 for XTensor) \
You may need to set CMAKE_CXX_STANDARD in you project")
else()
# A client request for a higher std overrides this
target_compile_features(HighFive INTERFACE cxx_std_11)
endif()
endif()
# If the user sets this flag, all dependencies are preserved.
# Useful in central deployments where dependencies are not prepared later
set(HIGHFIVE_USE_INSTALL_DEPS @HIGHFIVE_USE_INSTALL_DEPS@ CACHE BOOL "Use original Highfive dependencies")
if(HIGHFIVE_USE_INSTALL_DEPS)
# If enabled in the deploy config, request c++14
if(@HIGHFIVE_USE_XTENSOR@ AND NOT CMAKE_VERSION VERSION_LESS 3.8)
set_property(TARGET HighFive APPEND PROPERTY INTERFACE_COMPILE_FEATURES cxx_std_14)
endif()
message(STATUS "HIGHFIVE @PROJECT_VERSION@: Using original dependencies (HIGHFIVE_USE_INSTALL_DEPS=YES)")
copy_interface_properties(HighFive HighFive_HighFive)
return()
endif()
# When not using the pre-built dependencies, give user options
if(DEFINED HIGHFIVE_USE_BOOST)
set(HIGHFIVE_USE_BOOST ${HIGHFIVE_USE_BOOST} CACHE BOOL "Enable Boost Support")
else()
set(HIGHFIVE_USE_BOOST @HIGHFIVE_USE_BOOST@ CACHE BOOL "Enable Boost Support")
endif()
set(HIGHFIVE_USE_EIGEN "${HIGHFIVE_USE_EIGEN}" CACHE BOOL "Enable Eigen testing")
set(HIGHFIVE_USE_XTENSOR "${HIGHFIVE_USE_XTENSOR}" CACHE BOOL "Enable xtensor testing")
set(HIGHFIVE_PARALLEL_HDF5 @HIGHFIVE_PARALLEL_HDF5@ CACHE BOOL "Enable Parallel HDF5 support")
if(HIGHFIVE_USE_XTENSOR AND NOT CMAKE_VERSION VERSION_LESS 3.8)
set_property(TARGET HighFive APPEND PROPERTY INTERFACE_COMPILE_FEATURES cxx_std_14)
endif()
message(STATUS "HIGHFIVE @PROJECT_VERSION@: (Re)Detecting Highfive dependencies (HIGHFIVE_USE_INSTALL_DEPS=NO)")
include("${CMAKE_CURRENT_LIST_DIR}/HighFiveTargetDeps.cmake")
foreach(dependency HighFive_libheaders libdeps)
copy_interface_properties(HighFive ${dependency})
endforeach()