diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2015-08-05 21:01:07 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2015-08-05 21:01:07 (GMT) |
commit | 9e2434625dde11a19b46a5154477247266792219 (patch) | |
tree | 7e7b94935a7acdf8024ec464218c564dccf52963 /config/cmake | |
parent | 0b4b73331d2cd4d6d3433e8bc5c45011f75d6fd3 (diff) | |
download | hdf5-9e2434625dde11a19b46a5154477247266792219.zip hdf5-9e2434625dde11a19b46a5154477247266792219.tar.gz hdf5-9e2434625dde11a19b46a5154477247266792219.tar.bz2 |
[svn-r27469] Merge from trunk with dual-binary CMake code.
Tested: local linux with CMake
Diffstat (limited to 'config/cmake')
-rw-r--r-- | config/cmake/ConfigureChecks.cmake | 33 | ||||
-rw-r--r-- | config/cmake/ConversionTests.c | 82 | ||||
-rw-r--r-- | config/cmake/H5pubconf.h.in | 29 | ||||
-rw-r--r-- | config/cmake/HDF5_Examples.cmake.in | 126 | ||||
-rw-r--r-- | config/cmake/README.txt.cmake.in | 8 | ||||
-rw-r--r-- | config/cmake/cacheinit.cmake | 6 | ||||
-rw-r--r-- | config/cmake/hdf5-config.cmake.in | 51 | ||||
-rw-r--r-- | config/cmake/libhdf5.settings.cmake.in | 4 |
8 files changed, 285 insertions, 54 deletions
diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index df3a7bd..b9f18a9 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -33,6 +33,18 @@ endif (HDF5_METADATA_TRACE_FILE) MARK_AS_ADVANCED (HDF5_METADATA_TRACE_FILE) # ---------------------------------------------------------------------- +# Decide whether the data accuracy has higher priority during data +# conversions. If not, some hard conversions will still be prefered even +# though the data may be wrong (for example, some compilers don't +# support denormalized floating values) to maximize speed. +# +option (HDF5_WANT_DATA_ACCURACY "IF data accuracy is guaranteed during data conversions" ON) +if (HDF5_WANT_DATA_ACCURACY) + set (H5_WANT_DATA_ACCURACY 1) +endif (HDF5_WANT_DATA_ACCURACY) +MARK_AS_ADVANCED (HDF5_WANT_DATA_ACCURACY) + +# ---------------------------------------------------------------------- # Decide whether the presence of user's exception handling functions is # checked and data conversion exceptions are returned. This is mainly # for the speed optimization of hard conversions. Soft conversions can @@ -231,6 +243,24 @@ H5ConversionTests (H5_LDOUBLE_TO_LONG_SPECIAL "Checking IF your system converts # H5ConversionTests (H5_LONG_TO_LDOUBLE_SPECIAL "Checking IF your system can convert (unsigned) long to long double values with special algorithm") # ---------------------------------------------------------------------- +# Set the flag to indicate that the machine can accurately convert +# 'long double' to '(unsigned) long long' values. (This flag should be set for +# all machines, except for Mac OS 10.4 and SGI IRIX64 6.5. When the bit sequence +# of long double is 0x4351ccf385ebc8a0bfcc2a3c..., the values of (unsigned)long long +# start to go wrong on these two machines. Adjusting it higher to +# 0x4351ccf385ebc8a0dfcc... or 0x4351ccf385ebc8a0ffcc... will make the converted +# values wildly wrong. This test detects this wrong behavior and disable the test. +# +H5ConversionTests (H5_LDOUBLE_TO_LLONG_ACCURATE "Checking IF correctly converting long double to (unsigned) long long values") +# ---------------------------------------------------------------------- +# Set the flag to indicate that the machine can accurately convert +# '(unsigned) long long' to 'long double' values. (This flag should be set for +# all machines, except for Mac OS 10.4, when the bit sequences are 003fff..., +# 007fff..., 00ffff..., 01ffff..., ..., 7fffff..., the converted values are twice +# as big as they should be. +# +H5ConversionTests (H5_LLONG_TO_LDOUBLE_CORRECT "Checking IF correctly converting (unsigned) long long to long double values") +# ---------------------------------------------------------------------- # Check if pointer alignments are enforced # H5ConversionTests (H5_NO_ALIGNMENT_RESTRICTIONS "Checking IF alignment restrictions are strictly enforced") @@ -249,6 +279,3 @@ set (FC ${CMAKE_Fortran_COMPILER}) foreach (LINK_LIB ${LINK_LIBS}) set (LIBS "${LIBS} -l${LINK_LIB}") endforeach (LINK_LIB ${LINK_LIBS}) - - - diff --git a/config/cmake/ConversionTests.c b/config/cmake/ConversionTests.c index cd2e8bb..d964bf8 100644 --- a/config/cmake/ConversionTests.c +++ b/config/cmake/ConversionTests.c @@ -116,6 +116,88 @@ done: #endif +#ifdef H5_LDOUBLE_TO_LLONG_ACCURATE_TEST +int main(void) +{ + long double ld = 20041683600089727.779961L; + long long ll; + unsigned long long ull; + unsigned char s[16]; + int ret = 0; + + if(sizeof(long double) == 16) { + /*make sure the long double type is the same as the failing type + *which has 16 bytes in size and 11 bits of exponent. If it is, + *the bit sequence should be like below. It's not + *a decent way to check but this info isn't available. */ + memcpy(s, &ld, 16); + if(s[0]==0x43 && s[1]==0x51 && s[2]==0xcc && s[3]==0xf3 && + s[4]==0x85 && s[5]==0xeb && s[6]==0xc8 && s[7]==0xa0 && + s[8]==0xbf && s[9]==0xcc && s[10]==0x2a && s[11]==0x3c) { + + /*slightly adjust the bit sequence (s[8]=0xdf). The converted + *values will go wild on Mac OS 10.4 and IRIX64 6.5.*/ + s[0]=0x43; s[1]=0x51; s[2]=0xcc; s[3]=0xf3; + s[4]=0x85; s[5]=0xeb; s[6]=0xc8; s[7]=0xa0; + s[8]=0xdf; s[9]=0xcc; s[10]=0x2a; s[11]=0x3c; + s[12]=0x3d; s[13]=0x85; s[14]=0x56; s[15]=0x20; + + memcpy(&ld, s, 16); + ll = (long long)ld; + ull = (unsigned long long)ld; + + if(ll != 20041683600089728 || ull != 20041683600089728) + ret = 1; + } + } +done: + exit(ret); +} +#endif + +#ifdef H5_LLONG_TO_LDOUBLE_CORRECT_TEST +int main(void) +{ + long double ld; + long long ll; + unsigned long long ull; + unsigned char s[16]; + int flag=0, ret=0; + + /*Determine if long double has 16 byte in size, 11 bit exponent, and + *the bias is 0x3ff */ + if(sizeof(long double) == 16) { + ld = 1.0L; + memcpy(s, &ld, 16); + if(s[0]==0x3f && s[1]==0xf0 && s[2]==0x00 && s[3]==0x00 && + s[4]==0x00 && s[5]==0x00 && s[6]==0x00 && s[7]==0x00) + flag = 1; + } + + if(flag==1 && sizeof(long long)==8) { + ll = 0x01ffffffffffffffLL; + ld = (long double)ll; + memcpy(s, &ld, 16); + /*Check if the bit sequence is as supposed to be*/ + if(s[0]!=0x43 || s[1]!=0x7f || s[2]!=0xff || s[3]!=0xff || + s[4]!=0xff || s[5]!=0xff || s[6]!=0xff || s[7]!=0xff || + s[8]!=0xf0 || s[9]!=0x00 || s[10]!=0x00 || s[11]!=0x00) + ret = 1; + } + if(flag==1 && sizeof(unsigned long long)==8) { + ull = 0x01ffffffffffffffULL; + ld = (long double)ull; + memcpy(s, &ld, 16); + if(s[0]!=0x43 || s[1]!=0x7f || s[2]!=0xff || s[3]!=0xff || + s[4]!=0xff || s[5]!=0xff || s[6]!=0xff || s[7]!=0xff || + s[8]!=0xf0 || s[9]!=0x00 || s[10]!=0x00 || s[11]!=0x00) + ret = 1; + } +done: + exit(ret); +} +#endif + #ifdef H5_NO_ALIGNMENT_RESTRICTIONS_TEST #include <stdlib.h> diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in index f0d3031..37bcfbf 100644 --- a/config/cmake/H5pubconf.h.in +++ b/config/cmake/H5pubconf.h.in @@ -15,24 +15,6 @@ /* Define if using a Windows compiler (i.e. Visual Studio) */ #cmakedefine H5_HAVE_VISUAL_STUDIO @H5_HAVE_VISUAL_STUDIO@ -/* Defined if HDF5 was built with CMake AND build as a shared library */ -#cmakedefine H5_BUILT_AS_DYNAMIC_LIB @H5_BUILT_AS_DYNAMIC_LIB@ - -/* Defined if HDF5 was built with CMake AND build as a static library */ -#cmakedefine H5_BUILT_AS_STATIC_LIB @H5_BUILT_AS_STATIC_LIB@ - -/* Defined if HDF5 CPP was built with CMake AND build as a shared library */ -#cmakedefine H5_CPP_BUILT_AS_DYNAMIC_LIB @H5_CPP_BUILT_AS_DYNAMIC_LIB@ - -/* Defined if HDF5 CPP was built with CMake AND build as a static library */ -#cmakedefine H5_CPP_BUILT_AS_STATIC_LIB @H5_CPP_BUILT_AS_STATIC_LIB@ - -/* Defined if HDF5 HL was built with CMake AND build as a shared library */ -#cmakedefine H5_HL_BUILT_AS_DYNAMIC_LIB @H5_HL_BUILT_AS_DYNAMIC_LIB@ - -/* Defined if HDF5 HL was built with CMake AND build as a static library */ -#cmakedefine H5_HL_BUILT_AS_STATIC_LIB @H5_HL_BUILT_AS_STATIC_LIB@ - /* Define if building universal (internal helper macro) */ #cmakedefine H5_AC_APPLE_UNIVERSAL_BUILD @H5_AC_APPLE_UNIVERSAL_BUILD@ @@ -410,10 +392,18 @@ /* Define if HDF5's high-level library headers should be included in hdf5.h */ #cmakedefine H5_INCLUDE_HL @H5_INCLUDE_HL@ +/* Define if your system can convert long double to (unsigned) long long + values correctly. */ +#cmakedefine H5_LDOUBLE_TO_LLONG_ACCURATE @H5_LDOUBLE_TO_LLONG_ACCURATE@ + /* Define if your system converts long double to (unsigned) long values with special algorithm. */ #cmakedefine H5_LDOUBLE_TO_LONG_SPECIAL @H5_LDOUBLE_TO_LONG_SPECIAL@ +/* Define if your system can convert (unsigned) long long to long double + values correctly. */ +#cmakedefine H5_LLONG_TO_LDOUBLE_CORRECT @H5_LLONG_TO_LDOUBLE_CORRECT@ + /* Define if your system can convert (unsigned) long to long double values with special algorithm. */ #cmakedefine H5_LONG_TO_LDOUBLE_SPECIAL @H5_LONG_TO_LDOUBLE_SPECIAL@ @@ -618,6 +608,9 @@ /* Version number of package */ #define H5_VERSION "@HDF5_PACKAGE_VERSION_STRING@" +/* Data accuracy is prefered to speed during data conversions */ +#cmakedefine H5_WANT_DATA_ACCURACY @H5_WANT_DATA_ACCURACY@ + /* Check exception handling functions during data conversions */ #cmakedefine H5_WANT_DCONV_EXCEPTION @H5_WANT_DCONV_EXCEPTION@ diff --git a/config/cmake/HDF5_Examples.cmake.in b/config/cmake/HDF5_Examples.cmake.in new file mode 100644 index 0000000..d0c0509 --- /dev/null +++ b/config/cmake/HDF5_Examples.cmake.in @@ -0,0 +1,126 @@ +cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR) +############################################################################################################### +# This script will build and run the examples from a compressed file +# Execute from a command line: +# ctest -S HDF5_Examples.cmake,HDF5Examples -C Release -V -O test.log +############################################################################################################### + +set(INSTALLDIR "@CMAKE_INSTALL_PREFIX@") +set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") +set(STATICLIBRARIES "@H5_ENABLE_STATIC_LIB@") +set(CTEST_SOURCE_NAME ${CTEST_SCRIPT_ARG}) +set(CTEST_DASHBOARD_ROOT ${CTEST_SCRIPT_DIRECTORY}) +set(CTEST_BUILD_CONFIGURATION "Release") +#set(NO_MAC_FORTRAN "true") +#set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF_BUILD_FORTRAN:BOOL=ON") +set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF_ENABLE_F2003:BOOL=ON") +#set(CTEST_USE_TAR_SOURCE "${CTEST_SCRIPT_ARG}") + +############################################################################################################### +# Adjust the following SET Commands as needed +############################################################################################################### +if(WIN32) + if(STATICLIBRARIES) + set(BUILD_OPTIONS "${BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF") + endif(STATICLIBRARIES) + set(ENV{HDF5_DIR} "${INSTALLDIR}/cmake") + set(CTEST_BINARY_NAME ${CTEST_SOURCE_NAME}\\build) + set(CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}\\${CTEST_SOURCE_NAME}") + set(CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}\\${CTEST_BINARY_NAME}") +else(WIN32) + if(STATICLIBRARIES) + set(BUILD_OPTIONS "${BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_ANSI_CFLAGS:STRING=-fPIC") + endif(STATICLIBRARIES) + set(ENV{HDF5_DIR} "${INSTALLDIR}/share/cmake") + set(ENV{LD_LIBRARY_PATH} "${INSTALLDIR}/lib") + set(CTEST_BINARY_NAME ${CTEST_SOURCE_NAME}/build) + set(CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_SOURCE_NAME}") + set(CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_BINARY_NAME}") +endif(WIN32) + +############################################################################################################### +# For any comments please contact cdashhelp@hdfgroup.org +# +############################################################################################################### + +#----------------------------------------------------------------------------- +# MAC machines need special option +#----------------------------------------------------------------------------- +if(APPLE) + # Compiler choice + execute_process(COMMAND xcrun --find cc OUTPUT_VARIABLE XCODE_CC OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process(COMMAND xcrun --find c++ OUTPUT_VARIABLE XCODE_CXX OUTPUT_STRIP_TRAILING_WHITESPACE) + set(ENV{CC} "${XCODE_CC}") + set(ENV{CXX} "${XCODE_CXX}") + if(NOT NO_MAC_FORTRAN) + # Shared fortran is not supported, build static + set(BUILD_OPTIONS "${BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_ANSI_CFLAGS:STRING=-fPIC") + else(NOT NO_MAC_FORTRAN) + set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF_BUILD_FORTRAN:BOOL=OFF") + endif(NOT NO_MAC_FORTRAN) + set(BUILD_OPTIONS "${BUILD_OPTIONS} -DCTEST_USE_LAUNCHERS:BOOL=ON -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF") +endif(APPLE) + +#----------------------------------------------------------------------------- +set(CTEST_CMAKE_COMMAND "\"${CMAKE_COMMAND}\"") +## -------------------------- +if(CTEST_USE_TAR_SOURCE) + ## Uncompress source if tar or zip file provided + ## -------------------------- + if(WIN32) + message(STATUS "extracting... [${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_USE_TAR_SOURCE}.zip]") + execute_process(COMMAND ${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_USE_TAR_SOURCE}.zip RESULT_VARIABLE rv) + else(WIN32) + message(STATUS "extracting... [${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_USE_TAR_SOURCE}.tar]") + execute_process(COMMAND ${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_USE_TAR_SOURCE}.tar RESULT_VARIABLE rv) + endif(WIN32) + + if(NOT rv EQUAL 0) + message(STATUS "extracting... [error-(${rv}) clean up]") + file(REMOVE_RECURSE "${CTEST_SOURCE_DIRECTORY}") + message(FATAL_ERROR "error: extract of ${CTEST_SOURCE_NAME} failed") + endif(NOT rv EQUAL 0) +endif(CTEST_USE_TAR_SOURCE) + +#----------------------------------------------------------------------------- +## Clear the build directory +## -------------------------- +set(CTEST_START_WITH_EMPTY_BINARY_DIRECTORY TRUE) +if (EXISTS "${CTEST_BINARY_DIRECTORY}" AND IS_DIRECTORY "${CTEST_BINARY_DIRECTORY}") + ctest_empty_binary_directory(${CTEST_BINARY_DIRECTORY}) +else (EXISTS "${CTEST_BINARY_DIRECTORY}" AND IS_DIRECTORY "${CTEST_BINARY_DIRECTORY}") + file(MAKE_DIRECTORY "${CTEST_BINARY_DIRECTORY}") +endif (EXISTS "${CTEST_BINARY_DIRECTORY}" AND IS_DIRECTORY "${CTEST_BINARY_DIRECTORY}") + +# Use multiple CPU cores to build +include(ProcessorCount) +ProcessorCount(N) +if(NOT N EQUAL 0) + if(NOT WIN32) + set(CTEST_BUILD_FLAGS -j${N}) + endif(NOT WIN32) + set(ctest_test_args ${ctest_test_args} PARALLEL_LEVEL ${N}) +endif() +set (CTEST_CONFIGURE_COMMAND + "${CTEST_CMAKE_COMMAND} -C \"${CTEST_SOURCE_DIRECTORY}/config/cmake/cacheinit.cmake\" -DCMAKE_BUILD_TYPE:STRING=${CTEST_BUILD_CONFIGURATION} ${BUILD_OPTIONS} \"-G${CTEST_CMAKE_GENERATOR}\" \"${CTEST_SOURCE_DIRECTORY}\"" +) + +#----------------------------------------------------------------------------- +## -- set output to english +set($ENV{LC_MESSAGES} "en_EN") + +#----------------------------------------------------------------------------- +configure_file(${CTEST_SOURCE_DIRECTORY}/config/cmake/CTestCustom.cmake ${CTEST_BINARY_DIRECTORY}/CTestCustom.cmake) +ctest_read_custom_files ("${CTEST_BINARY_DIRECTORY}") +## NORMAL process +## -------------------------- +ctest_start (Experimental) +ctest_configure (BUILD "${CTEST_BINARY_DIRECTORY}") +ctest_build (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND) +ctest_test (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND ${ctest_test_args} RETURN_VALUE res) +if(res GREATER 0) + message (FATAL_ERROR "tests FAILED") +endif(res GREATER 0) +#----------------------------------------------------------------------------- +############################################################################################################## +message(STATUS "DONE")
\ No newline at end of file diff --git a/config/cmake/README.txt.cmake.in b/config/cmake/README.txt.cmake.in index cc8baeb..a12c5aa 100644 --- a/config/cmake/README.txt.cmake.in +++ b/config/cmake/README.txt.cmake.in @@ -26,18 +26,18 @@ After Installation =========================================================================== The examples folder, HDF5Examples, located in the HDF5 install folder, can be built and tested with CMake and the supplied -HDF518_Examples.cmake file. The HDF518_Examples.cmake expects HDF5 to have +HDF5_Examples.cmake file. The HDF5_Examples.cmake expects HDF5 to have been installed in the default location with above compilers. Also, the CMake utility should be installed. To test the installation with the examples; Create a directory to run the examples. Copy HDF5Examples folder to this directory. - Copy HDF518_Examples.cmake to this directory. - Edit HDF518_Examples.cmake line 8 to set INSTALLDIR to where HDF5 is installed. + Copy HDF5_Examples.cmake to this directory. + Edit HDF5_Examples.cmake line 8 to set INSTALLDIR to where HDF5 is installed. (The default should be correct unless you installed into a different folder.) Execute from this directory: - ctest -S HDF518_Examples.cmake,HDF5Examples-0.1.1-Source -C Release -V -O test.log + ctest -S HDF5_Examples.cmake,HDF5Examples -C Release -V -O test.log When executed, the ctest script will save the results to the log file, test.log, as indicated by the ctest command. If you wish the to see more build and test information, diff --git a/config/cmake/cacheinit.cmake b/config/cmake/cacheinit.cmake index f869949..cca6e98 100644 --- a/config/cmake/cacheinit.cmake +++ b/config/cmake/cacheinit.cmake @@ -4,18 +4,12 @@ # EXTERNAL cache entries ######################## -set (BUILD_SHARED_LIBS ON CACHE BOOL "Build Shared Libraries" FORCE) - -set (BUILD_TESTING ON CACHE BOOL "Build HDF5 Unit Testing" FORCE) - set (CMAKE_INSTALL_FRAMEWORK_PREFIX "Library/Frameworks" CACHE STRING "Frameworks installation directory" FORCE) set (HDF_PACKAGE_EXT "" CACHE STRING "Name of HDF package extension" FORCE) set (HDF5_BUILD_FORTRAN ON CACHE BOOL "Build FORTRAN support" FORCE) -set (HDF5_ENABLE_F2003 ON CACHE BOOL "Enable FORTRAN 2003 Standard" FORCE) - set (HDF5_BUILD_GENERATORS OFF CACHE BOOL "Build Test Generators" FORCE) set (HDF5_ENABLE_Z_LIB_SUPPORT ON CACHE BOOL "Enable Zlib Filters" FORCE) diff --git a/config/cmake/hdf5-config.cmake.in b/config/cmake/hdf5-config.cmake.in index dec59da..adeec55 100644 --- a/config/cmake/hdf5-config.cmake.in +++ b/config/cmake/hdf5-config.cmake.in @@ -6,6 +6,8 @@ string(TOUPPER @HDF5_PACKAGE@ HDF5_PACKAGE_NAME) set (${HDF5_PACKAGE_NAME}_VALID_COMPONENTS + static + shared C CXX Fortran @@ -67,12 +69,6 @@ if (${HDF5_PACKAGE_NAME}_BUILD_TOOLS) set_and_check (${HDF5_PACKAGE_NAME}_TOOLS_DIR "@PACKAGE_CURRENT_BUILD_DIR@/bin") endif () -if (HDF5_BUILD_SHARED_LIBS) - set (H5_BUILT_AS_DYNAMIC_LIB 1) -else () - set (H5_BUILT_AS_STATIC_LIB 1) -endif () - #----------------------------------------------------------------------------- # Version Strings #----------------------------------------------------------------------------- @@ -94,14 +90,25 @@ if (NOT TARGET "@HDF5_PACKAGE@") include (@PACKAGE_SHARE_INSTALL_DIR@/@HDF5_PACKAGE@@HDF_PACKAGE_EXT@-targets.cmake) endif () -# Handle default component : +# Handle default component(static) : if (NOT ${HDF5_PACKAGE_NAME}_FIND_COMPONENTS) - set (${HDF5_PACKAGE_NAME}_FIND_COMPONENTS C HL) - set (${HDF5_PACKAGE_NAME}_FIND_REQUIRED_C true) + set (${HDF5_PACKAGE_NAME}_LIB_TYPE) + set (${HDF5_PACKAGE_NAME}_FIND_COMPONENTS C HL static) + set (${HDF5_PACKAGE_NAME}_FIND_REQUIRED_static_C true) endif () # Handle requested components: list (REMOVE_DUPLICATES ${HDF5_PACKAGE_NAME}_FIND_COMPONENTS) +foreach (comp IN LISTS ${HDF5_PACKAGE_NAME}_FIND_COMPONENTS) + if (${comp} STREQUAL "shared") + list (REMOVE_ITEM ${HDF5_PACKAGE_NAME}_FIND_COMPONENTS ${comp}) + set (${HDF5_PACKAGE_NAME}_LIB_TYPE ${${HDF5_PACKAGE_NAME}_LIB_TYPE} ${comp}) + elseif (${comp} STREQUAL "static") + list (REMOVE_ITEM ${HDF5_PACKAGE_NAME}_FIND_COMPONENTS ${comp}) + set (${HDF5_PACKAGE_NAME}_LIB_TYPE ${${HDF5_PACKAGE_NAME}_LIB_TYPE} ${comp}) + endif () +endforeach () +foreach (libtype IN LISTS ${HDF5_PACKAGE_NAME}_LIB_TYPE) foreach (comp IN LISTS ${HDF5_PACKAGE_NAME}_FIND_COMPONENTS) set (hdf5_comp2) if (${comp} STREQUAL "C") @@ -121,26 +128,28 @@ list (REMOVE_DUPLICATES ${HDF5_PACKAGE_NAME}_FIND_COMPONENTS) set (hdf5_comp2 "hdf5_hl_f90cstub") set (hdf5_comp "hdf5_hl_fortran") endif () - list (FIND ${HDF5_PACKAGE_NAME}_EXPORT_LIBRARIES "${hdf5_comp}" HAVE_COMP) + list (FIND ${HDF5_PACKAGE_NAME}_EXPORT_LIBRARIES "${hdf5_comp}-${libtype}" HAVE_COMP) if (${HAVE_COMP} LESS 0) - set (${HDF5_PACKAGE_NAME}_${comp}_FOUND 0) + set (${HDF5_PACKAGE_NAME}_${libtype}_${comp}_FOUND 0) else () if (hdf5_comp2) - list (FIND ${HDF5_PACKAGE_NAME}_EXPORT_LIBRARIES "${hdf5_comp2}" HAVE_COMP2) + list (FIND ${HDF5_PACKAGE_NAME}_EXPORT_LIBRARIES "${hdf5_comp2}-${libtype}" HAVE_COMP2) if (${HAVE_COMP2} LESS 0) - set (${HDF5_PACKAGE_NAME}_${comp}_FOUND 0) + set (${HDF5_PACKAGE_NAME}_${libtype}_${comp}_FOUND 0) else () - set (${HDF5_PACKAGE_NAME}_${comp}_FOUND 1) - string(TOUPPER ${HDF5_PACKAGE_NAME}_${comp}_LIBRARY COMP_LIBRARY) - set (${HDF5_PACKAGE_NAME}_LIBRARIES ${${HDF5_PACKAGE_NAME}_LIBRARIES} ${hdf5_comp2} ${hdf5_comp}) + set (${HDF5_PACKAGE_NAME}_${libtype}_${comp}_FOUND 1) + string(TOUPPER ${HDF5_PACKAGE_NAME}_${comp}_${libtype}_LIBRARY COMP_LIBRARY) + set (${COMP_LIBRARY} ${${COMP_LIBRARY}} ${hdf5_comp2}-${libtype} ${hdf5_comp}-${libtype}) endif () else () - set (${HDF5_PACKAGE_NAME}_${comp}_FOUND 1) - string(TOUPPER ${HDF5_PACKAGE_NAME}_${comp}_LIBRARY COMP_LIBRARY) - set (${HDF5_PACKAGE_NAME}_LIBRARIES ${${HDF5_PACKAGE_NAME}_LIBRARIES} ${hdf5_comp}) + set (${HDF5_PACKAGE_NAME}_${libtype}_${comp}_FOUND 1) + string(TOUPPER ${HDF5_PACKAGE_NAME}_${comp}_${libtype}_LIBRARY COMP_LIBRARY) + set (${COMP_LIBRARY} ${${COMP_LIBRARY}} ${hdf5_comp}-${libtype}) endif () endif () endforeach () +endforeach () - check_required_components(${HDF5_PACKAGE_NAME}_FIND_COMPONENTS) - +foreach (libtype IN LISTS ${HDF5_PACKAGE_NAME}_LIB_TYPE) + check_required_components(${HDF5_PACKAGE_NAME}_${libtype}) +endforeach () diff --git a/config/cmake/libhdf5.settings.cmake.in b/config/cmake/libhdf5.settings.cmake.in index 0544dba..ba764a4 100644 --- a/config/cmake/libhdf5.settings.cmake.in +++ b/config/cmake/libhdf5.settings.cmake.in @@ -42,7 +42,7 @@ Languages: @BUILD_FORTRAN_CONDITIONAL_TRUE@ H5 Fortran Flags: @H5_FCFLAGS@ @BUILD_FORTRAN_CONDITIONAL_TRUE@ AM Fortran Flags: @AM_FCFLAGS@ @BUILD_FORTRAN_CONDITIONAL_TRUE@ Shared Fortran Library: @H5_ENABLE_SHARED_LIB@ -@BUILD_FORTRAN_CONDITIONAL_TRUE@ Static Fortran Library: @H5_ENABLE_STATIC_LIB@ +@BUILD_FORTRAN_CONDITIONAL_TRUE@ Static Fortran Library: YES C++: @HDF5_BUILD_CPP_LIB@ @BUILD_CXX_CONDITIONAL_TRUE@ C++ Compiler: @CMAKE_CXX_COMPILER@ @@ -50,7 +50,7 @@ Languages: @BUILD_CXX_CONDITIONAL_TRUE@ H5 C++ Flags: @H5_CXXFLAGS@ @BUILD_CXX_CONDITIONAL_TRUE@ AM C++ Flags: @AM_CXXFLAGS@ @BUILD_CXX_CONDITIONAL_TRUE@ Shared C++ Library: @H5_ENABLE_SHARED_LIB@ -@BUILD_CXX_CONDITIONAL_TRUE@ Static C++ Library: @H5_ENABLE_STATIC_LIB@ +@BUILD_CXX_CONDITIONAL_TRUE@ Static C++ Library: YES Features: --------- |