Skip to content

Commit 0a312ba

Browse files
committed
CMake < 3.21 needs PROJECT_IS_TOP_LEVEL defined to avoid error
1 parent 5b6489d commit 0a312ba

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

cmake/hdf5.cmake

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,10 @@ set(hdf5_cmake_args
5757
-DHDF5_BUILD_CPP_LIB:BOOL=false
5858
-DBUILD_TESTING:BOOL=false
5959
-DHDF5_BUILD_EXAMPLES:BOOL=false
60-
-DHDF5_BUILD_TOOLS:BOOL=$<NOT:$<BOOL:${hdf5_parallel}>>
60+
-DHDF5_BUILD_TOOLS:BOOL=true
6161
-DHDF5_ENABLE_PARALLEL:BOOL=$<BOOL:${hdf5_parallel}>
62-
-DHDF5_BUILD_PARALLEL_TOOLS:BOOL=false
62+
-DHDF5_BUILD_PARALLEL_TOOLS:BOOL=$<BOOL:${hdf5_parallel}>
6363
)
64-
# https://github.com/HDFGroup/hdf5/issues/818 for broken ph5diff in HDF5_BUILD_TOOLS
65-
# avoid building tools as some HDF5 versions have build failures or broken tools
6664

6765
#-DHDF5_USE_GNU_DIRS:BOOL=ON # not yet, new for 1.14
6866

options.cmake

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@ message(STATUS "${PROJECT_NAME} ${PROJECT_VERSION} CMake ${CMAKE_VERSION} Toolch
22

33
include(GNUInstallDirs)
44

5+
# this is NECESSARY for CMake 3.21 -- parent projects will error on CMake configure!
6+
if(CMAKE_VERSION VERSION_LESS 3.21)
7+
get_property(not_top DIRECTORY PROPERTY PARENT_DIRECTORY)
8+
if(NOT not_top)
9+
set(PROJECT_IS_TOP_LEVEL true)
10+
endif()
11+
endif()
12+
513
option(find "try to find libraries" on)
614

715
option(${PROJECT_NAME}_COVERAGE "Code coverage tests")
@@ -12,17 +20,8 @@ option(concepts "conceptual testing, for devs only" off)
1220

1321
option(CMAKE_TLS_VERIFY "Verify TLS certificates" on)
1422

15-
if(BUILD_SHARED_LIBS AND MSVC)
16-
message(WARNING "Intel oneAPI has trouble with shared libs in general on Windows, try
17-
cmake -DBUILD_SHARED_LIBS=off")
18-
endif()
19-
2023
option(h5fortran_BUILD_TESTING "build tests" ${PROJECT_IS_TOP_LEVEL})
2124

22-
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT AND PROJECT_IS_TOP_LEVEL)
23-
set_property(CACHE CMAKE_INSTALL_PREFIX PROPERTY VALUE "${PROJECT_BINARY_DIR}/local")
24-
endif()
25-
2625
set_property(DIRECTORY PROPERTY EP_UPDATE_DISCONNECTED true)
2726

2827
# Necessary for shared library with Visual Studio / Windows oneAPI

0 commit comments

Comments
 (0)