From bc9a773b994cde788e97e5e998eb5fcd21ec8a39 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 24 Apr 2018 17:22:55 -0500 Subject: TRILABS-20 Fix fortran configure during fix of CXX configure --- CMakeLists.txt | 5 +- MANIFEST | 2 + config/cmake/ConfigureChecks.cmake | 48 ++++++------- config/cmake/H5cxx_config.h.in | 2 +- config/cmake/H5pubconf.h.in | 8 +-- config/cmake/HDF5UseFortran.cmake | 67 +++++++++--------- config/cmake_ext_mod/ConfigureChecks.cmake | 83 ---------------------- config/cmake_ext_mod/HDFTests.c | 6 +- config/cmake_ext_mod/HDFUseCXX.cmake | 109 +++++++++++++++++++++++++++++ config/cmake_ext_mod/HDFUseFortran.cmake | 23 +++--- fortran/src/CMakeLists.txt | 2 +- fortran/src/H5config_f.inc.cmake | 68 ++++++------------ fortran/src/H5fort_type_defines.h.cmake | 28 ++++++++ 13 files changed, 242 insertions(+), 209 deletions(-) create mode 100644 config/cmake_ext_mod/HDFUseCXX.cmake create mode 100644 fortran/src/H5fort_type_defines.h.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index d3afc41..825b590 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -834,6 +834,9 @@ if (EXISTS "${HDF5_SOURCE_DIR}/c++" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/c++") message (STATUS " **** Allowing unsupported Parallel and C++ options **** ") endif () endif () + + include (${HDF_RESOURCES_EXT_DIR}/HDFUseCXX.cmake) + if (CMAKE_NO_STD_NAMESPACE) set (H5_NO_STD 1) endif () @@ -852,7 +855,7 @@ endif () # being built then configure should fail due to bug HDFFV-889. #----------------------------------------------------------------------------- if (HDF5_BUILD_FORTRAN AND HDF5_BUILD_HL_LIB) - if (NOT FORTRAN_DEFAULT_REAL_NOT_DOUBLE) + if (NOT H5_FORTRAN_DEFAULT_REAL_NOT_DOUBLE) message (FATAL_ERROR " **** Fortran high-level routines are not supported when the default REAL is DOUBLE PRECISION, use HDF5_BUILD_HL_LIB:BOOL=OFF **** ") endif () endif () diff --git a/MANIFEST b/MANIFEST index 01edd91..721baf5 100644 --- a/MANIFEST +++ b/MANIFEST @@ -234,6 +234,7 @@ ./fortran/src/H5Zff.F90 ./fortran/src/H5config_f.inc.cmake ./fortran/src/H5config_f.inc.in +./fortran/src/H5fort_type_defines.h.cmake ./fortran/src/H5fort_type_defines.h.in ./fortran/src/H5f90.h ./fortran/src/H5f90global.F90 @@ -3140,6 +3141,7 @@ ./config/cmake_ext_mod/HDFLibMacros.cmake ./config/cmake_ext_mod/HDFMacros.cmake ./config/cmake_ext_mod/HDFTests.c +./config/cmake_ext_mod/HDFUseCXX.cmake ./config/cmake_ext_mod/HDFUseFortran.cmake ./config/cmake_ext_mod/NSIS.InstallOptions.ini.in ./config/cmake_ext_mod/NSIS.template.in diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index f61953d..0d955d0 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -16,7 +16,7 @@ set (HDF_PREFIX "H5") include (${HDF_RESOURCES_EXT_DIR}/ConfigureChecks.cmake) if (HDF5_ENABLE_USING_MEMCHECKER) - set (H5_USING_MEMCHECKER 1) + set (${HDF_PREFIX}_USING_MEMCHECKER 1) endif () #----------------------------------------------------------------------------- @@ -24,7 +24,7 @@ endif () #----------------------------------------------------------------------------- option (HDF5_STRICT_FORMAT_CHECKS "Whether to perform strict file format checks" OFF) if (HDF5_STRICT_FORMAT_CHECKS) - set (H5_STRICT_FORMAT_CHECKS 1) + set (${HDF_PREFIX}_STRICT_FORMAT_CHECKS 1) endif () MARK_AS_ADVANCED (HDF5_STRICT_FORMAT_CHECKS) @@ -33,7 +33,7 @@ MARK_AS_ADVANCED (HDF5_STRICT_FORMAT_CHECKS) #----------------------------------------------------------------------------- option (HDF5_METADATA_TRACE_FILE "Enable metadata trace file collection" OFF) if (HDF5_METADATA_TRACE_FILE) - set (H5_METADATA_TRACE_FILE 1) + set (${HDF_PREFIX}_METADATA_TRACE_FILE 1) endif () MARK_AS_ADVANCED (HDF5_METADATA_TRACE_FILE) @@ -45,7 +45,7 @@ MARK_AS_ADVANCED (HDF5_METADATA_TRACE_FILE) # 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) + set (${HDF_PREFIX}_WANT_DATA_ACCURACY 1) endif () MARK_AS_ADVANCED (HDF5_WANT_DATA_ACCURACY) @@ -57,7 +57,7 @@ MARK_AS_ADVANCED (HDF5_WANT_DATA_ACCURACY) # option (HDF5_WANT_DCONV_EXCEPTION "exception handling functions is checked during data conversions" ON) if (HDF5_WANT_DCONV_EXCEPTION) - set (H5_WANT_DCONV_EXCEPTION 1) + set (${HDF_PREFIX}_WANT_DCONV_EXCEPTION 1) endif () MARK_AS_ADVANCED (HDF5_WANT_DCONV_EXCEPTION) @@ -66,7 +66,7 @@ MARK_AS_ADVANCED (HDF5_WANT_DCONV_EXCEPTION) # option (HDF5_ENABLE_CODESTACK "Enable the function stack tracing (for developer debugging)." OFF) if (HDF5_ENABLE_CODESTACK) - set (H5_HAVE_CODESTACK 1) + set (${HDF_PREFIX}_HAVE_CODESTACK 1) endif () MARK_AS_ADVANCED (HDF5_ENABLE_CODESTACK) @@ -79,36 +79,36 @@ if (HDF5_ENABLE_HSIZET) endif () # so far we have no check for this -set (H5_HAVE_TMPFILE 1) +set (${HDF_PREFIX}_HAVE_TMPFILE 1) # TODO -------------------------------------------------------------------------- # Should the Default Virtual File Driver be compiled? # This is hard-coded now but option should added to match configure # -set (H5_DEFAULT_VFD H5FD_SEC2) +set (${HDF_PREFIX}_DEFAULT_VFD H5FD_SEC2) -if (NOT DEFINED "H5_DEFAULT_PLUGINDIR") +if (NOT DEFINED "${HDF_PREFIX}_DEFAULT_PLUGINDIR") if (WINDOWS) - set (H5_DEFAULT_PLUGINDIR "%ALLUSERSPROFILE%\\\\hdf5\\\\lib\\\\plugin") + set (${HDF_PREFIX}_DEFAULT_PLUGINDIR "%ALLUSERSPROFILE%\\\\hdf5\\\\lib\\\\plugin") else () - set (H5_DEFAULT_PLUGINDIR "/usr/local/hdf5/lib/plugin") + set (${HDF_PREFIX}_DEFAULT_PLUGINDIR "/usr/local/hdf5/lib/plugin") endif () endif () if (WINDOWS) - set (H5_HAVE_WINDOWS 1) + set (${HDF_PREFIX}_HAVE_WINDOWS 1) # ---------------------------------------------------------------------- # Set the flag to indicate that the machine has window style pathname, # that is, "drive-letter:\" (e.g. "C:") or "drive-letter:/" (e.g. "C:/"). # (This flag should be _unset_ for all machines, except for Windows) - set (H5_HAVE_WINDOW_PATH 1) + set (${HDF_PREFIX}_HAVE_WINDOW_PATH 1) endif () # ---------------------------------------------------------------------- # END of WINDOWS Hard code Values # ---------------------------------------------------------------------- -CHECK_FUNCTION_EXISTS (difftime H5_HAVE_DIFFTIME) +CHECK_FUNCTION_EXISTS (difftime ${HDF_PREFIX}_HAVE_DIFFTIME) # Find the library containing clock_gettime() if (NOT WINDOWS) @@ -116,12 +116,12 @@ if (NOT WINDOWS) CHECK_LIBRARY_EXISTS (rt clock_gettime "" CLOCK_GETTIME_IN_LIBRT) CHECK_LIBRARY_EXISTS (posix4 clock_gettime "" CLOCK_GETTIME_IN_LIBPOSIX4) if (CLOCK_GETTIME_IN_LIBC) - set (H5_HAVE_CLOCK_GETTIME 1) + set (${HDF_PREFIX}_HAVE_CLOCK_GETTIME 1) elseif (CLOCK_GETTIME_IN_LIBRT) - set (H5_HAVE_CLOCK_GETTIME 1) + set (${HDF_PREFIX}_HAVE_CLOCK_GETTIME 1) list (APPEND LINK_LIBS rt) elseif (CLOCK_GETTIME_IN_LIBPOSIX4) - set (H5_HAVE_CLOCK_GETTIME 1) + set (${HDF_PREFIX}_HAVE_CLOCK_GETTIME 1) list (APPEND LINK_LIBS posix4) endif () endif () @@ -169,9 +169,9 @@ endif () CHECK_TYPE_SIZE("__float128" SIZEOF___FLOAT128) if (${HAVE_SIZEOF___FLOAT128}) - set (H5_HAVE_FLOAT128 1) + set (${HDF_PREFIX}_HAVE_FLOAT128 1) else () - set (H5_HAVE_FLOAT128 0) + set (${HDF_PREFIX}_HAVE_FLOAT128 0) set (SIZEOF___FLOAT128 0) endif () @@ -222,7 +222,7 @@ endmacro () # The machine's conversion gets the correct value. We define the macro and disable # this kind of test until we figure out what algorithm they use. # -H5ConversionTests (H5_LDOUBLE_TO_LONG_SPECIAL "Checking IF your system converts long double to (unsigned) long values with special algorithm") +H5ConversionTests (${HDF_PREFIX}_LDOUBLE_TO_LONG_SPECIAL "Checking IF your system converts long double to (unsigned) long values with special algorithm") # ---------------------------------------------------------------------- # Set the flag to indicate that the machine is using a special algorithm # to convert some values of '(unsigned) long' to 'long double' values. @@ -231,7 +231,7 @@ H5ConversionTests (H5_LDOUBLE_TO_LONG_SPECIAL "Checking IF your system converts # ..., 7fffff..., the compiler uses a unknown algorithm. We define a # macro and skip the test for now until we know about the algorithm. # -H5ConversionTests (H5_LONG_TO_LDOUBLE_SPECIAL "Checking IF your system can convert (unsigned) long to long double values with special algorithm") +H5ConversionTests (${HDF_PREFIX}_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 @@ -241,7 +241,7 @@ H5ConversionTests (H5_LONG_TO_LDOUBLE_SPECIAL "Checking IF your system can conve # 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") +H5ConversionTests (${HDF_PREFIX}_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 @@ -249,8 +249,8 @@ H5ConversionTests (H5_LDOUBLE_TO_LLONG_ACCURATE "Checking IF correctly convertin # 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") +H5ConversionTests (${HDF_PREFIX}_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") +H5ConversionTests (${HDF_PREFIX}_NO_ALIGNMENT_RESTRICTIONS "Checking IF alignment restrictions are strictly enforced") diff --git a/config/cmake/H5cxx_config.h.in b/config/cmake/H5cxx_config.h.in index 82e85c6..d1dd42b 100644 --- a/config/cmake/H5cxx_config.h.in +++ b/config/cmake/H5cxx_config.h.in @@ -12,5 +12,5 @@ /* src/H5cxx_config.h.in Created manually. */ /* Define if offsetof extension is present */ -#cmakedefine HAVE_OFFSETOF ${HAVE_OFFSETOF} +#cmakedefine H5_HAVE_OFFSETOF ${H5_HAVE_OFFSETOF} diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in index 8c01dba..e4c9a2e 100644 --- a/config/cmake/H5pubconf.h.in +++ b/config/cmake/H5pubconf.h.in @@ -53,10 +53,10 @@ #define @H5_FC_FUNC_@ /* Define if Fortran C_LONG_DOUBLE is different from C_DOUBLE */ -#cmakedefine H5_FORTRAN_C_LONG_DOUBLE_IS_UNIQUE @H5_FORTRAN_C_LONG_DOUBLE_IS_UNIQUE@ +#define H5_FORTRAN_C_LONG_DOUBLE_IS_UNIQUE @H5_FORTRAN_C_LONG_DOUBLE_IS_UNIQUE@ /* Define if we have Fortran C_LONG_DOUBLE */ -#cmakedefine H5_FORTRAN_HAVE_C_LONG_DOUBLE @H5_FORTRAN_HAVE_C_LONG_DOUBLE@ +#define H5_FORTRAN_HAVE_C_LONG_DOUBLE @H5_FORTRAN_HAVE_C_LONG_DOUBLE@ /* Define if we have Fortran intrinsic C_SIZEOF */ #cmakedefine H5_FORTRAN_HAVE_C_SIZEOF @H5_FORTRAN_HAVE_C_SIZEOF@ @@ -71,7 +71,7 @@ #cmakedefine H5_FORTRAN_SIZEOF_LONG_DOUBLE @H5_FORTRAN_SIZEOF_LONG_DOUBLE@ /* Define Fortran compiler ID */ -#cmakedefine H5_Fortran_COMPILER_ID @H5_Fortran_COMPILER_ID@ +#define H5_Fortran_COMPILER_ID @CMAKE_Fortran_COMPILER_ID@ /* Define valid Fortran INTEGER KINDs */ #cmakedefine H5_H5CONFIG_F_IKIND @H5_HH5_H5CONFIG_F_NUM_RKIND5CONFIG_F_IKIND@ @@ -509,7 +509,7 @@ #define H5_PACKAGE_VERSION "@HDF5_PACKAGE_VERSION_STRING@" /* Determine the maximum decimal precision in C */ -#define H5_PAC_C_MAX_REAL_PRECISION @H5_PAC_C_MAX_REAL_PRECISION@ +#cmakedefine H5_PAC_C_MAX_REAL_PRECISION @H5_PAC_C_MAX_REAL_PRECISION@ /* Define Fortran Maximum Real Decimal Precision */ #cmakedefine H5_PAC_FC_MAX_REAL_PRECISION @H5_PAC_FC_MAX_REAL_PRECISION@ diff --git a/config/cmake/HDF5UseFortran.cmake b/config/cmake/HDF5UseFortran.cmake index 3152aaa..0e948fe 100644 --- a/config/cmake/HDF5UseFortran.cmake +++ b/config/cmake/HDF5UseFortran.cmake @@ -10,22 +10,24 @@ # help@hdfgroup.org. # +# +# This file provides functions for HDF5 specific Fortran support. +# +#------------------------------------------------------------------------------- +ENABLE_LANGUAGE (Fortran) +set (HDF_PREFIX "H5") +include (CheckFortranFunctionExists) + ## Check for non-standard extenstion quadmath.h CHECK_INCLUDE_FILES(quadmath.h C_HAVE_QUADMATH) if (${C_HAVE_QUADMATH}) - set(HAVE_QUADMATH 1) + set(${HDF_PREFIX}_HAVE_QUADMATH 1) else () - set(HAVE_QUADMATH 0) + set(${HDF_PREFIX}_HAVE_QUADMATH 0) endif () -# -# This file provides functions for HDF5 specific Fortran support. -# -#------------------------------------------------------------------------------- -ENABLE_LANGUAGE (Fortran) - # The provided CMake Fortran macros don't provide a general compile/run function # so this one is used. #----------------------------------------------------------------------------- @@ -96,9 +98,9 @@ CHECK_FORTRAN_FEATURE(c_long_double ) if (${FORTRAN_HAVE_C_LONG_DOUBLE}) - set (FORTRAN_HAVE_C_LONG_DOUBLE 1) + set (${HDF_PREFIX}_FORTRAN_HAVE_C_LONG_DOUBLE 1) else () - set (FORTRAN_HAVE_C_LONG_DOUBLE 0) + set (${HDF_PREFIX}_FORTRAN_HAVE_C_LONG_DOUBLE 0) endif () # Check to see C_LONG_DOUBLE is different from C_DOUBLE @@ -109,17 +111,17 @@ CHECK_FORTRAN_FEATURE(c_long_double FORTRAN_C_LONG_DOUBLE_IS_UNIQUE ) if (${FORTRAN_C_LONG_DOUBLE_IS_UNIQUE}) - set (FORTRAN_C_LONG_DOUBLE_IS_UNIQUE 1) + set (${HDF_PREFIX}_FORTRAN_C_LONG_DOUBLE_IS_UNIQUE 1) else () - set (FORTRAN_C_LONG_DOUBLE_IS_UNIQUE 0) + set (${HDF_PREFIX}_FORTRAN_C_LONG_DOUBLE_IS_UNIQUE 0) endif () ## Set the sizeof function for use later in the fortran tests -if (FORTRAN_HAVE_STORAGE_SIZE) +if (${HDF_PREFIX}_FORTRAN_HAVE_STORAGE_SIZE) set (FC_SIZEOF_A "STORAGE_SIZE(a, c_size_t)/STORAGE_SIZE(c_char_'a',c_size_t)") set (FC_SIZEOF_B "STORAGE_SIZE(b, c_size_t)/STORAGE_SIZE(c_char_'a',c_size_t)") set (FC_SIZEOF_C "STORAGE_SIZE(c, c_size_t)/STORAGE_SIZE(c_char_'a',c_size_t)") -elseif (FORTRAN_HAVE_C_SIZEOF) +elseif (${HDF_PREFIX}_FORTRAN_HAVE_C_SIZEOF) set (FC_SIZEOF_A "SIZEOF(a)") set (FC_SIZEOF_B "SIZEOF(b)") set (FC_SIZEOF_C "SIZEOF(c)") @@ -151,7 +153,7 @@ string (REGEX REPLACE "\n" ";" PROG_OUTPUT "${PROG_OUTPUT}") list (GET PROG_OUTPUT 0 pac_validIntKinds) list (GET PROG_OUTPUT 1 pac_validRealKinds) -list (GET PROG_OUTPUT 2 H5_PAC_FC_MAX_REAL_PRECISION) +list (GET PROG_OUTPUT 2 ${HDF_PREFIX}_PAC_FC_MAX_REAL_PRECISION) # If the lists are empty then something went wrong. if (NOT pac_validIntKinds) @@ -160,7 +162,7 @@ endif () if (NOT pac_validRealKinds) message (FATAL_ERROR "Failed to find available REAL KINDs for Fortran") endif () -if (NOT H5_PAC_FC_MAX_REAL_PRECISION) +if (NOT ${HDF_PREFIX}_PAC_FC_MAX_REAL_PRECISION) message (FATAL_ERROR "No output from Fortran decimal precision program") endif () @@ -172,13 +174,13 @@ list (GET PROG_OUTPUT 4 NUM_RKIND) set (PAC_FORTRAN_NUM_INTEGER_KINDS "${NUM_IKIND}") -set (H5CONFIG_F_NUM_IKIND "INTEGER, PARAMETER :: num_ikinds = ${NUM_IKIND}") -set (H5CONFIG_F_IKIND "INTEGER, DIMENSION(1:num_ikinds) :: ikind = (/${pac_validIntKinds}/)") +set (${HDF_PREFIX}_H5CONFIG_F_NUM_IKIND "INTEGER, PARAMETER :: num_ikinds = ${NUM_IKIND}") +set (${HDF_PREFIX}_H5CONFIG_F_IKIND "INTEGER, DIMENSION(1:num_ikinds) :: ikind = (/${pac_validIntKinds}/)") message (STATUS "....NUMBER OF INTEGER KINDS FOUND ${PAC_FORTRAN_NUM_INTEGER_KINDS}") message (STATUS "....REAL KINDS FOUND ${PAC_FC_ALL_REAL_KINDS}") -message (STATUS "....INTEGER KINDS FOUND ${PAC_FC_ALL_REAL_KINDS}") -message (STATUS "....MAX DECIMAL PRECISION ${H5_PAC_FC_MAX_REAL_PRECISION}") +message (STATUS "....INTEGER KINDS FOUND ${PAC_FC_ALL_INTEGER_KINDS}") +message (STATUS "....MAX DECIMAL PRECISION ${${HDF_PREFIX}_PAC_FC_MAX_REAL_PRECISION}") #----------------------------------------------------------------------------- # Determine the available KINDs for REALs and INTEGERs @@ -263,7 +265,7 @@ string (REGEX REPLACE ",$" "" pack_real_sizeof "${pack_real_sizeof}") #Remove spaces string (REGEX REPLACE " " "" pack_real_sizeof "${pack_real_sizeof}") -set (H5CONFIG_F_RKIND_SIZEOF "INTEGER, DIMENSION(1:num_rkinds) :: rkind_sizeof = (/${pack_real_sizeof}/)") +set (${HDF_PREFIX}_H5CONFIG_F_RKIND_SIZEOF "INTEGER, DIMENSION(1:num_rkinds) :: rkind_sizeof = (/${pack_real_sizeof}/)") message (STATUS "....FOUND SIZEOF for REAL KINDs \{${pack_real_sizeof}\}") @@ -336,13 +338,12 @@ if (NOT PAC_FORTRAN_NATIVE_DOUBLE_KIND) endif () -set (FORTRAN_SIZEOF_LONG_DOUBLE ${${HDF_PREFIX}_SIZEOF_LONG_DOUBLE}) -#set (H5_SIZEOF_LONG_DOUBLE ${${HDF_PREFIX}_SIZEOF_LONG_DOUBLE}) +set (${HDF_PREFIX}_FORTRAN_SIZEOF_LONG_DOUBLE ${${HDF_PREFIX}_SIZEOF_LONG_DOUBLE}) # remove the invalid kind from the list if (NOT(${SIZEOF___FLOAT128} EQUAL 0)) if (NOT(${SIZEOF___FLOAT128} EQUAL ${max_real_fortran_sizeof}) - AND NOT(${FORTRAN_SIZEOF_LONG_DOUBLE} EQUAL ${max_real_fortran_sizeof}) + AND NOT(${${HDF_PREFIX}_FORTRAN_SIZEOF_LONG_DOUBLE} EQUAL ${max_real_fortran_sizeof}) # account for the fact that the C compiler can have 16-byte __float128 and the fortran compiler only has 8-byte doubles, # so we don't want to remove the 8-byte fortran doubles. AND NOT(${PAC_FORTRAN_NATIVE_DOUBLE_SIZEOF} EQUAL ${max_real_fortran_sizeof})) @@ -355,15 +356,15 @@ if (NOT(${SIZEOF___FLOAT128} EQUAL 0)) endif () endif () -set (H5CONFIG_F_NUM_RKIND "INTEGER, PARAMETER :: num_rkinds = ${NUM_RKIND}") +set (${HDF_PREFIX}_H5CONFIG_F_NUM_RKIND "INTEGER, PARAMETER :: num_rkinds = ${NUM_RKIND}") string (REGEX REPLACE "{" "" OUT_VAR ${PAC_FC_ALL_REAL_KINDS}) string (REGEX REPLACE "}" "" OUT_VAR ${OUT_VAR}) -set (H5CONFIG_F_RKIND "INTEGER, DIMENSION(1:num_rkinds) :: rkind = (/${OUT_VAR}/)") +set (${HDF_PREFIX}_H5CONFIG_F_RKIND "INTEGER, DIMENSION(1:num_rkinds) :: rkind = (/${OUT_VAR}/)") string (REGEX REPLACE "{" "" OUT_VAR ${PAC_FC_ALL_REAL_KINDS_SIZEOF}) string (REGEX REPLACE "}" "" OUT_VAR ${OUT_VAR}) -set (H5CONFIG_F_RKIND_SIZEOF "INTEGER, DIMENSION(1:num_rkinds) :: rkind_sizeof = (/${OUT_VAR}/)") +set (${HDF_PREFIX}_H5CONFIG_F_RKIND_SIZEOF "INTEGER, DIMENSION(1:num_rkinds) :: rkind_sizeof = (/${OUT_VAR}/)") ENABLE_LANGUAGE (C) @@ -424,7 +425,7 @@ set (PROG_SRC #include #define CHECK_FLOAT128 ${SIZEOF___FLOAT128} #if CHECK_FLOAT128!=0 -# if ${HAVE_QUADMATH}!=0 +# if ${${HDF_PREFIX}_HAVE_QUADMATH}!=0 #include # endif # ifdef FLT128_DIG @@ -460,18 +461,18 @@ list (GET PROG_OUTPUT 0 LDBL_DIG) list (GET PROG_OUTPUT 1 FLT128_DIG) if (SIZEOF___FLOAT128 EQUAL 0 OR FLT128_DIG EQUAL 0) - set (H5_HAVE_FLOAT128 0) + set (${HDF_PREFIX}_HAVE_FLOAT128 0) set (SIZEOF___FLOAT128 0) - set (H5_PAC_C_MAX_REAL_PRECISION ${LDBL_DIG}) + set (${HDF_PREFIX}_PAC_C_MAX_REAL_PRECISION ${LDBL_DIG}) else () - set(H5_PAC_C_MAX_REAL_PRECISION ${FLT128_DIG}) + set(${HDF_PREFIX}_PAC_C_MAX_REAL_PRECISION ${FLT128_DIG}) endif () # Setting definition if there is a 16 byte fortran integer string (FIND ${PAC_FC_ALL_INTEGER_KINDS_SIZEOF} "16" pos) if (${pos} EQUAL -1) - set (HAVE_Fortran_INTEGER_SIZEOF_16 0) + set (${HDF_PREFIX}_HAVE_Fortran_INTEGER_SIZEOF_16 0) else () - set (HAVE_Fortran_INTEGER_SIZEOF_16 1) + set (${HDF_PREFIX}_HAVE_Fortran_INTEGER_SIZEOF_16 1) endif () diff --git a/config/cmake_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake index 0153254..b0deab7 100644 --- a/config/cmake_ext_mod/ConfigureChecks.cmake +++ b/config/cmake_ext_mod/ConfigureChecks.cmake @@ -19,12 +19,7 @@ include (CheckLibraryExists) include (CheckSymbolExists) include (CheckTypeSize) include (CheckVariableExists) -include (CheckFortranFunctionExists) include (TestBigEndian) -if (CMAKE_CXX_COMPILER AND CMAKE_CXX_COMPILER_LOADED) - include (CheckIncludeFileCXX) - include (TestForSTDNamespace) -endif () #----------------------------------------------------------------------------- # APPLE/Darwin setup @@ -223,17 +218,6 @@ CHECK_INCLUDE_FILE_CONCAT ("stddef.h" ${HDF_PREFIX}_HAVE_STDDEF_H) CHECK_INCLUDE_FILE_CONCAT ("stdint.h" ${HDF_PREFIX}_HAVE_STDINT_H) CHECK_INCLUDE_FILE_CONCAT ("unistd.h" ${HDF_PREFIX}_HAVE_UNISTD_H) -# IF the c compiler found stdint, check the C++ as well. On some systems this -# file will be found by C but not C++, only do this test IF the C++ compiler -# has been initialized (e.g. the project also includes some c++) -if (${HDF_PREFIX}_HAVE_STDINT_H AND CMAKE_CXX_COMPILER_LOADED) - CHECK_INCLUDE_FILE_CXX ("stdint.h" ${HDF_PREFIX}_HAVE_STDINT_H_CXX) - if (NOT ${HDF_PREFIX}_HAVE_STDINT_H_CXX) - set (${HDF_PREFIX}_HAVE_STDINT_H "" CACHE INTERNAL "Have includes HAVE_STDINT_H") - set (USE_INCLUDES ${USE_INCLUDES} "stdint.h") - endif () -endif () - # Darwin CHECK_INCLUDE_FILE_CONCAT ("mach/mach_time.h" ${HDF_PREFIX}_HAVE_MACH_MACH_TIME_H) @@ -331,8 +315,6 @@ if (NOT WINDOWS) endif () endif () -add_definitions (${HDF_EXTRA_FLAGS}) - #----------------------------------------------------------------------------- # Check for HAVE_OFF64_T functionality #----------------------------------------------------------------------------- @@ -585,71 +567,6 @@ if (NOT WINDOWS) endforeach () endif () -# For other CXX specific tests, use this MACRO. -macro (HDF_CXX_FUNCTION_TEST OTHER_TEST) - if (NOT DEFINED ${OTHER_TEST}) - set (MACRO_CHECK_FUNCTION_DEFINITIONS "-D${OTHER_TEST} ${CMAKE_REQUIRED_FLAGS}") - set (OTHER_TEST_ADD_LIBRARIES) - if (CMAKE_REQUIRED_LIBRARIES) - set (OTHER_TEST_ADD_LIBRARIES "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") - endif () - - foreach (def - HAVE_SYS_TIME_H - HAVE_UNISTD_H - HAVE_SYS_TYPES_H - HAVE_SYS_SOCKET_H - HAVE_SYS_FILE_H - ) - if ("${${HDF_PREFIX}_${def}}") - set (MACRO_CHECK_FUNCTION_DEFINITIONS "${MACRO_CHECK_FUNCTION_DEFINITIONS} -D${def}") - endif () - endforeach () - - if (LARGEFILE) - set (MACRO_CHECK_FUNCTION_DEFINITIONS - "${MACRO_CHECK_FUNCTION_DEFINITIONS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE" - ) - endif () - - #message (STATUS "Performing ${OTHER_TEST}") - TRY_COMPILE (${OTHER_TEST} - ${CMAKE_BINARY_DIR} - ${HDF_RESOURCES_EXT_DIR}/HDFCXXTests.cpp - CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS} - "${OTHER_TEST_ADD_LIBRARIES}" - OUTPUT_VARIABLE OUTPUT - ) - if (${OTHER_TEST} EQUAL 0) - set (${OTHER_TEST} 1 CACHE INTERNAL "CXX test ${FUNCTION}") - message (STATUS "Performing CXX Test ${OTHER_TEST} - Success") - else () - message (STATUS "Performing CXX Test ${OTHER_TEST} - Failed") - set (${OTHER_TEST} "" CACHE INTERNAL "CXX test ${FUNCTION}") - file (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log - "Performing CXX Test ${OTHER_TEST} failed with the following output:\n" - "${OUTPUT}\n" - ) - endif () - endif () -endmacro () - -#----------------------------------------------------------------------------- -# Check a bunch of cxx functions -#----------------------------------------------------------------------------- -if (CMAKE_CXX_COMPILER_LOADED) - foreach (test - OLD_HEADER_FILENAME - ${HDF_PREFIX}_NO_NAMESPACE - ${HDF_PREFIX}_NO_STD - BOOL_NOTDEFINED - NO_STATIC_CAST - CXX_HAVE_OFFSETOF - ) - HDF_CXX_FUNCTION_TEST (${test}) - endforeach () -endif () - #----------------------------------------------------------------------------- # Check if InitOnceExecuteOnce is available #----------------------------------------------------------------------------- diff --git a/config/cmake_ext_mod/HDFTests.c b/config/cmake_ext_mod/HDFTests.c index 320fd5b..0b9b530 100644 --- a/config/cmake_ext_mod/HDFTests.c +++ b/config/cmake_ext_mod/HDFTests.c @@ -180,7 +180,7 @@ SIMPLE_TEST(struct tm tm; tm.tm_gmtoff=0); #include SIMPLE_TEST(struct tm tm; tm.__tm_gmtoff=0); -#endif /* HAVE_TM_GMTOFF */ +#endif /* HAVE_TM___GMTOFF */ #ifdef HAVE_TIMEZONE @@ -436,13 +436,13 @@ int main () SIMPLE_TEST(struct videoconfig w; w.numtextcols=0); -#endif /* HAVE_TM_GMTOFF */ +#endif /* HAVE_STRUCT_VIDEOCONFIG */ #ifdef HAVE_STRUCT_TEXT_INFO SIMPLE_TEST(struct text_info w; w.screenwidth=0); -#endif /* HAVE_TM_GMTOFF */ +#endif /* HAVE_STRUCT_TEXT_INFO */ #if defined( HAVE_INLINE ) || defined( HAVE___INLINE__ ) || defined( HAVE___INLINE ) #ifndef __cplusplus diff --git a/config/cmake_ext_mod/HDFUseCXX.cmake b/config/cmake_ext_mod/HDFUseCXX.cmake new file mode 100644 index 0000000..3afcdb6 --- /dev/null +++ b/config/cmake_ext_mod/HDFUseCXX.cmake @@ -0,0 +1,109 @@ +# +# Copyright by The HDF Group. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the COPYING file, which can be found at the root of the source code +# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. +# If you do not have access to either file, you may request a copy from +# help@hdfgroup.org. +# +# +# This file provides functions for C++ support. +# +#------------------------------------------------------------------------------- +ENABLE_LANGUAGE (CXX) +set (HDF_PREFIX "H5") + +#------------------------------------------------------------------------------- +# Fix CXX flags if we are compiling staticly on Windows using +# Windows_MT.cmake from config/cmake/UserMacros +#------------------------------------------------------------------------------- +if (BUILD_STATIC_CRT_LIBS) + TARGET_STATIC_CRT_FLAGS () +endif () + +#----------------------------------------------------------------------------- +# Configure Checks which require CXX compilation must go in here +# not in the main ConfigureChecks.cmake files, because if the user has +# no CXX compiler, problems arise. +#----------------------------------------------------------------------------- +include (CheckIncludeFileCXX) +include (TestForSTDNamespace) + +# IF the c compiler found stdint, check the C++ as well. On some systems this +# file will be found by C but not C++, only do this test IF the C++ compiler +# has been initialized (e.g. the project also includes some c++) +if (${HDF_PREFIX}_HAVE_STDINT_H AND CMAKE_CXX_COMPILER_LOADED) + CHECK_INCLUDE_FILE_CXX ("stdint.h" ${HDF_PREFIX}_HAVE_STDINT_H_CXX) + if (NOT ${HDF_PREFIX}_HAVE_STDINT_H_CXX) + set (${HDF_PREFIX}_HAVE_STDINT_H "" CACHE INTERNAL "Have includes HAVE_STDINT_H") + set (USE_INCLUDES ${USE_INCLUDES} "stdint.h") + endif () +endif () + +# For other CXX specific tests, use this MACRO. +macro (HDF_CXX_FUNCTION_TEST OTHER_TEST) + if (NOT DEFINED ${OTHER_TEST}) + set (MACRO_CHECK_FUNCTION_DEFINITIONS "-D${OTHER_TEST} ${CMAKE_REQUIRED_FLAGS}") + set (OTHER_TEST_ADD_LIBRARIES) + if (CMAKE_REQUIRED_LIBRARIES) + set (OTHER_TEST_ADD_LIBRARIES "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") + endif () + + foreach (def + HAVE_SYS_TIME_H + HAVE_UNISTD_H + HAVE_SYS_TYPES_H + HAVE_SYS_SOCKET_H + HAVE_SYS_FILE_H + ) + if ("${${HDF_PREFIX}_${def}}") + set (MACRO_CHECK_FUNCTION_DEFINITIONS "${MACRO_CHECK_FUNCTION_DEFINITIONS} -D${def}") + endif () + endforeach () + + if (LARGEFILE) + set (MACRO_CHECK_FUNCTION_DEFINITIONS + "${MACRO_CHECK_FUNCTION_DEFINITIONS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE" + ) + endif () + + #message (STATUS "Performing ${OTHER_TEST}") + TRY_COMPILE (${OTHER_TEST} + ${CMAKE_BINARY_DIR} + ${HDF_RESOURCES_EXT_DIR}/HDFCXXTests.cpp + CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS} + "${OTHER_TEST_ADD_LIBRARIES}" + OUTPUT_VARIABLE OUTPUT + ) + if (${OTHER_TEST} EQUAL 0) + set (${OTHER_TEST} 1 CACHE INTERNAL "CXX test ${FUNCTION}") + message (STATUS "Performing CXX Test ${OTHER_TEST} - Success") + else () + message (STATUS "Performing CXX Test ${OTHER_TEST} - Failed") + set (${OTHER_TEST} "" CACHE INTERNAL "CXX test ${FUNCTION}") + file (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log + "Performing CXX Test ${OTHER_TEST} failed with the following output:\n" + "${OUTPUT}\n" + ) + endif () + endif () +endmacro () + +#----------------------------------------------------------------------------- +# Check a bunch of cxx functions +#----------------------------------------------------------------------------- +if (CMAKE_CXX_COMPILER_LOADED) + foreach (test + OLD_HEADER_FILENAME + ${HDF_PREFIX}_NO_NAMESPACE + ${HDF_PREFIX}_NO_STD + BOOL_NOTDEFINED + NO_STATIC_CAST + ${HDF_PREFIX}_CXX_HAVE_OFFSETOF + ) + HDF_CXX_FUNCTION_TEST (${test}) + endforeach () +endif () diff --git a/config/cmake_ext_mod/HDFUseFortran.cmake b/config/cmake_ext_mod/HDFUseFortran.cmake index 5be2c49..f8f3cea 100644 --- a/config/cmake_ext_mod/HDFUseFortran.cmake +++ b/config/cmake_ext_mod/HDFUseFortran.cmake @@ -14,6 +14,7 @@ # #------------------------------------------------------------------------------- ENABLE_LANGUAGE (Fortran) +set (HDF_PREFIX "H5") #------------------------------------------------------------------------------- # Fix Fortran flags if we are compiling staticly on Windows using @@ -93,18 +94,18 @@ endmacro () #----------------------------------------------------------------------------- # Check for Non-standard extension intrinsic function SIZEOF -set (FORTRAN_HAVE_SIZEOF FALSE) +set (${HDF_PREFIX}_FORTRAN_HAVE_SIZEOF FALSE) CHECK_FORTRAN_FEATURE(sizeof " PROGRAM main i = sizeof(x) END PROGRAM " - FORTRAN_HAVE_SIZEOF + ${HDF_PREFIX}_FORTRAN_HAVE_SIZEOF ) # Check for F2008 standard intrinsic function C_SIZEOF -set (FORTRAN_HAVE_C_SIZEOF FALSE) +set (${HDF_PREFIX}_FORTRAN_HAVE_C_SIZEOF FALSE) CHECK_FORTRAN_FEATURE(c_sizeof " PROGRAM main @@ -114,7 +115,7 @@ CHECK_FORTRAN_FEATURE(c_sizeof result = c_sizeof(a) END PROGRAM " - FORTRAN_HAVE_C_SIZEOF + ${HDF_PREFIX}_FORTRAN_HAVE_C_SIZEOF ) # Check for F2008 standard intrinsic function STORAGE_SIZE @@ -126,21 +127,21 @@ CHECK_FORTRAN_FEATURE(storage_size result = storage_size(a) END PROGRAM " - FORTRAN_HAVE_STORAGE_SIZE + ${HDF_PREFIX}_FORTRAN_HAVE_STORAGE_SIZE ) # Check for F2008 standard intrinsic module "ISO_FORTRAN_ENV" -set (HAVE_ISO_FORTRAN_ENV FALSE) +set (${HDF_PREFIX}_HAVE_ISO_FORTRAN_ENV FALSE) CHECK_FORTRAN_FEATURE(ISO_FORTRAN_ENV " PROGRAM main USE, INTRINSIC :: ISO_FORTRAN_ENV END PROGRAM " - HAVE_ISO_FORTRAN_ENV + ${HDF_PREFIX}_HAVE_ISO_FORTRAN_ENV ) -set (FORTRAN_DEFAULT_REAL_NOT_DOUBLE FALSE) +set (${HDF_PREFIX}_FORTRAN_DEFAULT_REAL_NOT_DOUBLE FALSE) CHECK_FORTRAN_FEATURE(RealIsNotDouble " MODULE type_mod @@ -164,13 +165,13 @@ CHECK_FORTRAN_FEATURE(RealIsNotDouble CALL h5t(d) END PROGRAM main " - FORTRAN_DEFAULT_REAL_NOT_DOUBLE + ${HDF_PREFIX}_FORTRAN_DEFAULT_REAL_NOT_DOUBLE ) #----------------------------------------------------------------------------- # Checks if the ISO_C_BINDING module meets all the requirements #----------------------------------------------------------------------------- -set (FORTRAN_HAVE_ISO_C_BINDING FALSE) +set (${HDF_PREFIX}_FORTRAN_HAVE_ISO_C_BINDING FALSE) CHECK_FORTRAN_FEATURE(iso_c_binding " PROGRAM main @@ -183,7 +184,7 @@ CHECK_FORTRAN_FEATURE(iso_c_binding ptr = C_LOC(ichr(1:1)) END PROGRAM " - FORTRAN_HAVE_ISO_C_BINDING + ${HDF_PREFIX}_FORTRAN_HAVE_ISO_C_BINDING ) #----------------------------------------------------------------------------- diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index 71b7d41..fc63159 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -33,7 +33,7 @@ if (HAVE_FLOAT128) endif () configure_file (${HDF5_F90_SRC_SOURCE_DIR}/H5config_f.inc.cmake ${HDF5_F90_BINARY_DIR}/H5config_f.inc @ONLY) -configure_file (${HDF5_F90_SRC_SOURCE_DIR}/H5fort_type_defines.h.in ${HDF5_F90_BINARY_DIR}/H5fort_type_defines.h @ONLY) +configure_file (${HDF5_F90_SRC_SOURCE_DIR}/H5fort_type_defines.h.cmake ${HDF5_F90_BINARY_DIR}/H5fort_type_defines.h @ONLY) set (Fortran_COMPILER_ID CMAKE_Fortran_COMPILER_ID) diff --git a/fortran/src/H5config_f.inc.cmake b/fortran/src/H5config_f.inc.cmake index f85db6c..b8d5355 100644 --- a/fortran/src/H5config_f.inc.cmake +++ b/fortran/src/H5config_f.inc.cmake @@ -12,87 +12,59 @@ ! fortran/src/H5config_f.inc. Generated from fortran/src/H5config_f.inc.in by configure ! Define if we have parallel support -#define H5_HAVE_PARALLEL @CMAKE_H5_HAVE_PARALLEL@ - -#if H5_HAVE_PARALLEL==0 -#undef H5_HAVE_PARALLEL -#endif +#cmakedefine H5_HAVE_PARALLEL @H5_HAVE_PARALLEL@ ! Define if the intrinsic function STORAGE_SIZE exists -#define H5_FORTRAN_HAVE_STORAGE_SIZE @FORTRAN_HAVE_STORAGE_SIZE@ - -#if H5_FORTRAN_HAVE_STORAGE_SIZE==0 -#undef H5_FORTRAN_HAVE_STORAGE_SIZE -#endif +#cmakedefine H5_FORTRAN_HAVE_STORAGE_SIZE @H5_FORTRAN_HAVE_STORAGE_SIZE@ ! Define if the intrinsic function SIZEOF exists -#define H5_FORTRAN_HAVE_SIZEOF @FORTRAN_HAVE_SIZEOF@ - -#if H5_FORTRAN_HAVE_SIZEOF==0 -#undef H5_FORTRAN_HAVE_SIZEOF -#endif +#cmakedefine H5_FORTRAN_HAVE_SIZEOF @H5_FORTRAN_HAVE_SIZEOF@ ! Define if the intrinsic function C_SIZEOF exists -#define H5_FORTRAN_HAVE_C_SIZEOF @FORTRAN_HAVE_C_SIZEOF@ - -#if H5_FORTRAN_HAVE_C_SIZEOF==0 -#undef H5_FORTRAN_HAVE_C_SIZEOF -#endif +#cmakedefine H5_FORTRAN_HAVE_C_SIZEOF @H5_FORTRAN_HAVE_C_SIZEOF@ ! Define if the intrinsic C_LONG_DOUBLE exists -#define H5_FORTRAN_HAVE_C_LONG_DOUBLE @FORTRAN_HAVE_C_LONG_DOUBLE@ - -#if H5_FORTRAN_HAVE_C_LONG_DOUBLE==0 -#undef H5_FORTRAN_HAVE_C_LONG_DOUBLE -#endif +#define H5_FORTRAN_HAVE_C_LONG_DOUBLE @H5_FORTRAN_HAVE_C_LONG_DOUBLE@ ! Define if Fortran C_LONG_DOUBLE is different from C_DOUBLE -#define H5_FORTRAN_C_LONG_DOUBLE_IS_UNIQUE @FORTRAN_C_LONG_DOUBLE_IS_UNIQUE@ +#define H5_FORTRAN_C_LONG_DOUBLE_IS_UNIQUE @H5_FORTRAN_C_LONG_DOUBLE_IS_UNIQUE@ ! Define if the intrinsic module ISO_FORTRAN_ENV exists -#define H5_HAVE_ISO_FORTRAN_ENV @HAVE_ISO_FORTRAN_ENV@ +#cmakedefine H5_HAVE_ISO_FORTRAN_ENV @H5_HAVE_ISO_FORTRAN_ENV@ ! should this be ${HDF_PREFIX} instead of H5 MSB -#define H5_SIZEOF_DOUBLE @H5_SIZEOF_DOUBLE@ - -#if H5_SIZEOF_DOUBLE==0 -#undef H5_SIZEOF_DOUBLE -#endif +#cmakedefine H5_SIZEOF_DOUBLE @H5_SIZEOF_DOUBLE@ ! should this be ${HDF_PREFIX} instead of H5 MSB -#define H5_SIZEOF_LONG_DOUBLE @H5_SIZEOF_LONG_DOUBLE@ - -#if H5_SIZEOF_LONG_DOUBLE==0 -#undef H5_SIZEOF_LONG_DOUBLE -#endif +#cmakedefine H5_SIZEOF_LONG_DOUBLE @H5_SIZEOF_LONG_DOUBLE@ ! Define the maximum decimal precision for reals -#define H5_PAC_FC_MAX_REAL_PRECISION @H5_PAC_FC_MAX_REAL_PRECISION@ +#cmakedefine H5_PAC_FC_MAX_REAL_PRECISION @H5_PAC_FC_MAX_REAL_PRECISION@ ! If C has quad precision -#define H5_HAVE_FLOAT128 @H5_HAVE_FLOAT128@ +#cmakedefine H5_HAVE_FLOAT128 @H5_HAVE_FLOAT128@ -! Define if INTEGER*16 is available -#define H5_HAVE_Fortran_INTEGER_SIZEOF_16 @HAVE_Fortran_INTEGER_SIZEOF_16@ +! Define if INTEGER*16 is available +#define H5_HAVE_Fortran_INTEGER_SIZEOF_16 @H5_HAVE_Fortran_INTEGER_SIZEOF_16@ ! Maximum decimal precision for C -#define H5_PAC_C_MAX_REAL_PRECISION @H5_PAC_C_MAX_REAL_PRECISION@ +#cmakedefine H5_PAC_C_MAX_REAL_PRECISION @H5_PAC_C_MAX_REAL_PRECISION@ ! number of valid REAL KINDs -#define H5_H5CONFIG_F_NUM_RKIND @H5CONFIG_F_NUM_RKIND@ +#cmakedefine H5_H5CONFIG_F_NUM_RKIND @H5_H5CONFIG_F_NUM_RKIND@ ! valid REAL KINDs (need to have a matching C counter-part) -#define H5_H5CONFIG_F_RKIND @H5CONFIG_F_RKIND@ +#cmakedefine H5_H5CONFIG_F_RKIND @H5_H5CONFIG_F_RKIND@ ! valid REAL KINDs (need to have a matching C counter-part) -#define H5_H5CONFIG_F_RKIND_SIZEOF @H5CONFIG_F_RKIND_SIZEOF@ +#cmakedefine H5_H5CONFIG_F_RKIND_SIZEOF @H5_H5CONFIG_F_RKIND_SIZEOF@ ! number of valid INTEGER KINDs -#define H5_H5CONFIG_F_NUM_IKIND @H5CONFIG_F_NUM_IKIND@ +#cmakedefine H5_H5CONFIG_F_NUM_IKIND @H5_H5CONFIG_F_NUM_IKIND@ ! valid INTEGER KINDs (need to have a matching C counter-part) -#define H5_H5CONFIG_F_IKIND @H5CONFIG_F_IKIND@ +#cmakedefine H5_H5CONFIG_F_IKIND @H5_H5CONFIG_F_IKIND@ ! Fortran compiler id -#define H5_Fortran_COMPILER_ID @Fortran_COMPILER_ID@ +#cmakedefine H5_Fortran_COMPILER_ID @Fortran_COMPILER_ID@ diff --git a/fortran/src/H5fort_type_defines.h.cmake b/fortran/src/H5fort_type_defines.h.cmake new file mode 100644 index 0000000..1aa3181 --- /dev/null +++ b/fortran/src/H5fort_type_defines.h.cmake @@ -0,0 +1,28 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/* If you are reading this file and it has a '.h' suffix, it was automatically + * generated from the '.in' version. Make changes there. + */ +#define H5_FORTRAN_NATIVE_INTEGER_KIND @PAC_FORTRAN_NATIVE_INTEGER_KIND@ +#define H5_FORTRAN_NATIVE_INTEGER_SIZEOF @PAC_FORTRAN_NATIVE_INTEGER_SIZEOF@ +#define H5_FORTRAN_NATIVE_REAL_KIND @PAC_FORTRAN_NATIVE_REAL_KIND@ +#define H5_FORTRAN_NATIVE_REAL_SIZEOF @PAC_FORTRAN_NATIVE_REAL_SIZEOF@ +#define H5_FORTRAN_NATIVE_DOUBLE_KIND @PAC_FORTRAN_NATIVE_DOUBLE_KIND@ +#define H5_FORTRAN_NATIVE_DOUBLE_SIZEOF @PAC_FORTRAN_NATIVE_DOUBLE_SIZEOF@ +#define H5_FORTRAN_NUM_INTEGER_KINDS @PAC_FORTRAN_NUM_INTEGER_KINDS@ +#define H5_FORTRAN_INTEGER_KINDS @PAC_FC_ALL_INTEGER_KINDS@ +#define H5_FORTRAN_INTEGER_KINDS_SIZEOF @PAC_FC_ALL_INTEGER_KINDS_SIZEOF@ +#define H5_FORTRAN_REAL_KINDS @PAC_FC_ALL_REAL_KINDS@ +#define H5_FORTRAN_REAL_KINDS_SIZEOF @PAC_FC_ALL_REAL_KINDS_SIZEOF@ +#define H5_HAVE_Fortran_INTEGER_SIZEOF_16 @H5_HAVE_Fortran_INTEGER_SIZEOF_16@ +#define H5_FORTRAN_HAVE_C_LONG_DOUBLE @H5_FORTRAN_HAVE_C_LONG_DOUBLE@ +#define H5_FORTRAN_C_LONG_DOUBLE_IS_UNIQUE @H5_FORTRAN_C_LONG_DOUBLE_IS_UNIQUE@ -- cgit v0.12 From 2347bffaa2d48b62a22575fbc93b1f5c2716d8d4 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 26 Apr 2018 16:41:04 -0500 Subject: TRILABS-19 remove add_defintions and use generator expressions --- CMakeLists.txt | 11 -- c++/examples/CMakeLists.txt | 12 +- c++/src/CMakeLists.txt | 46 +++---- c++/test/CMakeLists.txt | 27 ++-- config/cmake/UseJava.cmake | 8 +- config/cmake_ext_mod/HDFMacros.cmake | 50 ++++---- examples/CMakeLists.txt | 29 ++--- fortran/examples/CMakeLists.txt | 54 ++++---- fortran/src/CMakeLists.txt | 89 +++++++------- fortran/test/CMakeLists.txt | 190 ++++++++++++----------------- fortran/testpar/CMakeLists.txt | 2 +- hl/c++/examples/CMakeLists.txt | 7 +- hl/c++/src/CMakeLists.txt | 29 ++--- hl/c++/test/CMakeLists.txt | 7 +- hl/examples/CMakeLists.txt | 6 +- hl/fortran/examples/CMakeLists.txt | 9 +- hl/fortran/src/CMakeLists.txt | 95 +++++++-------- hl/fortran/test/CMakeLists.txt | 56 ++++----- hl/src/CMakeLists.txt | 29 ++--- hl/test/CMakeLists.txt | 30 ++--- hl/tools/gif2h5/CMakeLists.txt | 18 +-- hl/tools/h5watch/CMakeLists.txt | 24 ++-- java/src/jni/CMakeLists.txt | 2 +- release_docs/USING_HDF5_CMake.txt | 2 +- src/CMakeLists.txt | 119 +++++++++--------- test/CMakeLists.txt | 173 ++++++++++++-------------- test/CMakeTests.cmake | 6 +- testpar/CMakeLists.txt | 31 +++-- tools/CMakeLists.txt | 5 - tools/lib/CMakeLists.txt | 56 ++++----- tools/src/h5copy/CMakeLists.txt | 12 +- tools/src/h5diff/CMakeLists.txt | 18 +-- tools/src/h5dump/CMakeLists.txt | 12 +- tools/src/h5format_convert/CMakeLists.txt | 6 +- tools/src/h5import/CMakeLists.txt | 6 +- tools/src/h5jam/CMakeLists.txt | 12 +- tools/src/h5ls/CMakeLists.txt | 12 +- tools/src/h5repack/CMakeLists.txt | 12 +- tools/src/h5stat/CMakeLists.txt | 12 +- tools/src/misc/CMakeLists.txt | 24 ++-- tools/test/h5copy/CMakeLists.txt | 12 +- tools/test/h5diff/CMakeLists.txt | 12 +- tools/test/h5dump/CMakeLists.txt | 12 +- tools/test/h5format_convert/CMakeLists.txt | 12 +- tools/test/h5import/CMakeLists.txt | 6 +- tools/test/h5jam/CMakeLists.txt | 18 +-- tools/test/h5jam/h5jamgentest.c | 12 +- tools/test/h5ls/CMakeLists.txt | 6 +- tools/test/h5repack/CMakeLists.txt | 24 ++-- tools/test/h5stat/CMakeLists.txt | 6 +- tools/test/misc/CMakeLists.txt | 24 ++-- tools/test/misc/vds/CMakeLists.txt | 6 +- tools/test/perform/CMakeLists.txt | 54 ++++---- 53 files changed, 705 insertions(+), 847 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 825b590..f24a957 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -522,22 +522,12 @@ option (HDF5_BUILD_GENERATORS "Build Test Generators" OFF) option (HDF5_ENABLE_TRACE "Enable API tracing capability" OFF) mark_as_advanced (HDF5_ENABLE_TRACE) if (${HDF_CFG_NAME} MATCHES "Debug") - add_definitions (-DDEBUG) - # Enable tracing of the API - if (HDF5_ENABLE_TRACE) - add_definitions (-DH5_DEBUG_API ) - endif () # Enable instrumenting of the library's internal operations option (HDF5_ENABLE_INSTRUMENT "Instrument The library" OFF) if (HDF5_ENABLE_INSTRUMENT) set (H5_HAVE_INSTRUMENTED_LIBRARY 1) endif () mark_as_advanced (HDF5_ENABLE_INSTRUMENT) -else () - add_definitions (-DNDEBUG) - if (HDF5_ENABLE_TRACE) - add_definitions (-DH5_DEBUG_API ) - endif () endif () #----------------------------------------------------------------------------- @@ -569,7 +559,6 @@ if (HDF5_ENABLE_PARALLEL) # Used by Fortran + MPI CHECK_SYMBOL_EXISTS (MPI_Comm_c2f "${MPI_C_INCLUDE_DIRS}/mpi.h" H5_HAVE_MPI_MULTI_LANG_Comm) CHECK_SYMBOL_EXISTS (MPI_Info_c2f "${MPI_C_INCLUDE_DIRS}/mpi.h" H5_HAVE_MPI_MULTI_LANG_Info) - INCLUDE_DIRECTORIES (${MPI_C_INCLUDE_DIRS}) else () message (STATUS "Parallel libraries not found") endif () diff --git a/c++/examples/CMakeLists.txt b/c++/examples/CMakeLists.txt index e05d6f0..5eef265 100644 --- a/c++/examples/CMakeLists.txt +++ b/c++/examples/CMakeLists.txt @@ -34,17 +34,17 @@ set (tutr_examples foreach (example ${examples}) add_executable (cpp_ex_${example} ${HDF5_CPP_EXAMPLES_SOURCE_DIR}/${example}.cpp) - set_property(TARGET cpp_ex_${example} APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") - TARGET_C_PROPERTIES (cpp_ex_${example} STATIC " " " ") - target_link_libraries (cpp_ex_${example} ${HDF5_CPP_LIB_TARGET} ${HDF5_LIB_TARGET}) + target_include_directories(cpp_ex_${example} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") + TARGET_C_PROPERTIES (cpp_ex_${example} STATIC) + target_link_libraries (cpp_ex_${example} PRIVATE ${HDF5_CPP_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (cpp_ex_${example} PROPERTIES FOLDER examples/cpp) endforeach () foreach (example ${tutr_examples}) add_executable (cpp_ex_${example} ${HDF5_CPP_EXAMPLES_SOURCE_DIR}/${example}.cpp) - set_property(TARGET cpp_ex_${example} APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") - TARGET_C_PROPERTIES (cpp_ex_${example} STATIC " " " ") - target_link_libraries (cpp_ex_${example} ${HDF5_CPP_LIB_TARGET} ${HDF5_LIB_TARGET}) + target_include_directories(cpp_ex_${example} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") + TARGET_C_PROPERTIES (cpp_ex_${example} STATIC) + target_link_libraries (cpp_ex_${example} PRIVATE ${HDF5_CPP_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (cpp_ex_${example} PROPERTIES FOLDER examples/cpp) endforeach () diff --git a/c++/src/CMakeLists.txt b/c++/src/CMakeLists.txt index eae86a3..8226d16 100644 --- a/c++/src/CMakeLists.txt +++ b/c++/src/CMakeLists.txt @@ -2,19 +2,6 @@ cmake_minimum_required (VERSION 3.10) project (HDF5_CPP_SRC CXX) #----------------------------------------------------------------------------- -# Parallel/MPI, prevent spurious cpp/cxx warnings -#----------------------------------------------------------------------------- -if (H5_HAVE_PARALLEL) - add_definitions ("-DMPICH_SKIP_MPICXX") - add_definitions ("-DMPICH_IGNORE_CXX_SEEK") -endif () - -#----------------------------------------------------------------------------- -# Apply Definitions to compiler in this directory and below -#----------------------------------------------------------------------------- -add_definitions (${HDF_EXTRA_C_FLAGS}) - -#----------------------------------------------------------------------------- # Generate configure file #----------------------------------------------------------------------------- configure_file (${HDF_RESOURCES_DIR}/H5cxx_config.h.in @@ -96,30 +83,35 @@ set (CPP_HDRS ) add_library (${HDF5_CPP_LIB_TARGET} STATIC ${CPP_SOURCES} ${CPP_HDRS}) -set_property(TARGET ${HDF5_CPP_LIB_TARGET} APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") -TARGET_C_PROPERTIES (${HDF5_CPP_LIB_TARGET} STATIC " " " ") +target_include_directories(${HDF5_CPP_LIB_TARGET} + PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}" + INTERFACE "$/include>" +) +target_compile_definitions(${HDF5_CPP_LIB_TARGET} + PRIVATE $<$:"-DMPICH_SKIP_MPICXX;-DMPICH_IGNORE_CXX_SEEK"># Parallel/MPI, prevent spurious cpp/cxx warnings +) +TARGET_C_PROPERTIES (${HDF5_CPP_LIB_TARGET} STATIC) target_link_libraries (${HDF5_CPP_LIB_TARGET} PUBLIC ${HDF5_LIB_TARGET}) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_CPP_LIB_TARGET}") H5_SET_LIB_OPTIONS (${HDF5_CPP_LIB_TARGET} ${HDF5_CPP_LIB_NAME} STATIC 0) -set_target_properties (${HDF5_CPP_LIB_TARGET} PROPERTIES - FOLDER libraries/cpp - INTERFACE_INCLUDE_DIRECTORIES "$/include>" -) +set_target_properties (${HDF5_CPP_LIB_TARGET} PROPERTIES FOLDER libraries/cpp) set (install_targets ${HDF5_CPP_LIB_TARGET}) if (BUILD_SHARED_LIBS) add_library (${HDF5_CPP_LIBSH_TARGET} SHARED ${CPP_SOURCES} ${CPP_HDRS}) - set_property(TARGET ${HDF5_CPP_LIBSH_TARGET} APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") - TARGET_C_PROPERTIES (${HDF5_CPP_LIBSH_TARGET} SHARED " " " ") + target_include_directories(${HDF5_CPP_LIBSH_TARGET} + PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}" + INTERFACE "$/include>" + ) + target_compile_definitions(${HDF5_CPP_LIBSH_TARGET} + PUBLIC "H5_BUILT_AS_DYNAMIC_LIB" + PRIVATE $<$:"-DMPICH_SKIP_MPICXX;-DMPICH_IGNORE_CXX_SEEK"># Parallel/MPI, prevent spurious cpp/cxx warnings + ) + TARGET_C_PROPERTIES (${HDF5_CPP_LIBSH_TARGET} SHARED) target_link_libraries (${HDF5_CPP_LIBSH_TARGET} PUBLIC ${HDF5_LIBSH_TARGET}) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_CPP_LIBSH_TARGET}") H5_SET_LIB_OPTIONS (${HDF5_CPP_LIBSH_TARGET} ${HDF5_CPP_LIB_NAME} SHARED "CXX") - set_target_properties (${HDF5_CPP_LIBSH_TARGET} PROPERTIES - FOLDER libraries/cpp - COMPILE_DEFINITIONS "H5_BUILT_AS_DYNAMIC_LIB" - INTERFACE_INCLUDE_DIRECTORIES "$/include>" - INTERFACE_COMPILE_DEFINITIONS H5_BUILT_AS_DYNAMIC_LIB=1 - ) + set_target_properties (${HDF5_CPP_LIBSH_TARGET} PROPERTIES FOLDER libraries/cpp) set (install_targets ${install_targets} ${HDF5_CPP_LIBSH_TARGET}) endif () diff --git a/c++/test/CMakeLists.txt b/c++/test/CMakeLists.txt index abc7952..0815aa8 100644 --- a/c++/test/CMakeLists.txt +++ b/c++/test/CMakeLists.txt @@ -1,19 +1,6 @@ cmake_minimum_required (VERSION 3.10) project (HDF5_CPP_TEST CXX) -#----------------------------------------------------------------------------- -# Parallel/MPI, prevent spurious cpp/cxx warnings -#----------------------------------------------------------------------------- -if (H5_HAVE_PARALLEL) - add_definitions ("-DMPICH_SKIP_MPICXX") - add_definitions ("-DMPICH_IGNORE_CXX_SEEK") -endif () - -#----------------------------------------------------------------------------- -# Apply Definitions to compiler in this directory and below -#----------------------------------------------------------------------------- -add_definitions (${HDF_EXTRA_C_FLAGS}) - # -------------------------------------------------------------------- # Notes: When creating unit test executables they should be prefixed # with "cpp_". This allows for easier filtering of the test suite when @@ -51,16 +38,16 @@ set (srcdir ${CMAKE_CURRENT_SOURCE_DIR}) configure_file (${HDF5_CPP_TEST_SOURCE_DIR}/H5srcdir_str.h.in H5srcdir_str.h @ONLY) add_executable (cpp_testhdf5 ${CPP_TEST_SOURCES} ) -set_property(TARGET cpp_testhdf5 APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR}") -TARGET_C_PROPERTIES (cpp_testhdf5 STATIC " " " ") -target_link_libraries (cpp_testhdf5 +target_include_directories(cpp_testhdf5 PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR}") +target_compile_definitions(cpp_testhdf5 + PRIVATE $<$:"-DMPICH_SKIP_MPICXX;-DMPICH_IGNORE_CXX_SEEK"># Parallel/MPI, prevent spurious cpp/cxx warnings +) +TARGET_C_PROPERTIES (cpp_testhdf5 STATIC) +target_link_libraries (cpp_testhdf5 PRIVATE ${HDF5_CPP_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET} ) -set_target_properties (cpp_testhdf5 PROPERTIES - FOLDER test/cpp - INTERFACE_INCLUDE_DIRECTORIES "$/include>" -) +set_target_properties (cpp_testhdf5 PROPERTIES FOLDER test/cpp) include (CMakeTests.cmake) diff --git a/config/cmake/UseJava.cmake b/config/cmake/UseJava.cmake index 60b1758..10ffe47 100644 --- a/config/cmake/UseJava.cmake +++ b/config/cmake/UseJava.cmake @@ -794,9 +794,11 @@ function(add_jar _TARGET_NAME) if (_GENERATE_NATIVE_HEADERS) # create an INTERFACE library encapsulating include directory for generated headers add_library (${_GENERATE_NATIVE_HEADERS_TARGET} INTERFACE) - target_include_directories (${_GENERATE_NATIVE_HEADERS_TARGET} INTERFACE - "${_GENERATE_NATIVE_HEADERS_OUTPUT_DIR}" - ${JNI_INCLUDE_DIRS}) + target_include_directories (${_GENERATE_NATIVE_HEADERS_TARGET} + INTERFACE + "${_GENERATE_NATIVE_HEADERS_OUTPUT_DIR}" + ${JNI_INCLUDE_DIRS} + ) # this INTERFACE library depends on jar generation add_dependencies (${_GENERATE_NATIVE_HEADERS_TARGET} ${_TARGET_NAME}) diff --git a/config/cmake_ext_mod/HDFMacros.cmake b/config/cmake_ext_mod/HDFMacros.cmake index 04d60e1..66e581d 100644 --- a/config/cmake_ext_mod/HDFMacros.cmake +++ b/config/cmake_ext_mod/HDFMacros.cmake @@ -219,37 +219,33 @@ macro (HDF_IMPORT_SET_LIB_OPTIONS libtarget libname libtype libversion) endmacro () #------------------------------------------------------------------------------- -macro (TARGET_C_PROPERTIES wintarget libtype addcompileflags addlinkflags) - if (MSVC) - TARGET_MSVC_PROPERTIES (${wintarget} ${libtype} "${addcompileflags} ${WIN_COMPILE_FLAGS}" "${addlinkflags} ${WIN_LINK_FLAGS}") - else () - set_target_properties (${wintarget} PROPERTIES COMPILE_FLAGS "${addcompileflags}" LINK_FLAGS "${addlinkflags}") - endif () -endmacro () - -#------------------------------------------------------------------------------- -macro (TARGET_MSVC_PROPERTIES wintarget libtype addcompileflags addlinkflags) - if (MSVC) - set_target_properties (${wintarget} PROPERTIES COMPILE_FLAGS "${addcompileflags}" LINK_FLAGS "${addlinkflags}") - endif () -endmacro () - -#------------------------------------------------------------------------------- -macro (TARGET_FORTRAN_PROPERTIES forttarget libtype addcompileflags addlinkflags) - if (WIN32) - TARGET_FORTRAN_WIN_PROPERTIES (${forttarget} ${libtype} "${addcompileflags} ${WIN_COMPILE_FLAGS}" "${addlinkflags} ${WIN_LINK_FLAGS}") - endif () +macro (TARGET_C_PROPERTIES wintarget libtype) + target_compile_options(${wintarget} PRIVATE + $<$:${WIN_COMPILE_FLAGS}> + $<$:${WIN_COMPILE_FLAGS}> + ) + target_link_libraries(${wintarget} INTERFACE + $<$:${WIN_LINK_FLAGS}> + $<$:${WIN_LINK_FLAGS}> + ) endmacro () #------------------------------------------------------------------------------- -macro (TARGET_FORTRAN_WIN_PROPERTIES forttarget libtype addcompileflags addlinkflags) - if (MSVC) - if (${libtype} MATCHES "SHARED") - set_target_properties (${forttarget} PROPERTIES COMPILE_FLAGS "/dll ${addcompileflags}" LINK_FLAGS "/SUBSYSTEM:CONSOLE ${addlinkflags}") - else () - set_target_properties (${forttarget} PROPERTIES COMPILE_FLAGS "${addcompileflags}" LINK_FLAGS "/SUBSYSTEM:CONSOLE ${addlinkflags}") - endif () +macro (TARGET_FORTRAN_PROPERTIES forttarget libtype) + if (${libtype} MATCHES "SHARED") + target_compile_options(${forttarget} PRIVATE + $<$:"/dll"> + $<$:${WIN_COMPILE_FLAGS}> + ) + else () + target_compile_options(${forttarget} PRIVATE + $<$:${WIN_COMPILE_FLAGS}> + ) endif () + target_link_libraries(${forttarget} INTERFACE + $<$:"/SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> + ) endmacro () #----------------------------------------------------------------------------- diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 05646d8..48f85f6 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -2,11 +2,6 @@ cmake_minimum_required (VERSION 3.10) project (HDF5_EXAMPLES C) #----------------------------------------------------------------------------- -# Apply Definitions to compiler in this directory and below -#----------------------------------------------------------------------------- -add_definitions (${HDF_EXTRA_C_FLAGS}) - -#----------------------------------------------------------------------------- # Define Sources #----------------------------------------------------------------------------- set (examples @@ -46,30 +41,30 @@ set (examples foreach (example ${examples}) add_executable (${example} ${HDF5_EXAMPLES_SOURCE_DIR}/${example}.c) - set_property(TARGET ${example} APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") - TARGET_C_PROPERTIES (${example} STATIC " " " ") - target_link_libraries (${example} ${HDF5_LIB_TARGET}) + target_include_directories(${example} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") + TARGET_C_PROPERTIES (${example} STATIC) + target_link_libraries (${example} PRIVATE ${HDF5_LIB_TARGET}) set_target_properties (${example} PROPERTIES FOLDER examples) if (BUILD_SHARED_LIBS) add_executable (${example}-shared ${HDF5_EXAMPLES_SOURCE_DIR}/${example}.c) - set_property(TARGET ${example}-shared APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") - TARGET_C_PROPERTIES (${example}-shared SHARED " " " ") - target_link_libraries (${example}-shared ${HDF5_LIBSH_TARGET}) + target_include_directories(${example}-shared PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") + TARGET_C_PROPERTIES (${example}-shared SHARED) + target_link_libraries (${example}-shared PRIVATE ${HDF5_LIBSH_TARGET}) set_target_properties (${example}-shared PROPERTIES FOLDER examples) endif () endforeach () if (H5_HAVE_PARALLEL) add_executable (ph5example ${HDF5_EXAMPLES_SOURCE_DIR}/ph5example.c) - set_property(TARGET ph5example APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") - TARGET_C_PROPERTIES (ph5example STATIC " " " ") - target_link_libraries (ph5example ${HDF5_LIB_TARGET} ${MPI_C_LIBRARIES}) + target_include_directories(ph5example PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") + TARGET_C_PROPERTIES (ph5example STATIC) + target_link_libraries (ph5example PRIVATE ${HDF5_LIB_TARGET} ${MPI_C_LIBRARIES}) set_target_properties (ph5example PROPERTIES FOLDER examples) if (BUILD_SHARED_LIBS) add_executable (ph5example-shared ${HDF5_EXAMPLES_SOURCE_DIR}/ph5example.c) - set_property(TARGET ph5example-shared APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") - TARGET_C_PROPERTIES (ph5example-shared SHARED " " " ") - target_link_libraries (ph5example-shared ${HDF5_LIBSH_TARGET} ${MPI_C_LIBRARIES}) + target_include_directories(ph5example-shared PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") + TARGET_C_PROPERTIES (ph5example-shared SHARED) + target_link_libraries (ph5example-shared PRIVATE ${HDF5_LIBSH_TARGET} ${MPI_C_LIBRARIES}) set_target_properties (ph5example-shared PROPERTIES FOLDER examples) endif () endif () diff --git a/fortran/examples/CMakeLists.txt b/fortran/examples/CMakeLists.txt index 187acc1..d2253ed 100644 --- a/fortran/examples/CMakeLists.txt +++ b/fortran/examples/CMakeLists.txt @@ -35,13 +35,14 @@ set (F2003_examples foreach (example ${examples}) add_executable (f90_ex_${example} ${HDF5_F90_EXAMPLES_SOURCE_DIR}/${example}.f90) - TARGET_FORTRAN_PROPERTIES (f90_ex_${example} STATIC " " " ") - target_link_libraries (f90_ex_${example} + TARGET_FORTRAN_PROPERTIES (f90_ex_${example} STATIC) + target_link_libraries (f90_ex_${example} PRIVATE ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} ) - target_include_directories (f90_ex_${example} PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/static) - set_property(TARGET f90_ex_${example} APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static") + target_include_directories (f90_ex_${example} PRIVATE + "${CMAKE_Fortran_MODULE_DIRECTORY}/static);${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static" + ) set_target_properties (f90_ex_${example} PROPERTIES LINKER_LANGUAGE Fortran FOLDER examples/fortran @@ -49,13 +50,14 @@ foreach (example ${examples}) ) if (BUILD_SHARED_LIBS) add_executable (f90_ex_${example}-shared ${HDF5_F90_EXAMPLES_SOURCE_DIR}/${example}.f90) - TARGET_FORTRAN_PROPERTIES (f90_ex_${example}-shared SHARED " " " ") - target_link_libraries (f90_ex_${example}-shared + TARGET_FORTRAN_PROPERTIES (f90_ex_${example}-shared SHARED) + target_link_libraries (f90_ex_${example}-shared PRIVATE ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ) - target_include_directories (f90_ex_${example}-shared PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/shared) - set_property(TARGET f90_ex_${example}-shared APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared") + target_include_directories (f90_ex_${example}-shared PRIVATE + "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared" + ) set_target_properties (f90_ex_${example}-shared PROPERTIES LINKER_LANGUAGE Fortran FOLDER examples/fortran @@ -66,13 +68,14 @@ endforeach () foreach (example ${F2003_examples}) add_executable (f03_ex_${example} ${HDF5_F90_EXAMPLES_SOURCE_DIR}/${example}.f90) - TARGET_FORTRAN_PROPERTIES (f03_ex_${example} STATIC " " " ") - target_link_libraries (f03_ex_${example} + TARGET_FORTRAN_PROPERTIES (f03_ex_${example} STATIC) + target_link_libraries (f03_ex_${example} PRIVATE ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} ) - target_include_directories (f03_ex_${example} PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/static) - set_property(TARGET f03_ex_${example} APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static") + target_include_directories (f03_ex_${example} PRIVATE + "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static" + ) set_target_properties (f03_ex_${example} PROPERTIES LINKER_LANGUAGE Fortran FOLDER examples/fortran03 @@ -80,13 +83,14 @@ foreach (example ${F2003_examples}) ) if (BUILD_SHARED_LIBS) add_executable (f03_ex_${example}-shared ${HDF5_F90_EXAMPLES_SOURCE_DIR}/${example}.f90) - TARGET_FORTRAN_PROPERTIES (f03_ex_${example}-shared SHARED " " " ") - target_link_libraries (f03_ex_${example}-shared + TARGET_FORTRAN_PROPERTIES (f03_ex_${example}-shared SHARED) + target_link_libraries (f03_ex_${example}-shared PRIVATE ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ) - target_include_directories (f03_ex_${example}-shared PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/shared) - set_property(TARGET f03_ex_${example}-shared APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared") + target_include_directories (f03_ex_${example}-shared PRIVATE + "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared" + ) set_target_properties (f03_ex_${example}-shared PROPERTIES LINKER_LANGUAGE Fortran FOLDER examples/fortran03 @@ -97,13 +101,14 @@ endforeach () if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) add_executable (f90_ex_ph5example ${HDF5_F90_EXAMPLES_SOURCE_DIR}/ph5example.f90) - TARGET_FORTRAN_PROPERTIES (f90_ex_ph5example STATIC " " " ") - target_link_libraries (f90_ex_ph5example + TARGET_FORTRAN_PROPERTIES (f90_ex_ph5example STATIC) + target_link_libraries (f90_ex_ph5example PRIVATE ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} ) - target_include_directories (f90_ex_ph5example PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/static) - set_property(TARGET f90_ex_ph5example APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static") + target_include_directories (f90_ex_ph5example PRIVATE + "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static" + ) set_target_properties (f90_ex_ph5example PROPERTIES LINKER_LANGUAGE Fortran FOLDER examples/fortran @@ -111,13 +116,14 @@ if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) ) if (BUILD_SHARED_LIBS) add_executable (f90_ex_ph5example-shared ${HDF5_F90_EXAMPLES_SOURCE_DIR}/ph5example.f90) - TARGET_FORTRAN_PROPERTIES (f90_ex_ph5example-shared SHARED " " " ") - target_link_libraries (f90_ex_ph5example-shared + TARGET_FORTRAN_PROPERTIES (f90_ex_ph5example-shared SHARED) + target_link_libraries (f90_ex_ph5example-shared PRIVATE ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ) - target_include_directories (f90_ex_ph5example-shared PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/shared) - set_property(TARGET f90_ex_ph5example-shared APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared") + target_include_directories (f90_ex_ph5example-shared PRIVATE + "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared" + ) set_target_properties (f90_ex_ph5example-shared PROPERTIES LINKER_LANGUAGE Fortran FOLDER examples/fortran diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index fc63159..c53a90f 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -49,15 +49,9 @@ add_executable (H5_buildiface target_include_directories(H5_buildiface PRIVATE "${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR}") if (WIN32 AND MSVC) if (BUILD_SHARED_LIBS) - set_target_properties (H5_buildiface - PROPERTIES - COMPILE_FLAGS "/MT" - ) + set_target_properties (H5_buildiface PROPERTIES COMPILE_FLAGS "/MT") endif () - set_target_properties (H5_buildiface - PROPERTIES - LINK_FLAGS "/SUBSYSTEM:CONSOLE" - ) + set_target_properties (H5_buildiface PROPERTIES LINK_FLAGS "/SUBSYSTEM:CONSOLE") endif () set_target_properties (H5_buildiface PROPERTIES LINKER_LANGUAGE Fortran @@ -131,31 +125,36 @@ set (f90CStub_C_SHHDRS ) add_library (${HDF5_F90_C_LIB_TARGET} STATIC ${f90CStub_C_SOURCES} ${f90CStub_C_HDRS}) -set_property(TARGET ${HDF5_F90_C_LIB_TARGET} APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static") -TARGET_C_PROPERTIES (${HDF5_F90_C_LIB_TARGET} STATIC " " " ") +target_include_directories(${HDF5_F90_C_LIB_TARGET} + PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static" + INTERFACE "$/include>" +) +TARGET_C_PROPERTIES (${HDF5_F90_C_LIB_TARGET} STATIC) target_link_libraries (${HDF5_F90_C_LIB_TARGET} PUBLIC ${HDF5_LIB_TARGET}) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_F90_C_LIB_TARGET}") H5_SET_LIB_OPTIONS (${HDF5_F90_C_LIB_TARGET} ${HDF5_F90_C_LIB_NAME} STATIC 0) set_target_properties (${HDF5_F90_C_LIB_TARGET} PROPERTIES FOLDER libraries/fortran LINKER_LANGUAGE C - INTERFACE_INCLUDE_DIRECTORIES "$/include>" ) set (install_targets ${HDF5_F90_C_LIB_TARGET}) if (BUILD_SHARED_LIBS) add_library (${HDF5_F90_C_LIBSH_TARGET} SHARED ${f90CStub_C_SOURCES} ${f90CStub_C_SHHDRS}) - set_property(TARGET ${HDF5_F90_C_LIBSH_TARGET} APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared") - TARGET_C_PROPERTIES (${HDF5_F90_C_LIBSH_TARGET} SHARED " " " ") + target_include_directories(${HDF5_F90_C_LIBSH_TARGET} + PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared" + INTERFACE "$/include>" + ) + target_compile_definitions(${HDF5_F90_C_LIBSH_TARGET} + PUBLIC "H5_BUILT_AS_DYNAMIC_LIB" + ) + TARGET_C_PROPERTIES (${HDF5_F90_C_LIBSH_TARGET} SHARED) target_link_libraries (${HDF5_F90_C_LIBSH_TARGET} PUBLIC ${HDF5_LIBSH_TARGET}) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_F90_C_LIBSH_TARGET}") H5_SET_LIB_OPTIONS (${HDF5_F90_C_LIBSH_TARGET} ${HDF5_F90_C_LIB_NAME} SHARED "F") set_target_properties (${HDF5_F90_C_LIBSH_TARGET} PROPERTIES FOLDER libraries/fortran LINKER_LANGUAGE C - COMPILE_DEFINITIONS "H5_BUILT_AS_DYNAMIC_LIB" - INTERFACE_INCLUDE_DIRECTORIES "$/include>" - INTERFACE_COMPILE_DEFINITIONS H5_BUILT_AS_DYNAMIC_LIB=1 ) set (install_targets ${install_targets} ${HDF5_F90_C_LIBSH_TARGET}) endif () @@ -245,58 +244,52 @@ endif () # Add Main fortran library #----------------------------------------------------------------------------- add_library (${HDF5_F90_LIB_TARGET} STATIC ${f90_F_SOURCES}) +target_include_directories (${HDF5_F90_LIB_TARGET} + PRIVATE "${HDF5_F90_SRC_SOURCE_DIR};${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};$<$:${MPI_Fortran_INCLUDE_DIRS}>" + INTERFACE "$/include>" +) +target_compile_definitions(${HDF5_F90_LIB_TARGET} + PRIVATE $<$:"HDF5F90_WINDOWS"> +) set (SHARED_LINK_FLAGS " ") -TARGET_FORTRAN_PROPERTIES (${HDF5_F90_LIB_TARGET} STATIC " " " ") -target_link_libraries (${HDF5_F90_LIB_TARGET} PUBLIC ${HDF5_F90_C_LIB_TARGET}) -target_link_libraries (${HDF5_F90_LIB_TARGET} PRIVATE ${LINK_Fortran_LIBS}) -target_include_directories (${HDF5_F90_LIB_TARGET} PUBLIC "${HDF5_F90_SRC_SOURCE_DIR};${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR}") -if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) - target_include_directories (${HDF5_F90_LIB_TARGET} PUBLIC ${MPI_Fortran_INCLUDE_DIRS}) -endif () +TARGET_FORTRAN_PROPERTIES (${HDF5_F90_LIB_TARGET} STATIC) +target_link_libraries (${HDF5_F90_LIB_TARGET} + PUBLIC ${HDF5_F90_C_LIB_TARGET} + PRIVATE ${LINK_Fortran_LIBS} $<$:${MPI_Fortran_LIBRARIES}> +) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_F90_LIB_TARGET}") H5_SET_LIB_OPTIONS (${HDF5_F90_LIB_TARGET} ${HDF5_F90_LIB_NAME} STATIC 0) set_target_properties (${HDF5_F90_LIB_TARGET} PROPERTIES FOLDER libraries/fortran LINKER_LANGUAGE Fortran - INTERFACE_INCLUDE_DIRECTORIES "$/include>" Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static ) -if (WIN32) - set_property (TARGET ${HDF5_F90_LIB_TARGET} - APPEND PROPERTY COMPILE_DEFINITIONS "HDF5F90_WINDOWS" - ) -endif () set (install_targets ${install_targets} ${HDF5_F90_LIB_TARGET}) add_dependencies(${HDF5_F90_LIB_TARGET} H5gen) if (BUILD_SHARED_LIBS) add_library (${HDF5_F90_LIBSH_TARGET} SHARED ${f90_F_SOURCES_SHARED}) - set (SHARED_LINK_FLAGS " ") - if (WIN32 AND MSVC) - set (SHARED_LINK_FLAGS "/DLL /DEF:${HDF5_F90_SRC_BINARY_DIR}/hdf5_fortrandll.def") - endif () - TARGET_FORTRAN_PROPERTIES (${HDF5_F90_LIBSH_TARGET} SHARED " " ${SHARED_LINK_FLAGS}) - target_link_libraries (${HDF5_F90_LIBSH_TARGET} PUBLIC ${HDF5_F90_C_LIBSH_TARGET}) - target_link_libraries (${HDF5_F90_LIBSH_TARGET} PRIVATE ${LINK_Fortran_LIBS}) - target_include_directories (${HDF5_F90_LIBSH_TARGET} PUBLIC "${HDF5_F90_SRC_SOURCE_DIR};${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR}") - if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) - target_include_directories (${HDF5_F90_LIBSH_TARGET} PUBLIC ${MPI_Fortran_INCLUDE_DIRS}) - endif () + target_include_directories (${HDF5_F90_LIBSH_TARGET} + PRIVATE "${HDF5_F90_SRC_SOURCE_DIR};${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};$<$:${MPI_Fortran_INCLUDE_DIRS}>" + INTERFACE "$/include>" + ) + target_compile_definitions(${HDF5_F90_LIBSH_TARGET} + PUBLIC "H5_BUILT_AS_DYNAMIC_LIB" + PRIVATE $<$:"BUILD_HDF5_DLL;HDF5F90_WINDOWS"> + ) + TARGET_FORTRAN_PROPERTIES (${HDF5_F90_LIBSH_TARGET} SHARED) + target_link_libraries (${HDF5_F90_LIBSH_TARGET} + PUBLIC ${HDF5_F90_C_LIBSH_TARGET} + PRIVATE ${LINK_Fortran_LIBS} $<$:${MPI_Fortran_LIBRARIES}> + INTERFACE $<$:"/DLL /DEF:${HDF5_F90_SRC_BINARY_DIR}/hdf5_fortrandll.def"> + ) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_F90_LIBSH_TARGET}") H5_SET_LIB_OPTIONS (${HDF5_F90_LIBSH_TARGET} ${HDF5_F90_LIB_NAME} SHARED "F") set_target_properties (${HDF5_F90_LIBSH_TARGET} PROPERTIES FOLDER libraries/fortran LINKER_LANGUAGE Fortran - COMPILE_DEFINITIONS "H5_BUILT_AS_DYNAMIC_LIB" - INTERFACE_INCLUDE_DIRECTORIES "$/include>" - INTERFACE_COMPILE_DEFINITIONS H5_BUILT_AS_DYNAMIC_LIB=1 Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared ) - if (WIN32) - set_property (TARGET ${HDF5_F90_LIBSH_TARGET} - APPEND PROPERTY COMPILE_DEFINITIONS "BUILD_HDF5_DLL;HDF5F90_WINDOWS" - ) - endif () set (install_targets ${install_targets} ${HDF5_F90_LIBSH_TARGET}) add_dependencies(${HDF5_F90_LIBSH_TARGET} H5genSH) endif () diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index 7f538f1..1fb26f5 100644 --- a/fortran/test/CMakeLists.txt +++ b/fortran/test/CMakeLists.txt @@ -12,15 +12,9 @@ add_executable (H5_test_buildiface target_include_directories(H5_test_buildiface PRIVATE ${HDF5_BINARY_DIR} ${HDF5_F90_BINARY_DIR}) if (WIN32 AND MSVC) if (BUILD_SHARED_LIBS) - set_target_properties (H5_test_buildiface - PROPERTIES - COMPILE_FLAGS "/MT" - ) + set_target_properties (H5_test_buildiface PROPERTIES COMPILE_FLAGS "/MT") endif () - set_target_properties (H5_test_buildiface - PROPERTIES - LINK_FLAGS "/SUBSYSTEM:CONSOLE" - ) + set_target_properties (H5_test_buildiface PROPERTIES LINK_FLAGS "/SUBSYSTEM:CONSOLE") endif () set_target_properties (H5_test_buildiface PROPERTIES LINKER_LANGUAGE Fortran @@ -39,9 +33,12 @@ set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/${HDF_CFG_BUILD_TYPE #----------------------------------------------------------------------------- add_library (${HDF5_F90_C_TEST_LIB_TARGET} STATIC t.c) set_source_files_properties (t.c PROPERTIES LANGUAGE C) -set_property(TARGET ${HDF5_F90_C_TEST_LIB_TARGET} APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static") -TARGET_C_PROPERTIES (${HDF5_F90_C_TEST_LIB_TARGET} STATIC " " " ") -target_link_libraries (${HDF5_F90_C_TEST_LIB_TARGET} +target_include_directories(${HDF5_F90_C_TEST_LIB_TARGET} + PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static" + INTERFACE "$/include>" +) +TARGET_C_PROPERTIES (${HDF5_F90_C_TEST_LIB_TARGET} STATIC) +target_link_libraries (${HDF5_F90_C_TEST_LIB_TARGET} PRIVATE ${HDF5_F90_C_LIB_TARGET} ${HDF5_TEST_LIB_TARGET} ) @@ -49,13 +46,18 @@ H5_SET_LIB_OPTIONS (${HDF5_F90_C_TEST_LIB_TARGET} ${HDF5_F90_C_TEST_LIB_NAME} ST set_target_properties (${HDF5_F90_C_TEST_LIB_TARGET} PROPERTIES FOLDER libraries/test/fortran LINKER_LANGUAGE C - INTERFACE_INCLUDE_DIRECTORIES "$/include>" ) if (BUILD_SHARED_LIBS) add_library (${HDF5_F90_C_TEST_LIBSH_TARGET} SHARED t.c) - set_property(TARGET ${HDF5_F90_C_TEST_LIBSH_TARGET} APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared") - TARGET_C_PROPERTIES (${HDF5_F90_C_TEST_LIBSH_TARGET} SHARED " " " ") - target_link_libraries (${HDF5_F90_C_TEST_LIBSH_TARGET} + target_include_directories(${HDF5_F90_C_TEST_LIBSH_TARGET} + PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared" + INTERFACE "$/include>" + ) + target_compile_definitions(${HDF5_F90_C_TEST_LIBSH_TARGET} + PUBLIC "H5_BUILT_AS_DYNAMIC_LIB" + ) + TARGET_C_PROPERTIES (${HDF5_F90_C_TEST_LIBSH_TARGET} SHARED) + target_link_libraries (${HDF5_F90_C_TEST_LIBSH_TARGET} PRIVATE ${HDF5_F90_C_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET} ) @@ -63,9 +65,6 @@ if (BUILD_SHARED_LIBS) set_target_properties (${HDF5_F90_C_TEST_LIBSH_TARGET} PROPERTIES FOLDER libraries/test/fortran LINKER_LANGUAGE C - COMPILE_DEFINITIONS "H5_BUILT_AS_DYNAMIC_LIB" - INTERFACE_INCLUDE_DIRECTORIES "$/include>" - INTERFACE_COMPILE_DEFINITIONS H5_BUILT_AS_DYNAMIC_LIB=1 ) endif () @@ -115,56 +114,48 @@ if (BUILD_SHARED_LIBS) endif () add_library (${HDF5_F90_TEST_LIB_TARGET} STATIC ${HDF5_F90_TF_SOURCES}) -TARGET_FORTRAN_PROPERTIES (${HDF5_F90_TEST_LIB_TARGET} STATIC " " " ") -target_link_libraries (${HDF5_F90_TEST_LIB_TARGET} +target_include_directories (${HDF5_F90_TEST_LIB_TARGET} + PRIVATE "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static" + INTERFACE "$/include>" +) +target_compile_definitions(${HDF5_F90_TEST_LIB_TARGET} + PRIVATE $<$:"HDF5F90_WINDOWS"> +) +TARGET_FORTRAN_PROPERTIES (${HDF5_F90_TEST_LIB_TARGET} STATIC) +target_link_libraries (${HDF5_F90_TEST_LIB_TARGET} PUBLIC ${HDF5_F90_C_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} ) H5_SET_LIB_OPTIONS (${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_TEST_LIB_NAME} STATIC 0) -target_include_directories (${HDF5_F90_TEST_LIB_TARGET} PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/static) -set_property(TARGET ${HDF5_F90_TEST_LIB_TARGET} APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared") set_target_properties (${HDF5_F90_TEST_LIB_TARGET} PROPERTIES FOLDER libraries/test/fortran LINKER_LANGUAGE Fortran - INTERFACE_INCLUDE_DIRECTORIES "$/include>" Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static ) -if (WIN32) - set_property (TARGET ${HDF5_F90_TEST_LIB_TARGET} APPEND PROPERTY - COMPILE_DEFINITIONS "HDF5F90_WINDOWS" - ) -endif () add_dependencies(${HDF5_F90_TEST_LIB_TARGET} H5testgen) if (BUILD_SHARED_LIBS) add_library (${HDF5_F90_TEST_LIBSH_TARGET} SHARED ${HDF5_F90_TF_SOURCES_SHARED}) - set (SHARED_LINK_FLAGS " ") - if (WIN32 AND MSVC) - set (SHARED_LINK_FLAGS "/DLL") - endif () - TARGET_FORTRAN_PROPERTIES (${HDF5_F90_TEST_LIBSH_TARGET} SHARED " " ${SHARED_LINK_FLAGS}) + target_include_directories (${HDF5_F90_TEST_LIBSH_TARGET} + PRIVATE "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared" + INTERFACE "$/include>" + ) + target_compile_definitions(${HDF5_F90_TEST_LIBSH_TARGET} + PUBLIC "H5_BUILT_AS_DYNAMIC_LIB" + PRIVATE $<$:"BUILD_HDF5_TEST_DLL;HDF5F90_WINDOWS"> + ) + TARGET_FORTRAN_PROPERTIES (${HDF5_F90_TEST_LIBSH_TARGET} SHARED) target_link_libraries (${HDF5_F90_TEST_LIBSH_TARGET} - ${HDF5_F90_C_TEST_LIBSH_TARGET} - ${HDF5_F90_LIBSH_TARGET} - ${HDF5_LIBSH_TARGET} + PUBLIC ${HDF5_F90_C_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} + INTERFACE $<$:"/DLL"> ) H5_SET_LIB_OPTIONS (${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_TEST_LIB_NAME} SHARED "F") - target_include_directories (${HDF5_F90_TEST_LIBSH_TARGET} PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/shared) - set_property(TARGET ${HDF5_F90_TEST_LIBSH_TARGET} APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared") set_target_properties (${HDF5_F90_TEST_LIBSH_TARGET} PROPERTIES FOLDER libraries/test/fortran LINKER_LANGUAGE Fortran - COMPILE_DEFINITIONS "H5_BUILT_AS_DYNAMIC_LIB" - INTERFACE_INCLUDE_DIRECTORIES "$/include>" - INTERFACE_COMPILE_DEFINITIONS H5_BUILT_AS_DYNAMIC_LIB=1 Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared ) - if (WIN32) - set_property (TARGET ${HDF5_F90_TEST_LIBSH_TARGET} APPEND PROPERTY - COMPILE_DEFINITIONS "BUILD_HDF5_TEST_DLL;HDF5F90_WINDOWS" - ) - endif () add_dependencies(${HDF5_F90_TEST_LIBSH_TARGET} H5testgenSH) endif () @@ -190,17 +181,14 @@ add_executable (testhdf5_fortran tH5Z.F90 tHDF5.F90 ) -TARGET_FORTRAN_PROPERTIES (testhdf5_fortran STATIC " " " ") -target_link_libraries (testhdf5_fortran +target_include_directories (testhdf5_fortran PRIVATE "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static") +TARGET_FORTRAN_PROPERTIES (testhdf5_fortran STATIC) +target_link_libraries (testhdf5_fortran PRIVATE ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} + $<$:ws2_32.lib> ) -if (WIN32 AND MSVC) - target_link_libraries (testhdf5_fortran "ws2_32.lib") -endif () -target_include_directories (testhdf5_fortran PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/static) -set_property(TARGET testhdf5_fortran APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static") set_target_properties (testhdf5_fortran PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran @@ -226,17 +214,14 @@ if (BUILD_SHARED_LIBS) tH5Z.F90 tHDF5.F90 ) - TARGET_FORTRAN_PROPERTIES (testhdf5_fortran-shared SHARED " " " ") - target_link_libraries (testhdf5_fortran-shared + target_include_directories (testhdf5_fortran-shared PRIVATE "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared") + TARGET_FORTRAN_PROPERTIES (testhdf5_fortran-shared SHARED) + target_link_libraries (testhdf5_fortran-shared PRIVATE ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} + $<$:ws2_32.lib> ) - if (WIN32 AND MSVC) - target_link_libraries (testhdf5_fortran-shared "ws2_32.lib") - endif () - target_include_directories (testhdf5_fortran-shared PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/shared) - set_property(TARGET testhdf5_fortran-shared APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared") set_target_properties (testhdf5_fortran-shared PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran @@ -254,17 +239,14 @@ add_executable (testhdf5_fortran_1_8 tH5MISC_1_8.F90 tHDF5_1_8.F90 ) -TARGET_FORTRAN_PROPERTIES (testhdf5_fortran_1_8 STATIC " " " ") -target_link_libraries (testhdf5_fortran_1_8 +target_include_directories (testhdf5_fortran_1_8 PRIVATE "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static") +TARGET_FORTRAN_PROPERTIES (testhdf5_fortran_1_8 STATIC) +target_link_libraries (testhdf5_fortran_1_8 PRIVATE ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} + $<$:ws2_32.lib> ) -if (WIN32 AND MSVC) - target_link_libraries (testhdf5_fortran_1_8 "ws2_32.lib") -endif () -target_include_directories (testhdf5_fortran_1_8 PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/static) -set_property(TARGET testhdf5_fortran_1_8 APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static") set_target_properties (testhdf5_fortran_1_8 PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran @@ -281,17 +263,14 @@ if (BUILD_SHARED_LIBS) tH5MISC_1_8.F90 tHDF5_1_8.F90 ) - TARGET_FORTRAN_PROPERTIES (testhdf5_fortran_1_8-shared SHARED " " " ") - target_link_libraries (testhdf5_fortran_1_8-shared + target_include_directories (testhdf5_fortran_1_8-shared PRIVATE "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared") + TARGET_FORTRAN_PROPERTIES (testhdf5_fortran_1_8-shared SHARED) + target_link_libraries (testhdf5_fortran_1_8-shared PRIVATE ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} + $<$:ws2_32.lib> ) - if (WIN32 AND MSVC) - target_link_libraries (testhdf5_fortran_1_8-shared "ws2_32.lib") - endif () - target_include_directories (testhdf5_fortran_1_8-shared PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/shared) - set_property(TARGET testhdf5_fortran_1_8-shared APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared") set_target_properties (testhdf5_fortran_1_8-shared PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran @@ -311,17 +290,14 @@ add_executable (fortranlib_test_F03 tH5T_F03.F90 tHDF5_F03.F90 ) -TARGET_FORTRAN_PROPERTIES (fortranlib_test_F03 STATIC " " " ") -target_link_libraries (fortranlib_test_F03 +target_include_directories (fortranlib_test_F03 PRIVATE "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static") +TARGET_FORTRAN_PROPERTIES (fortranlib_test_F03 STATIC) +target_link_libraries (fortranlib_test_F03 PRIVATE ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} + $<$:ws2_32.lib> ) -if (WIN32 AND MSVC) - target_link_libraries (fortranlib_test_F03 "ws2_32.lib") -endif () -target_include_directories (fortranlib_test_F03 PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/static) -set_property(TARGET fortranlib_test_F03 APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static") set_target_properties (fortranlib_test_F03 PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran @@ -340,18 +316,14 @@ if (BUILD_SHARED_LIBS) tH5T_F03.F90 tHDF5_F03.F90 ) - TARGET_FORTRAN_PROPERTIES (fortranlib_test_F03-shared SHARED " " " ") - target_link_libraries (fortranlib_test_F03-shared + target_include_directories (fortranlib_test_F03-shared PRIVATE "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared") + TARGET_FORTRAN_PROPERTIES (fortranlib_test_F03-shared SHARED) + target_link_libraries (fortranlib_test_F03-shared PRIVATE ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} + $<$:ws2_32.lib> ) - if (WIN32 AND MSVC) - target_link_libraries (fortranlib_test_F03-shared "ws2_32.lib") - endif () - - target_include_directories (fortranlib_test_F03-shared PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/shared) - set_property(TARGET fortranlib_test_F03-shared APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared") set_target_properties (fortranlib_test_F03-shared PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran @@ -362,16 +334,14 @@ endif () #-- Adding test for fflush1 add_executable (fflush1 fflush1.F90) -TARGET_FORTRAN_PROPERTIES (fflush1 STATIC " " " ") -target_link_libraries (fflush1 +target_include_directories (fflush1 PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/static) +TARGET_FORTRAN_PROPERTIES (fflush1 STATIC) +target_link_libraries (fflush1 PRIVATE ${HDF5_F90_LIB_TARGET} ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_LIB_TARGET} + $<$:ws2_32.lib> ) -if (WIN32 AND MSVC) - target_link_libraries (fflush1 "ws2_32.lib") -endif () -target_include_directories (fflush1 PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/static) set_target_properties (fflush1 PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran @@ -381,16 +351,14 @@ add_dependencies (fflush1 ${HDF5_F90_TEST_LIB_TARGET}) if (BUILD_SHARED_LIBS) add_executable (fflush1-shared fflush1.F90) - TARGET_FORTRAN_PROPERTIES (fflush1-shared SHARED " " " ") - target_link_libraries (fflush1-shared + target_include_directories (fflush1-shared PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/shared) + TARGET_FORTRAN_PROPERTIES (fflush1-shared SHARED) + target_link_libraries (fflush1-shared PRIVATE ${HDF5_F90_LIBSH_TARGET} ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} + $<$:ws2_32.lib> ) - if (WIN32 AND MSVC) - target_link_libraries (fflush1-shared "ws2_32.lib") - endif () - target_include_directories (fflush1-shared PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/shared) set_target_properties (fflush1-shared PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran @@ -401,16 +369,14 @@ endif () #-- Adding test for fflush2 add_executable (fflush2 fflush2.F90) -TARGET_FORTRAN_PROPERTIES (fflush2 STATIC " " " ") -target_link_libraries (fflush2 +target_include_directories (fflush2 PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/static) +TARGET_FORTRAN_PROPERTIES (fflush2 STATIC) +target_link_libraries (fflush2 PRIVATE ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} + $<$:ws2_32.lib> ) -if (WIN32 AND MSVC) - target_link_libraries (fflush2 "ws2_32.lib") -endif () -target_include_directories (fflush2 PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/static) set_target_properties (fflush2 PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran @@ -420,16 +386,14 @@ add_dependencies (fflush2 ${HDF5_F90_TEST_LIB_TARGET}) if (BUILD_SHARED_LIBS) add_executable (fflush2-shared fflush2.F90) - TARGET_FORTRAN_PROPERTIES (fflush2-shared SHARED " " " ") - target_link_libraries (fflush2-shared + target_include_directories (fflush2-shared PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/shared) + TARGET_FORTRAN_PROPERTIES (fflush2-shared SHARED) + target_link_libraries (fflush2-shared PRIVATE ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} + $<$:ws2_32.lib> ) - if (WIN32 AND MSVC) - target_link_libraries (fflush2-shared "ws2_32.lib") - endif () - target_include_directories (fflush2-shared PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/shared) set_target_properties (fflush2-shared PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran diff --git a/fortran/testpar/CMakeLists.txt b/fortran/testpar/CMakeLists.txt index fe5827d..a6984b7 100644 --- a/fortran/testpar/CMakeLists.txt +++ b/fortran/testpar/CMakeLists.txt @@ -16,7 +16,7 @@ add_executable (parallel_test hyper.f90 mdset.f90 ) -TARGET_FORTRAN_PROPERTIES (parallel_test STATIC " " " ") +TARGET_FORTRAN_PROPERTIES (parallel_test STATIC) target_link_libraries (parallel_test ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} diff --git a/hl/c++/examples/CMakeLists.txt b/hl/c++/examples/CMakeLists.txt index 1760d71..e66aa81 100644 --- a/hl/c++/examples/CMakeLists.txt +++ b/hl/c++/examples/CMakeLists.txt @@ -5,10 +5,9 @@ project (HDF5_HL_CPP_EXAMPLES CXX) # Add in the examples for the Packet Table codes # -------------------------------------------------------------------- add_executable (ptExampleFL ${HDF5_HL_CPP_EXAMPLES_SOURCE_DIR}/ptExampleFL.cpp) -set_property(TARGET ptExampleFL APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") -TARGET_C_PROPERTIES (ptExampleFL STATIC " " " ") -target_link_libraries ( - ptExampleFL +target_include_directories(ptExampleFL PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") +TARGET_C_PROPERTIES (ptExampleFL STATIC) +target_link_libraries (ptExampleFL PRIVATE ${HDF5_HL_CPP_LIB_TARGET} ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET} diff --git a/hl/c++/src/CMakeLists.txt b/hl/c++/src/CMakeLists.txt index 10a0c1e..8e6de0c 100644 --- a/hl/c++/src/CMakeLists.txt +++ b/hl/c++/src/CMakeLists.txt @@ -9,30 +9,31 @@ set (HDF5_HL_CPP_SOURCES ${HDF5_HL_CPP_SRC_SOURCE_DIR}/H5PacketTable.cpp) set (HDF5_HL_CPP_HDRS ${HDF5_HL_CPP_SRC_SOURCE_DIR}/H5PacketTable.h) add_library (${HDF5_HL_CPP_LIB_TARGET} STATIC ${HDF5_HL_CPP_SOURCES}) -set_property(TARGET ${HDF5_HL_CPP_LIB_TARGET} APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") -TARGET_C_PROPERTIES (${HDF5_HL_CPP_LIB_TARGET} STATIC " " " ") +target_include_directories(${HDF5_HL_CPP_LIB_TARGET} + PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}" + INTERFACE "$/include>" +) +TARGET_C_PROPERTIES (${HDF5_HL_CPP_LIB_TARGET} STATIC) target_link_libraries (${HDF5_HL_CPP_LIB_TARGET} PUBLIC ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET}) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_CPP_LIB_TARGET}") H5_SET_LIB_OPTIONS (${HDF5_HL_CPP_LIB_TARGET} ${HDF5_HL_CPP_LIB_NAME} STATIC 0) -set_target_properties (${HDF5_HL_CPP_LIB_TARGET} PROPERTIES - FOLDER libraries/hl - INTERFACE_INCLUDE_DIRECTORIES "$/include>" -) +set_target_properties (${HDF5_HL_CPP_LIB_TARGET} PROPERTIES FOLDER libraries/hl) set (install_targets ${HDF5_HL_CPP_LIB_TARGET}) if (BUILD_SHARED_LIBS) add_library (${HDF5_HL_CPP_LIBSH_TARGET} SHARED ${HDF5_HL_CPP_SOURCES}) - set_property(TARGET ${HDF5_HL_CPP_LIBSH_TARGET} APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") - TARGET_C_PROPERTIES (${HDF5_HL_CPP_LIBSH_TARGET} SHARED " " " ") + target_include_directories(${HDF5_HL_CPP_LIBSH_TARGET} + PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}" + INTERFACE "$/include>" + ) + target_compile_definitions(${HDF5_HL_CPP_LIBSH_TARGET} + PUBLIC "H5_BUILT_AS_DYNAMIC_LIB" + ) + TARGET_C_PROPERTIES (${HDF5_HL_CPP_LIBSH_TARGET} SHARED) target_link_libraries (${HDF5_HL_CPP_LIBSH_TARGET} PUBLIC ${HDF5_HL_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_CPP_LIBSH_TARGET}") H5_SET_LIB_OPTIONS (${HDF5_HL_CPP_LIBSH_TARGET} ${HDF5_HL_CPP_LIB_NAME} SHARED "HL_CXX") - set_target_properties (${HDF5_HL_CPP_LIBSH_TARGET} PROPERTIES - FOLDER libraries/hl - COMPILE_DEFINITIONS "H5_BUILT_AS_DYNAMIC_LIB" - INTERFACE_INCLUDE_DIRECTORIES "$/include>" - INTERFACE_COMPILE_DEFINITIONS H5_BUILT_AS_DYNAMIC_LIB=1 - ) + set_target_properties (${HDF5_HL_CPP_LIBSH_TARGET} PROPERTIES FOLDER libraries/hl) set (install_targets ${install_targets} ${HDF5_HL_CPP_LIBSH_TARGET}) endif () diff --git a/hl/c++/test/CMakeLists.txt b/hl/c++/test/CMakeLists.txt index 710e218..3b5384a 100644 --- a/hl/c++/test/CMakeLists.txt +++ b/hl/c++/test/CMakeLists.txt @@ -2,10 +2,9 @@ cmake_minimum_required (VERSION 3.10) project (HDF5_HL_CPP_TEST CXX) add_executable (hl_ptableTest ${HDF5_HL_CPP_TEST_SOURCE_DIR}/ptableTest.cpp) -set_property(TARGET hl_ptableTest APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_HL_SRC_DIR}/test;${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") -TARGET_C_PROPERTIES (hl_ptableTest STATIC " " " ") -target_link_libraries ( - hl_ptableTest +target_include_directories(hl_ptableTest PRIVATE "${HDF5_HL_SRC_DIR}/test;${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") +TARGET_C_PROPERTIES (hl_ptableTest STATIC) +target_link_libraries (hl_ptableTest PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET} ${HDF5_CPP_LIB_TARGET} diff --git a/hl/examples/CMakeLists.txt b/hl/examples/CMakeLists.txt index 79250e6..2f9019d 100644 --- a/hl/examples/CMakeLists.txt +++ b/hl/examples/CMakeLists.txt @@ -28,9 +28,9 @@ set (examples foreach (example ${examples}) add_executable (hl_ex_${example} ${HDF5_HL_EXAMPLES_SOURCE_DIR}/${example}.c) - set_property(TARGET hl_ex_${example} APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") - TARGET_C_PROPERTIES (hl_ex_${example} STATIC " " " ") - target_link_libraries (hl_ex_${example} ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET}) + target_include_directories(hl_ex_${example} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") + TARGET_C_PROPERTIES (hl_ex_${example} STATIC) + target_link_libraries (hl_ex_${example} PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (hl_ex_${example} PROPERTIES FOLDER examples/hl) endforeach () diff --git a/hl/fortran/examples/CMakeLists.txt b/hl/fortran/examples/CMakeLists.txt index af92efc..db047d0 100644 --- a/hl/fortran/examples/CMakeLists.txt +++ b/hl/fortran/examples/CMakeLists.txt @@ -8,14 +8,15 @@ set (examples foreach (example ${examples}) add_executable (hl_f90_ex_${example} ${HDF5_HL_F90_EXAMPLES_SOURCE_DIR}/${example}.f90) - TARGET_FORTRAN_PROPERTIES (hl_f90_ex_${example} STATIC " " " ") - target_link_libraries (hl_f90_ex_${example} + target_include_directories (hl_f90_ex_${example} PRIVATE + "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src" + ) + TARGET_FORTRAN_PROPERTIES (hl_f90_ex_${example} STATIC) + target_link_libraries (hl_f90_ex_${example} PRIVATE ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} ) - target_include_directories (hl_f90_ex_${example} PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/static) - set_property(TARGET hl_f90_ex_${example} APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src") set_target_properties (hl_f90_ex_${example} PROPERTIES LINKER_LANGUAGE Fortran) set_target_properties (hl_f90_ex_${example} PROPERTIES FOLDER examples/hl/fortran) diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt index 41adb6e..6e808c3 100644 --- a/hl/fortran/src/CMakeLists.txt +++ b/hl/fortran/src/CMakeLists.txt @@ -15,21 +15,13 @@ endif () # Generate the H5LT and H5TB REAL APIs #----------------------------------------------------------------------------- -add_executable (H5HL_buildiface - ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5HL_buildiface.F90 - ) +add_executable (H5HL_buildiface ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5HL_buildiface.F90 ) target_include_directories(H5HL_buildiface PRIVATE "${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR}") if (WIN32 AND MSVC) if (BUILD_SHARED_LIBS) - set_target_properties (H5HL_buildiface - PROPERTIES - COMPILE_FLAGS "/MT" - ) + set_target_properties (H5HL_buildiface PROPERTIES COMPILE_FLAGS "/MT") endif () - set_target_properties (H5HL_buildiface - PROPERTIES - LINK_FLAGS "/SUBSYSTEM:CONSOLE" - ) + set_target_properties (H5HL_buildiface PROPERTIES LINK_FLAGS "/SUBSYSTEM:CONSOLE") endif () set_target_properties (H5HL_buildiface PROPERTIES LINKER_LANGUAGE Fortran @@ -58,33 +50,36 @@ set_source_files_properties (${HDF5_HL_F90_C_SOURCES} PROPERTIES LANGUAGE C) set (HDF5_HL_F90_HEADERS ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5LTf90proto.h) add_library (${HDF5_HL_F90_C_LIB_TARGET} STATIC ${HDF5_HL_F90_C_SOURCES} ${HDF5_HL_F90_HEADERS}) -target_include_directories(${HDF5_HL_F90_C_LIB_TARGET} PUBLIC "${HDF5_F90_BINARY_DIR}/static") -set_property(TARGET ${HDF5_HL_F90_C_LIB_TARGET} APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") -TARGET_C_PROPERTIES (${HDF5_HL_F90_C_LIB_TARGET} STATIC " " " ") +target_include_directories(${HDF5_HL_F90_C_LIB_TARGET} + PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static" + INTERFACE "$/include>" +) +TARGET_C_PROPERTIES (${HDF5_HL_F90_C_LIB_TARGET} STATIC) target_link_libraries (${HDF5_HL_F90_C_LIB_TARGET} PUBLIC ${HDF5_F90_C_LIB_TARGET} ${HDF5_HL_LIB_TARGET}) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_F90_C_LIB_TARGET}") H5_SET_LIB_OPTIONS (${HDF5_HL_F90_C_LIB_TARGET} ${HDF5_HL_F90_C_LIB_NAME} STATIC 0) set_target_properties (${HDF5_HL_F90_C_LIB_TARGET} PROPERTIES FOLDER libraries/hl/fortran LINKER_LANGUAGE C - INTERFACE_INCLUDE_DIRECTORIES "$/include>" ) set (install_targets ${HDF5_HL_F90_C_LIB_TARGET}) if (BUILD_SHARED_LIBS) add_library (${HDF5_HL_F90_C_LIBSH_TARGET} SHARED ${HDF5_HL_F90_C_SOURCES} ${HDF5_HL_F90_HEADERS}) - target_include_directories(${HDF5_HL_F90_C_LIBSH_TARGET} PUBLIC "${HDF5_F90_BINARY_DIR}/shared") - set_property(TARGET ${HDF5_HL_F90_C_LIBSH_TARGET} APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") - TARGET_C_PROPERTIES (${HDF5_HL_F90_C_LIBSH_TARGET} SHARED " " " ") + target_include_directories(${HDF5_HL_F90_C_LIBSH_TARGET} + PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared" + INTERFACE "$/include>" + ) + target_compile_definitions(${HDF5_LIBSH_TARGET} + PUBLIC "H5_BUILT_AS_DYNAMIC_LIB" + ) + TARGET_C_PROPERTIES (${HDF5_HL_F90_C_LIBSH_TARGET} SHARED) target_link_libraries (${HDF5_HL_F90_C_LIBSH_TARGET} PUBLIC ${HDF5_F90_C_LIBSH_TARGET} ${HDF5_HL_LIBSH_TARGET}) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_F90_C_LIBSH_TARGET}") H5_SET_LIB_OPTIONS (${HDF5_HL_F90_C_LIBSH_TARGET} ${HDF5_HL_F90_C_LIB_NAME} SHARED "HL_F") set_target_properties (${HDF5_HL_F90_C_LIBSH_TARGET} PROPERTIES FOLDER libraries/hl/fortran LINKER_LANGUAGE C - COMPILE_DEFINITIONS "H5_BUILT_AS_DYNAMIC_LIB" - INTERFACE_INCLUDE_DIRECTORIES "$/include>" - INTERFACE_COMPILE_DEFINITIONS H5_BUILT_AS_DYNAMIC_LIB=1 ) set (install_targets ${install_targets} ${HDF5_HL_F90_C_LIBSH_TARGET}) endif () @@ -153,58 +148,50 @@ if (BUILD_SHARED_LIBS) endif () add_library (${HDF5_HL_F90_LIB_TARGET} STATIC ${HDF5_HL_F90_F_SOURCES}) -TARGET_FORTRAN_PROPERTIES (${HDF5_HL_F90_LIB_TARGET} STATIC " " " ") -target_link_libraries (${HDF5_HL_F90_LIB_TARGET} PUBLIC ${HDF5_HL_F90_C_LIB_TARGET} ${HDF5_F90_LIB_TARGET}) -target_include_directories (${HDF5_HL_F90_LIB_TARGET} PUBLIC "${CMAKE_Fortran_MODULE_DIRECTORY}/static") -if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) - target_include_directories (${HDF5_HL_F90_LIB_TARGET} PUBLIC ${MPI_Fortran_INCLUDE_DIRS}) -endif () -set_property(TARGET ${HDF5_HL_F90_LIB_TARGET} APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_F90_BINARY_DIR}") +target_include_directories (${HDF5_HL_F90_LIB_TARGET} + PRIVATE "${HDF5_F90_BINARY_DIR};${CMAKE_Fortran_MODULE_DIRECTORY}/static;$<$:${MPI_Fortran_INCLUDE_DIRS}>" + INTERFACE "$/include>" +) +target_compile_definitions(${HDF5_LIBSH_TARGET} + PUBLIC $<$:"HDF5F90_WINDOWS"> +) +TARGET_FORTRAN_PROPERTIES (${HDF5_HL_F90_LIB_TARGET} STATIC) +target_link_libraries (${HDF5_HL_F90_LIB_TARGET} + PUBLIC ${HDF5_HL_F90_C_LIB_TARGET} ${HDF5_F90_LIB_TARGET} +) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_F90_LIB_TARGET}") H5_SET_LIB_OPTIONS (${HDF5_HL_F90_LIB_TARGET} ${HDF5_HL_F90_LIB_NAME} STATIC 0) set_target_properties (${HDF5_HL_F90_LIB_TARGET} PROPERTIES FOLDER libraries/hl/fortran LINKER_LANGUAGE Fortran - INTERFACE_INCLUDE_DIRECTORIES "$/include>" Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static ) -if (WIN32) - set_property (TARGET ${HDF5_HL_F90_LIB_TARGET} - APPEND PROPERTY COMPILE_DEFINITIONS "HDF5F90_WINDOWS" - ) -endif () set (install_targets ${install_targets} ${HDF5_HL_F90_LIB_TARGET}) add_dependencies(${HDF5_HL_F90_LIB_TARGET} H5HLgen) if (BUILD_SHARED_LIBS) add_library (${HDF5_HL_F90_LIBSH_TARGET} SHARED ${HDF5_HL_F90_F_SOURCES_SHARED}) - set (SHARED_LINK_FLAGS " ") - if (WIN32 AND MSVC) - set (SHARED_LINK_FLAGS "/DLL /DEF:${HDF5_HL_F90_SRC_BINARY_DIR}/hdf5_hl_fortrandll.def") - endif () - TARGET_FORTRAN_PROPERTIES (${HDF5_HL_F90_LIBSH_TARGET} SHARED " " ${SHARED_LINK_FLAGS}) - target_link_libraries (${HDF5_HL_F90_LIBSH_TARGET} PUBLIC ${HDF5_HL_F90_C_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET}) - target_link_libraries (${HDF5_HL_F90_LIBSH_TARGET} PRIVATE ${LINK_Fortran_LIBS}) - target_include_directories (${HDF5_HL_F90_LIBSH_TARGET} PUBLIC "${CMAKE_Fortran_MODULE_DIRECTORY}/shared") - set_property(TARGET ${HDF5_HL_F90_LIBSH_TARGET} APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_F90_BINARY_DIR}") - if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) - target_include_directories (${HDF5_HL_F90_LIBSH_TARGET} PUBLIC ${MPI_Fortran_INCLUDE_DIRS}) - endif () + target_include_directories (${HDF5_HL_F90_LIBSH_TARGET} + PRIVATE "${HDF5_F90_BINARY_DIR};${CMAKE_Fortran_MODULE_DIRECTORY}/shared;$<$:${MPI_Fortran_INCLUDE_DIRS}>" + INTERFACE "$/include>" + ) + target_compile_definitions(${HDF5_LIBSH_TARGET} + PRIVATE $<$:"BUILD_HDF5_HL_DLL;HDF5F90_WINDOWS"> + PUBLIC "H5_BUILT_AS_DYNAMIC_LIB" + ) + TARGET_FORTRAN_PROPERTIES (${HDF5_HL_F90_LIBSH_TARGET} SHARED) + target_link_libraries (${HDF5_HL_F90_LIBSH_TARGET} + PUBLIC ${HDF5_HL_F90_C_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} + PRIVATE ${LINK_Fortran_LIBS} + INTERFACE $<$:"/DLL /DEF:${HDF5_HL_F90_SRC_BINARY_DIR}/hdf5_hl_fortrandll.def"> + ) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_F90_LIBSH_TARGET}") H5_SET_LIB_OPTIONS (${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_HL_F90_LIB_NAME} SHARED "HL_F") set_target_properties (${HDF5_HL_F90_LIBSH_TARGET} PROPERTIES FOLDER libraries/hl/fortran LINKER_LANGUAGE Fortran - COMPILE_DEFINITIONS "H5_BUILT_AS_DYNAMIC_LIB" - INTERFACE_INCLUDE_DIRECTORIES "$/include>" - INTERFACE_COMPILE_DEFINITIONS H5_BUILT_AS_DYNAMIC_LIB=1 Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared ) - if (WIN32) - set_property (TARGET ${HDF5_HL_F90_LIBSH_TARGET} - APPEND PROPERTY COMPILE_DEFINITIONS "BUILD_HDF5_HL_DLL;HDF5F90_WINDOWS" - ) - endif () set (install_targets ${install_targets} ${HDF5_HL_F90_LIBSH_TARGET}) add_dependencies(${HDF5_HL_F90_LIBSH_TARGET} H5HLgenSH) endif () diff --git a/hl/fortran/test/CMakeLists.txt b/hl/fortran/test/CMakeLists.txt index e82bb2b..d5aac56 100644 --- a/hl/fortran/test/CMakeLists.txt +++ b/hl/fortran/test/CMakeLists.txt @@ -7,18 +7,16 @@ project (HDF5_HL_FORTRAN_TESTS C Fortran) #-- Adding test for hl_f90_tstds add_executable (hl_f90_tstds tstds.F90) -TARGET_FORTRAN_PROPERTIES (hl_f90_tstds STATIC " " " ") -target_link_libraries (hl_f90_tstds ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET}) -target_include_directories (hl_f90_tstds PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/static) -set_property(TARGET hl_f90_tstds APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src") +target_include_directories (hl_f90_tstds PRIVATE "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src") +TARGET_FORTRAN_PROPERTIES (hl_f90_tstds STATIC) +target_link_libraries (hl_f90_tstds PRIVATE ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET}) set_target_properties (hl_f90_tstds PROPERTIES LINKER_LANGUAGE Fortran) set_target_properties (hl_f90_tstds PROPERTIES FOLDER test/hl/fortran) if (BUILD_SHARED_LIBS) add_executable (hl_f90_tstds-shared tstds.F90) - TARGET_FORTRAN_PROPERTIES (hl_f90_tstds-shared SHARED " " " ") - target_link_libraries (hl_f90_tstds-shared ${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET}) - target_include_directories (hl_f90_tstds-shared PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/shared) - set_property(TARGET hl_f90_tstds-shared APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src") + target_include_directories (hl_f90_tstds-shared PRIVATE "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src") + TARGET_FORTRAN_PROPERTIES (hl_f90_tstds-shared SHARED) + target_link_libraries (hl_f90_tstds-shared PRIVATE ${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET}) set_target_properties (hl_f90_tstds-shared PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/hl/fortran @@ -28,18 +26,16 @@ endif () #-- Adding test for hl_f90_tstlite add_executable (hl_f90_tstlite tstlite.F90) -TARGET_FORTRAN_PROPERTIES (hl_f90_tstlite STATIC " " " ") -target_link_libraries (hl_f90_tstlite ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_F90_TEST_LIB_TARGET}) -target_include_directories (hl_f90_tstlite PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/static) -set_property(TARGET hl_f90_tstlite APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src") +target_include_directories (hl_f90_tstlite PRIVATE "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src") +TARGET_FORTRAN_PROPERTIES (hl_f90_tstlite STATIC) +target_link_libraries (hl_f90_tstlite PRIVATE ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_F90_TEST_LIB_TARGET}) set_target_properties (hl_f90_tstlite PROPERTIES LINKER_LANGUAGE Fortran) set_target_properties (hl_f90_tstlite PROPERTIES FOLDER test/hl/fortran) if (BUILD_SHARED_LIBS) add_executable (hl_f90_tstlite-shared tstlite.F90) - TARGET_FORTRAN_PROPERTIES (hl_f90_tstlite-shared SHARED " " " ") - target_link_libraries (hl_f90_tstlite-shared ${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_F90_TEST_LIBSH_TARGET}) - target_include_directories (hl_f90_tstlite-shared PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/shared) - set_property(TARGET hl_f90_tstlite-shared APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src") + target_include_directories (hl_f90_tstlite-shared PRIVATE "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src") + TARGET_FORTRAN_PROPERTIES (hl_f90_tstlite-shared SHARED) + target_link_libraries (hl_f90_tstlite-shared PRIVATE ${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_F90_TEST_LIBSH_TARGET}) set_target_properties (hl_f90_tstlite-shared PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/hl/fortran @@ -49,18 +45,16 @@ endif () #-- Adding test for hl_f90_tstimage add_executable (hl_f90_tstimage tstimage.F90) -TARGET_FORTRAN_PROPERTIES (hl_f90_tstimage STATIC " " " ") -target_link_libraries (hl_f90_tstimage ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET}) -target_include_directories (hl_f90_tstimage PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/static) -set_property(TARGET hl_f90_tstimage APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src") +target_include_directories (hl_f90_tstimage PRIVATE "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src") +TARGET_FORTRAN_PROPERTIES (hl_f90_tstimage STATIC) +target_link_libraries (hl_f90_tstimage PRIVATE ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET}) set_target_properties (hl_f90_tstimage PROPERTIES LINKER_LANGUAGE Fortran) set_target_properties (hl_f90_tstimage PROPERTIES FOLDER test/hl/fortran) if (BUILD_SHARED_LIBS) add_executable (hl_f90_tstimage-shared tstimage.F90) - TARGET_FORTRAN_PROPERTIES (hl_f90_tstimage-shared SHARED " " " ") - target_link_libraries (hl_f90_tstimage-shared ${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET}) - target_include_directories (hl_f90_tstimage-shared PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/shared) - set_property(TARGET hl_f90_tstimage-shared APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src") + target_include_directories (hl_f90_tstimage-shared PRIVATE "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src") + TARGET_FORTRAN_PROPERTIES (hl_f90_tstimage-shared SHARED) + target_link_libraries (hl_f90_tstimage-shared PRIVATE ${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET}) set_target_properties (hl_f90_tstimage-shared PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/hl/fortran @@ -70,18 +64,16 @@ endif () #-- Adding test for hl_f90_tsttable add_executable (hl_f90_tsttable tsttable.F90) -TARGET_FORTRAN_PROPERTIES (hl_f90_tsttable STATIC " " " ") -target_link_libraries (hl_f90_tsttable ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_F90_TEST_LIB_TARGET}) -target_include_directories (hl_f90_tsttable PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/static) -set_property(TARGET hl_f90_tsttable APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src") +target_include_directories (hl_f90_tsttable PRIVATE "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src") +TARGET_FORTRAN_PROPERTIES (hl_f90_tsttable STATIC) +target_link_libraries (hl_f90_tsttable PRIVATE ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_F90_TEST_LIB_TARGET}) set_target_properties (hl_f90_tsttable PROPERTIES LINKER_LANGUAGE Fortran) set_target_properties (hl_f90_tsttable PROPERTIES FOLDER test/hl/fortran) if (BUILD_SHARED_LIBS) add_executable (hl_f90_tsttable-shared tsttable.F90) - TARGET_FORTRAN_PROPERTIES (hl_f90_tsttable-shared SHARED " " " ") - target_link_libraries (hl_f90_tsttable-shared ${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_F90_TEST_LIBSH_TARGET}) - target_include_directories (hl_f90_tsttable-shared PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/shared) - set_property(TARGET hl_f90_tsttable-shared APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src") + target_include_directories (hl_f90_tsttable-shared PRIVATE "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src") + TARGET_FORTRAN_PROPERTIES (hl_f90_tsttable-shared SHARED) + target_link_libraries (hl_f90_tsttable-shared PRIVATE ${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_F90_TEST_LIBSH_TARGET}) set_target_properties (hl_f90_tsttable-shared PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/hl/fortran diff --git a/hl/src/CMakeLists.txt b/hl/src/CMakeLists.txt index bec40ec..aa33e59 100644 --- a/hl/src/CMakeLists.txt +++ b/hl/src/CMakeLists.txt @@ -30,29 +30,30 @@ set (HL_HEADERS ) add_library (${HDF5_HL_LIB_TARGET} STATIC ${HL_SOURCES} ${HL_HEADERS}) -set_property(TARGET ${HDF5_HL_LIB_TARGET} APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") -TARGET_C_PROPERTIES (${HDF5_HL_LIB_TARGET} STATIC " " " ") +target_include_directories(${HDF5_HL_LIB_TARGET} + PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}" + INTERFACE "$/include>" +) +TARGET_C_PROPERTIES (${HDF5_HL_LIB_TARGET} STATIC) target_link_libraries (${HDF5_HL_LIB_TARGET} PUBLIC ${HDF5_LIB_TARGET}) H5_SET_LIB_OPTIONS (${HDF5_HL_LIB_TARGET} ${HDF5_HL_LIB_NAME} STATIC 0) -set_target_properties (${HDF5_HL_LIB_TARGET} PROPERTIES - FOLDER libraries/hl - INTERFACE_INCLUDE_DIRECTORIES "$/include>" -) +set_target_properties (${HDF5_HL_LIB_TARGET} PROPERTIES FOLDER libraries/hl) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_LIB_TARGET}") set (install_targets ${HDF5_HL_LIB_TARGET}) if (BUILD_SHARED_LIBS) add_library (${HDF5_HL_LIBSH_TARGET} SHARED ${HL_SOURCES} ${HL_HEADERS}) - set_property(TARGET ${HDF5_HL_LIBSH_TARGET} APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") - TARGET_C_PROPERTIES (${HDF5_HL_LIBSH_TARGET} SHARED " " " ") + target_include_directories(${HDF5_HL_LIBSH_TARGET} + PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}" + INTERFACE "$/include>" + ) + target_compile_definitions(${HDF5_HL_LIBSH_TARGET} + PUBLIC "H5_BUILT_AS_DYNAMIC_LIB" + ) + TARGET_C_PROPERTIES (${HDF5_HL_LIBSH_TARGET} SHARED) target_link_libraries (${HDF5_HL_LIBSH_TARGET} PUBLIC ${HDF5_LIBSH_TARGET}) H5_SET_LIB_OPTIONS (${HDF5_HL_LIBSH_TARGET} ${HDF5_HL_LIB_NAME} SHARED "HL") - set_target_properties (${HDF5_HL_LIBSH_TARGET} PROPERTIES - FOLDER libraries/hl - COMPILE_DEFINITIONS "H5_BUILT_AS_DYNAMIC_LIB" - INTERFACE_INCLUDE_DIRECTORIES "$/include>" - INTERFACE_COMPILE_DEFINITIONS H5_BUILT_AS_DYNAMIC_LIB=1 - ) + set_target_properties (${HDF5_HL_LIBSH_TARGET} PROPERTIES FOLDER libraries/hl) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_LIBSH_TARGET}") set (install_targets ${install_targets} ${HDF5_HL_LIBSH_TARGET}) endif () diff --git a/hl/test/CMakeLists.txt b/hl/test/CMakeLists.txt index 0acb2f4..7911d1b 100644 --- a/hl/test/CMakeLists.txt +++ b/hl/test/CMakeLists.txt @@ -19,9 +19,9 @@ configure_file (${HDF5_HL_TEST_SOURCE_DIR}/H5srcdir_str.h.in H5srcdir_str.h @ON # -------------------------------------------------------------------- MACRO (HL_ADD_EXE hl_name) add_executable (hl_${hl_name} ${hl_name}.c) - set_property(TARGET hl_${hl_name} APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") - TARGET_C_PROPERTIES (hl_${hl_name} STATIC " " " ") - target_link_libraries (hl_${hl_name} + target_include_directories(hl_${hl_name} PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") + TARGET_C_PROPERTIES (hl_${hl_name} STATIC) + target_link_libraries (hl_${hl_name} PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET} @@ -31,9 +31,9 @@ ENDMACRO () MACRO (HL_ADD_SHEXE hl_name) add_executable (hl_${hl_name} ${hl_name}.c) - set_property(TARGET hl_${hl_name} APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") - TARGET_C_PROPERTIES (hl_${hl_name} SHARED " " " ") - target_link_libraries (hl_${hl_name} + target_include_directories(hl_${hl_name} PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") + TARGET_C_PROPERTIES (hl_${hl_name} SHARED) + target_link_libraries (hl_${hl_name} PRIVATE ${HDF5_HL_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} @@ -52,9 +52,9 @@ HL_ADD_EXE (test_dset_append) # test_packet has two source files add_executable (hl_test_packet test_packet.c test_packet_vlen.c) -set_property(TARGET hl_test_packet APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") -TARGET_C_PROPERTIES (hl_test_packet STATIC " " " ") -target_link_libraries (hl_test_packet +target_include_directories(hl_test_packet PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") +TARGET_C_PROPERTIES (hl_test_packet STATIC) +target_link_libraries (hl_test_packet PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET} @@ -67,9 +67,9 @@ set_target_properties (hl_test_packet PROPERTIES FOLDER test/hl) # -------------------------------------------------------------------- if (HDF5_BUILD_GENERATORS) add_executable (hl_gen_test_ds gen_test_ds.c) - set_property(TARGET hl_gen_test_ds APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") - TARGET_C_PROPERTIES (hl_gen_test_ds STATIC " " " ") - target_link_libraries (hl_gen_test_ds + target_include_directories(hl_gen_test_ds PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") + TARGET_C_PROPERTIES (hl_gen_test_ds STATIC) + target_link_libraries (hl_gen_test_ds PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET} @@ -77,9 +77,9 @@ if (HDF5_BUILD_GENERATORS) set_target_properties (hl_gen_test_ds PROPERTIES FOLDER test/hl/gen) add_executable (hl_gen_test_ld gen_test_ld.c) - set_property(TARGET hl_gen_test_ld APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") - TARGET_C_PROPERTIES (hl_gen_test_ld STATIC " " " ") - target_link_libraries (hl_gen_test_ld + target_include_directories(hl_gen_test_ld PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") + TARGET_C_PROPERTIES (hl_gen_test_ld STATIC) + target_link_libraries (hl_gen_test_ld PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET} diff --git a/hl/tools/gif2h5/CMakeLists.txt b/hl/tools/gif2h5/CMakeLists.txt index 977d78c..1d0e87c 100644 --- a/hl/tools/gif2h5/CMakeLists.txt +++ b/hl/tools/gif2h5/CMakeLists.txt @@ -15,9 +15,9 @@ set (GIF2H5_SOURCES #-- Add gif2hdf5 program add_executable (gif2h5 ${GIF2H5_SOURCES}) -set_property(TARGET gif2h5 APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") -TARGET_C_PROPERTIES (gif2h5 STATIC " " " ") -target_link_libraries (gif2h5 ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) +target_include_directories(gif2h5 PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") +TARGET_C_PROPERTIES (gif2h5 STATIC) +target_link_libraries (gif2h5 PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) set_target_properties (gif2h5 PROPERTIES FOLDER tools/hl) set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};gif2h5") @@ -27,9 +27,9 @@ set (hdf2gif_SOURCES ${HDF5_HL_TOOLS_GIF2H5_SOURCE_DIR}/hdfgifwr.c ) add_executable (h52gif ${hdf2gif_SOURCES}) -set_property(TARGET h52gif APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") -TARGET_C_PROPERTIES (h52gif STATIC " " " ") -target_link_libraries (h52gif ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) +target_include_directories(h52gif PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") +TARGET_C_PROPERTIES (h52gif STATIC) +target_link_libraries (h52gif PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) set_target_properties (h52gif PROPERTIES FOLDER tools/hl) set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h52gif") @@ -41,9 +41,9 @@ if (BUILD_TESTING) # -------------------------------------------------------------------- if (HDF5_BUILD_GENERATORS) add_executable (hl_h52gifgentest ${HDF5_HL_TOOLS_GIF2H5_SOURCE_DIR}/h52gifgentst.c) - set_property(TARGET hl_h52gifgentest APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") - TARGET_C_PROPERTIES (hl_h52gifgentest STATIC " " " ") - target_link_libraries (hl_h52gifgentest ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET}) + target_include_directories(hl_h52gifgentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") + TARGET_C_PROPERTIES (hl_h52gifgentest STATIC) + target_link_libraries (hl_h52gifgentest PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (hl_h52gifgentest PROPERTIES FOLDER generator/tools/hl) # add_test (NAME hl_h52gifgentest COMMAND $) diff --git a/hl/tools/h5watch/CMakeLists.txt b/hl/tools/h5watch/CMakeLists.txt index b3bd856..8ab1e41 100644 --- a/hl/tools/h5watch/CMakeLists.txt +++ b/hl/tools/h5watch/CMakeLists.txt @@ -10,9 +10,9 @@ set (H5WATCH_SOURCES #-- Add h5watch program add_executable (h5watch ${H5WATCH_SOURCES}) -set_property(TARGET h5watch APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") -TARGET_C_PROPERTIES (h5watch STATIC " " " ") -target_link_libraries (h5watch ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) +target_include_directories(h5watch PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") +TARGET_C_PROPERTIES (h5watch STATIC) +target_link_libraries (h5watch PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) set_target_properties (h5watch PROPERTIES FOLDER tools/hl) if (BUILD_TESTING) @@ -21,9 +21,9 @@ if (BUILD_TESTING) ${HDF5_HL_TOOLS_H5WATCH_SOURCE_DIR}/swmr_check_compat_vfd.c ) add_executable (hl_swmr_check_compat_vfd ${hl_swmr_check_compat_vfd_SOURCES}) - set_property(TARGET hl_swmr_check_compat_vfd APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") - TARGET_C_PROPERTIES (hl_swmr_check_compat_vfd STATIC " " " ") - target_link_libraries (hl_swmr_check_compat_vfd ${HDF5_LIB_TARGET}) + target_include_directories(hl_swmr_check_compat_vfd PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") + TARGET_C_PROPERTIES (hl_swmr_check_compat_vfd STATIC) + target_link_libraries (hl_swmr_check_compat_vfd PRIVATE ${HDF5_LIB_TARGET}) set_target_properties (hl_swmr_check_compat_vfd PROPERTIES FOLDER tools/hl) #-- Add extend_dset program @@ -31,15 +31,15 @@ if (BUILD_TESTING) ${HDF5_HL_TOOLS_H5WATCH_SOURCE_DIR}/extend_dset.c ) add_executable (extend_dset ${extend_dset_SOURCES}) - set_property(TARGET extend_dset APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_HL_SRC_DIR}/test;${HDF5_HL_SRC_DIR}/src;${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") - TARGET_C_PROPERTIES (extend_dset STATIC " " " ") - target_link_libraries (extend_dset ${HDF5_HL_LIB_TARGET} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) + target_include_directories(extend_dset PRIVATE "${HDF5_HL_SRC_DIR}/test;${HDF5_HL_SRC_DIR}/src;${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") + TARGET_C_PROPERTIES (extend_dset STATIC) + target_link_libraries (extend_dset PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) set_target_properties (extend_dset PROPERTIES FOLDER tools/hl) add_executable (h5watchgentest ${HDF5_HL_TOOLS_H5WATCH_SOURCE_DIR}/h5watchgentest.c) - set_property(TARGET h5watchgentest APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_HL_SRC_DIR}/src;${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") - TARGET_C_PROPERTIES (h5watchgentest STATIC " " " ") - target_link_libraries (h5watchgentest ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET}) + target_include_directories(h5watchgentest PRIVATE "${HDF5_HL_SRC_DIR}/src;${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") + TARGET_C_PROPERTIES (h5watchgentest STATIC) + target_link_libraries (h5watchgentest PRIVATE ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (h5watchgentest PROPERTIES FOLDER generator/tools/hl) include (CMakeTests.cmake) diff --git a/java/src/jni/CMakeLists.txt b/java/src/jni/CMakeLists.txt index dc9cc01..a0228e1 100644 --- a/java/src/jni/CMakeLists.txt +++ b/java/src/jni/CMakeLists.txt @@ -49,7 +49,7 @@ set (CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON) ########### JNI libraries always must be built shared ############### add_library (${HDF5_JAVA_JNI_LIB_TARGET} SHARED ${HDF5_JAVA_JNI_CSRCS} ${HDF5_JAVA_JNI_CHDRS}) target_include_directories(${HDF5_JAVA_JNI_LIB_TARGET} PRIVATE ${HDF5_BINARY_DIR} ${HDF5_JAVA_JNI_SOURCE_DIR}) -TARGET_C_PROPERTIES (${HDF5_JAVA_JNI_LIB_TARGET} SHARED " " " ") +TARGET_C_PROPERTIES (${HDF5_JAVA_JNI_LIB_TARGET} SHARED) target_link_libraries (${HDF5_JAVA_JNI_LIB_TARGET} PUBLIC ${HDF5_LIB_TARGET}) set_target_properties (${HDF5_JAVA_JNI_LIB_TARGET} PROPERTIES FOLDER libraries/jni) SET_GLOBAL_VARIABLE (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_JAVA_JNI_LIB_TARGET}") diff --git a/release_docs/USING_HDF5_CMake.txt b/release_docs/USING_HDF5_CMake.txt index 1c38c84..7d9a585 100644 --- a/release_docs/USING_HDF5_CMake.txt +++ b/release_docs/USING_HDF5_CMake.txt @@ -194,7 +194,7 @@ set (LINK_LIBS ${LINK_LIBS} ${HDF5_C_${LIB_TYPE}_LIBRARY}) set (example hdf_example) add_executable (${example} ${PROJECT_SOURCE_DIR}/${example}.c) -TARGET_C_PROPERTIES (${example} ${LIB_TYPE} " " " ") +TARGET_C_PROPERTIES (${example} PRIVATE ${LIB_TYPE}) target_link_libraries (${example} ${LINK_LIBS}) enable_testing () diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 435fe9a..4c47e17 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -2,11 +2,6 @@ cmake_minimum_required (VERSION 3.10) project (HDF5_SRC C) #----------------------------------------------------------------------------- -# Apply Definitions to compiler in this directory and below -#----------------------------------------------------------------------------- -add_definitions (${HDF_EXTRA_C_FLAGS}) - -#----------------------------------------------------------------------------- # List Source Files #----------------------------------------------------------------------------- set (H5_SOURCES @@ -859,13 +854,12 @@ endif () #----------------------------------------------------------------------------- add_executable (H5detect ${HDF5_SRC_DIR}/H5detect.c) target_include_directories(H5detect PRIVATE ${HDF5_BINARY_DIR}) -TARGET_C_PROPERTIES (H5detect STATIC " " " ") -if (MSVC OR MINGW) - target_link_libraries (H5detect "ws2_32.lib") -endif () -if (CMAKE_SYSTEM_NAME STREQUAL "Emscripten") - set_property(TARGET H5detect PROPERTY LINK_FLAGS "-O0") -endif () +target_compile_definitions(H5detect PUBLIC ${HDF_EXTRA_C_FLAGS} ${HDF_EXTRA_FLAGS}) +TARGET_C_PROPERTIES (H5detect STATIC) +target_link_libraries (H5detect + PRIVATE $<$:ws2_32.lib> + INTERFACE $<$:"-O0"> +) add_custom_command ( OUTPUT ${HDF5_BINARY_DIR}/H5Tinit.c @@ -876,13 +870,12 @@ add_custom_command ( add_executable (H5make_libsettings ${HDF5_SRC_DIR}/H5make_libsettings.c) target_include_directories(H5make_libsettings PRIVATE ${HDF5_BINARY_DIR}) -TARGET_C_PROPERTIES (H5make_libsettings STATIC " " " ") -if (MSVC OR MINGW) - target_link_libraries (H5make_libsettings "ws2_32.lib") -endif () -if (CMAKE_SYSTEM_NAME STREQUAL "Emscripten") - set_property(TARGET H5make_libsettings PROPERTY LINK_FLAGS "-O0") -endif () +target_compile_definitions(H5make_libsettings PUBLIC ${HDF_EXTRA_C_FLAGS} ${HDF_EXTRA_FLAGS}) +TARGET_C_PROPERTIES (H5make_libsettings STATIC) +target_link_libraries (H5make_libsettings + PRIVATE $<$:ws2_32.lib> + INTERFACE $<$:"-O0"> +) add_custom_command ( OUTPUT ${HDF5_BINARY_DIR}/H5lib_settings.c @@ -892,34 +885,38 @@ add_custom_command ( WORKING_DIRECTORY ${HDF5_BINARY_DIR} ) +## all_packages="AC,B,B2,D,F,FA,FL,FS,HL,I,O,S,ST,T,Z" +#all_packages="AC,B2,CX,D,F,HL,I,O,S,ST,T,Z" +option (HDF5_ENABLE_DEBUG_APIS "Turn on extra debug output in all packages" OFF) + #----------------------------------------------------------------------------- # Add H5Tinit source to build - generated by H5detect/CMake at configure time #----------------------------------------------------------------------------- set (gen_SRCS ${HDF5_BINARY_DIR}/H5Tinit.c ${HDF5_BINARY_DIR}/H5lib_settings.c) add_library (${HDF5_LIB_TARGET} STATIC ${common_SRCS} ${gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS}) -target_include_directories(${HDF5_LIB_TARGET} PUBLIC "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") -TARGET_C_PROPERTIES (${HDF5_LIB_TARGET} STATIC " " " ") -target_link_libraries (${HDF5_LIB_TARGET} PRIVATE ${LINK_LIBS} ${LINK_COMP_LIBS}) -if (NOT WIN32) - target_link_libraries (${HDF5_LIB_TARGET} PUBLIC ${CMAKE_DL_LIBS}) -endif () +target_include_directories(${HDF5_LIB_TARGET} + PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" + INTERFACE "$/include>" +) +target_compile_definitions(${HDF5_LIB_TARGET} + PUBLIC + ${HDF_EXTRA_C_FLAGS} + ${HDF_EXTRA_FLAGS} + $,DEBUG,NDEBUG> + PRIVATE + $<$:"H5_DEBUG_API"> # Enable tracing of the API + $<$:"H5Z_DEBUG;H5T_DEBUG;H5ST_DEBUG;H5S_DEBUG;H5O_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5F_DEBUG;H5D_DEBUG;H5B2_DEBUG;H5AC_DEBUG"> +) +TARGET_C_PROPERTIES (${HDF5_LIB_TARGET} STATIC) +target_link_libraries (${HDF5_LIB_TARGET} + PRIVATE ${LINK_LIBS} ${LINK_COMP_LIBS} $<$:${MPI_C_LIBRARIES}> + PUBLIC $<$>:${CMAKE_DL_LIBS}> +) set_global_variable (HDF5_LIBRARIES_TO_EXPORT ${HDF5_LIB_TARGET}) H5_SET_LIB_OPTIONS (${HDF5_LIB_TARGET} ${HDF5_LIB_NAME} STATIC 0) -set_target_properties (${HDF5_LIB_TARGET} PROPERTIES - FOLDER libraries - INTERFACE_INCLUDE_DIRECTORIES $/include> -) +set_target_properties (${HDF5_LIB_TARGET} PROPERTIES FOLDER libraries) -## all_packages="AC,B,B2,D,F,FA,FL,FS,HL,I,O,S,ST,T,Z" -#all_packages="AC,B2,CX,D,F,HL,I,O,S,ST,T,Z" -option (HDF5_ENABLE_DEBUG_APIS "Turn on extra debug output in all packages" OFF) -if (HDF5_ENABLE_DEBUG_APIS) - set_target_properties (${HDF5_LIB_TARGET} PROPERTIES - COMPILE_DEFINITIONS - "H5Z_DEBUG;H5T_DEBUG;H5ST_DEBUG;H5S_DEBUG;H5O_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5F_DEBUG;H5D_DEBUG;H5CX_DEBUG;H5B2_DEBUG;H5AC_DEBUG" - ) -endif () set (install_targets ${HDF5_LIB_TARGET}) if (BUILD_SHARED_LIBS) @@ -940,34 +937,30 @@ if (BUILD_SHARED_LIBS) ) set (shared_gen_SRCS ${HDF5_BINARY_DIR}/shared/H5Tinit.c ${HDF5_BINARY_DIR}/shared/H5lib_settings.c) add_library (${HDF5_LIBSH_TARGET} SHARED ${common_SRCS} ${shared_gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS}) - target_include_directories(${HDF5_LIBSH_TARGET} PUBLIC "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") - TARGET_C_PROPERTIES (${HDF5_LIBSH_TARGET} SHARED " " " ") - target_link_libraries (${HDF5_LIBSH_TARGET} PRIVATE ${LINK_LIBS} ${LINK_COMP_LIBS}) - if (NOT WIN32) - target_link_libraries (${HDF5_LIBSH_TARGET} PUBLIC ${CMAKE_DL_LIBS}) - endif () + target_include_directories(${HDF5_LIBSH_TARGET} + PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" + INTERFACE "$/include>" + ) + target_compile_definitions(${HDF5_LIBSH_TARGET} + PUBLIC + "H5_BUILT_AS_DYNAMIC_LIB" + ${HDF_EXTRA_C_FLAGS} + ${HDF_EXTRA_FLAGS} + $,DEBUG,NDEBUG> + PRIVATE + $<$:"H5_HAVE_THREADSAFE"> + $<$:"H5_DEBUG_API"> # Enable tracing of the API + $<$:"H5Z_DEBUG;H5T_DEBUG;H5ST_DEBUG;H5S_DEBUG;H5O_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5F_DEBUG;H5D_DEBUG;H5B2_DEBUG;H5AC_DEBUG"> + ) + TARGET_C_PROPERTIES (${HDF5_LIBSH_TARGET} SHARED) + target_link_libraries (${HDF5_LIBSH_TARGET} + PRIVATE ${LINK_LIBS} ${LINK_COMP_LIBS} $<$:${MPI_C_LIBRARIES}> + PUBLIC $<$>:${CMAKE_DL_LIBS}> $<$:Threads::Threads> + ) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_LIBSH_TARGET}") H5_SET_LIB_OPTIONS (${HDF5_LIBSH_TARGET} ${HDF5_LIB_NAME} SHARED "LIB") - set_target_properties (${HDF5_LIBSH_TARGET} PROPERTIES - FOLDER libraries - COMPILE_DEFINITIONS "H5_BUILT_AS_DYNAMIC_LIB" - INTERFACE_INCLUDE_DIRECTORIES "$/include>" - INTERFACE_COMPILE_DEFINITIONS H5_BUILT_AS_DYNAMIC_LIB=1 - ) - if (HDF5_ENABLE_THREADSAFE) - set_property (TARGET ${HDF5_LIBSH_TARGET} - APPEND PROPERTY COMPILE_DEFINITIONS - "H5_HAVE_THREADSAFE" - ) - target_link_libraries (${HDF5_LIBSH_TARGET} PUBLIC Threads::Threads) - endif () + set_target_properties (${HDF5_LIBSH_TARGET} PROPERTIES FOLDER libraries) - if (HDF5_ENABLE_DEBUG_APIS) - set_property (TARGET ${HDF5_LIBSH_TARGET} - APPEND PROPERTY COMPILE_DEFINITIONS - "H5Z_DEBUG;H5T_DEBUG;H5ST_DEBUG;H5S_DEBUG;H5O_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5F_DEBUG;H5D_DEBUG;H5B2_DEBUG;H5AC_DEBUG" - ) - endif () set (install_targets ${install_targets} ${HDF5_LIBSH_TARGET}) endif () diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 3756dc0..166fd99 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -2,11 +2,6 @@ cmake_minimum_required (VERSION 3.10) project (HDF5_TEST C) #----------------------------------------------------------------------------- -# Apply Definitions to compiler in this directory and below -#----------------------------------------------------------------------------- -add_definitions (${HDF_EXTRA_C_FLAGS}) - -#----------------------------------------------------------------------------- # Generate the H5srcdir_str.h file containing user settings needed by compilation #----------------------------------------------------------------------------- set (srcdir ${HDF5_TEST_SOURCE_DIR}) @@ -29,47 +24,39 @@ set (TEST_LIB_HEADERS ) add_library (${HDF5_TEST_LIB_TARGET} STATIC ${TEST_LIB_SOURCES} ${TEST_LIB_HEADERS}) -set_property(TARGET ${HDF5_TEST_LIB_TARGET} APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR}") -TARGET_C_PROPERTIES (${HDF5_TEST_LIB_TARGET} STATIC " " " ") -if (MSVC) - target_link_libraries (${HDF5_TEST_LIB_TARGET} PRIVATE "ws2_32.lib") -endif () +target_include_directories(${HDF5_TEST_LIB_TARGET} + PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR}" + INTERFACE "$/include>" +) +TARGET_C_PROPERTIES (${HDF5_TEST_LIB_TARGET} STATIC) +target_link_libraries (${HDF5_TEST_LIB_TARGET} + PUBLIC ${LINK_LIBS} ${HDF5_LIB_TARGET} + PRIVATE $<$:ws2_32.lib> +) if (MINGW) target_link_libraries (${HDF5_TEST_LIB_TARGET} PRIVATE "wsock32.lib") endif () -target_link_libraries (${HDF5_TEST_LIB_TARGET} PUBLIC ${LINK_LIBS}) -target_link_libraries (${HDF5_TEST_LIB_TARGET} PUBLIC ${HDF5_LIB_TARGET}) H5_SET_LIB_OPTIONS (${HDF5_TEST_LIB_TARGET} ${HDF5_TEST_LIB_NAME} STATIC 0) -set_target_properties (${HDF5_TEST_LIB_TARGET} PROPERTIES - FOLDER libraries/test - INTERFACE_INCLUDE_DIRECTORIES "$/include>" -) if (BUILD_SHARED_LIBS) add_library (${HDF5_TEST_LIBSH_TARGET} SHARED ${TEST_LIB_SOURCES} ${TEST_LIB_HEADERS}) - set_property(TARGET ${HDF5_TEST_LIBSH_TARGET} APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR}") - TARGET_C_PROPERTIES (${HDF5_TEST_LIBSH_TARGET} SHARED " " " ") - if (MSVC) - target_link_libraries (${HDF5_TEST_LIBSH_TARGET} PRIVATE "ws2_32.lib") - endif () + target_include_directories(${HDF5_TEST_LIBSH_TARGET} + PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR}" + INTERFACE "$/include>" + ) + target_compile_definitions(${HDF5_TEST_LIBSH_TARGET} + PUBLIC "H5_BUILT_AS_DYNAMIC_LIB" $<$:"H5_HAVE_THREADSAFE"> + ) + TARGET_C_PROPERTIES (${HDF5_TEST_LIBSH_TARGET} SHARED) + target_link_libraries (${HDF5_TEST_LIBSH_TARGET} + PUBLIC ${LINK_LIBS} ${HDF5_LIBSH_TARGET} + PRIVATE $<$:ws2_32.lib> + ) if (MINGW) target_link_libraries (${HDF5_TEST_LIBSH_TARGET} PRIVATE "wsock32.lib") endif () - target_link_libraries (${HDF5_TEST_LIBSH_TARGET} PUBLIC ${LINK_LIBS}) - target_link_libraries (${HDF5_TEST_LIBSH_TARGET} PUBLIC ${HDF5_LIBSH_TARGET}) H5_SET_LIB_OPTIONS (${HDF5_TEST_LIBSH_TARGET} ${HDF5_TEST_LIB_NAME} SHARED "LIB") - set_target_properties (${HDF5_TEST_LIBSH_TARGET} PROPERTIES - FOLDER libraries/test - COMPILE_DEFINITIONS "H5_BUILT_AS_DYNAMIC_LIB" - INTERFACE_INCLUDE_DIRECTORIES "$/include>" - INTERFACE_COMPILE_DEFINITIONS H5_BUILT_AS_DYNAMIC_LIB=1 - ) - if (HDF5_ENABLE_THREADSAFE) - set_property (TARGET ${HDF5_TEST_LIBSH_TARGET} - APPEND PROPERTY COMPILE_DEFINITIONS - "H5_HAVE_THREADSAFE" - ) - endif () + set_target_properties (${HDF5_TEST_LIBSH_TARGET} PROPERTIES FOLDER libraries/test) endif () ################################################################################# @@ -97,8 +84,8 @@ endif () set (HDF5_TEST_PLUGIN_TARGET ${HDF5_TEST_PLUGIN_CORENAME}) add_library (${HDF5_TEST_PLUGIN_TARGET} SHARED ${HDF5_TEST_SOURCE_DIR}/${plugin_name}.c) - set_property(TARGET ${HDF5_TEST_PLUGIN_TARGET} APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") - TARGET_C_PROPERTIES (${HDF5_TEST_PLUGIN_TARGET} SHARED " " " ") + target_include_directories(${HDF5_TEST_PLUGIN_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") + TARGET_C_PROPERTIES (${HDF5_TEST_PLUGIN_TARGET} SHARED) target_link_libraries (${HDF5_TEST_PLUGIN_TARGET} PUBLIC ${HDF5_TEST_LIB_TARGET}) H5_SET_LIB_OPTIONS (${HDF5_TEST_PLUGIN_TARGET} ${HDF5_TEST_PLUGIN_NAME} SHARED "LIB") set_target_properties (${HDF5_TEST_PLUGIN_TARGET} PROPERTIES FOLDER libraries/TEST_PLUGIN) @@ -122,8 +109,8 @@ endif () set (HDF5_TEST_PLUGIN_TARGET ${HDF5_TEST_PLUGIN_CORENAME}) add_library (${HDF5_TEST_PLUGIN_TARGET} SHARED ${HDF5_TEST_SOURCE_DIR}/${plugin_name}.c) - set_property(TARGET ${HDF5_TEST_PLUGIN_TARGET} APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") - TARGET_C_PROPERTIES (${HDF5_TEST_PLUGIN_TARGET} SHARED " " " ") + target_include_directories(${HDF5_TEST_PLUGIN_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") + TARGET_C_PROPERTIES (${HDF5_TEST_PLUGIN_TARGET} SHARED) target_link_libraries (${HDF5_TEST_PLUGIN_TARGET} PUBLIC ${HDF5_TEST_LIB_TARGET}) H5_SET_LIB_OPTIONS (${HDF5_TEST_PLUGIN_TARGET} ${HDF5_TEST_PLUGIN_NAME} SHARED "LIB") set_target_properties (${HDF5_TEST_PLUGIN_TARGET} PROPERTIES FOLDER libraries/TEST_PLUGIN) @@ -250,15 +237,15 @@ set (H5_TESTS macro (ADD_H5_EXE file) add_executable (${file} ${HDF5_TEST_SOURCE_DIR}/${file}.c) - set_property(TARGET ${file} APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR}") - TARGET_C_PROPERTIES (${file} STATIC " " " ") - target_link_libraries (${file} PUBLIC ${HDF5_TEST_LIB_TARGET}) + target_include_directories(${file} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR}") + TARGET_C_PROPERTIES (${file} STATIC) + target_link_libraries (${file} PRIVATE ${HDF5_TEST_LIB_TARGET}) set_target_properties (${file} PROPERTIES FOLDER test) if (BUILD_SHARED_LIBS) add_executable (${file}-shared ${HDF5_TEST_SOURCE_DIR}/${file}.c) - set_property(TARGET ${file}-shared APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR}") - TARGET_C_PROPERTIES (${file}-shared SHARED " " " ") - target_link_libraries (${file}-shared PUBLIC ${HDF5_TEST_LIBSH_TARGET}) + target_include_directories(${file}-shared PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR}") + TARGET_C_PROPERTIES (${file}-shared SHARED) + target_link_libraries (${file}-shared PRIVATE ${HDF5_TEST_LIBSH_TARGET}) set_target_properties (${file}-shared PROPERTIES FOLDER test) endif () endmacro () @@ -281,50 +268,44 @@ endforeach () #-- Adding test for testhdf5 add_executable (testhdf5 ${testhdf5_SOURCES}) -set_property(TARGET testhdf5 APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") -TARGET_C_PROPERTIES (testhdf5 STATIC " " " ") -target_link_libraries (testhdf5 ${HDF5_TEST_LIB_TARGET}) +target_include_directories(testhdf5 PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") +TARGET_C_PROPERTIES (testhdf5 STATIC) +target_link_libraries (testhdf5 PRIVATE ${HDF5_TEST_LIB_TARGET}) set_target_properties (testhdf5 PROPERTIES FOLDER test) if (BUILD_SHARED_LIBS) add_executable (testhdf5-shared ${testhdf5_SOURCES}) - set_property(TARGET testhdf5-shared APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") - TARGET_C_PROPERTIES (testhdf5-shared SHARED " " " ") - target_link_libraries (testhdf5-shared PUBLIC ${HDF5_TEST_LIBSH_TARGET}) + target_include_directories(testhdf5-shared PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") + TARGET_C_PROPERTIES (testhdf5-shared SHARED) + target_link_libraries (testhdf5-shared PRIVATE ${HDF5_TEST_LIBSH_TARGET}) set_target_properties (testhdf5-shared PROPERTIES FOLDER test) endif () #-- Adding test for cache_image add_executable (cache_image ${cache_image_SOURCES}) -set_property(TARGET cache_image APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") -TARGET_C_PROPERTIES (cache_image STATIC " " " ") -target_link_libraries (cache_image ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) +target_include_directories(cache_image PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") +TARGET_C_PROPERTIES (cache_image STATIC) +target_link_libraries (cache_image PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) set_target_properties (cache_image PROPERTIES FOLDER test) if (BUILD_SHARED_LIBS) add_executable (cache_image-shared ${cache_image_SOURCES}) - set_property(TARGET cache_image-shared APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") - TARGET_C_PROPERTIES (cache_image-shared SHARED " " " ") - target_link_libraries (cache_image-shared ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + target_include_directories(cache_image-shared PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") + TARGET_C_PROPERTIES (cache_image-shared SHARED) + target_link_libraries (cache_image-shared PRIVATE ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) set_target_properties (cache_image-shared PROPERTIES FOLDER test) endif () #-- Adding test for ttsafe add_executable (ttsafe ${ttsafe_SOURCES}) -set_property(TARGET ttsafe APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") -TARGET_C_PROPERTIES (ttsafe STATIC " " " ") -target_link_libraries (ttsafe ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) +target_include_directories(ttsafe PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") +TARGET_C_PROPERTIES (ttsafe STATIC) +target_link_libraries (ttsafe PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) set_target_properties (ttsafe PROPERTIES FOLDER test) if (BUILD_SHARED_LIBS) add_executable (ttsafe-shared ${ttsafe_SOURCES}) - set_property(TARGET ttsafe-shared APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") - TARGET_C_PROPERTIES (ttsafe-shared SHARED " " " ") - target_link_libraries (ttsafe-shared ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + target_include_directories(ttsafe-shared PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") + TARGET_C_PROPERTIES (ttsafe-shared SHARED) + target_link_libraries (ttsafe-shared PRIVATE ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) set_target_properties (ttsafe-shared PROPERTIES FOLDER test) - if (HDF5_ENABLE_THREADSAFE) - set_property (TARGET ttsafe-shared - APPEND PROPERTY COMPILE_DEFINITIONS - "H5_HAVE_THREADSAFE" - ) - endif () endif () ############################################################################## @@ -394,9 +375,9 @@ endforeach () # This has to be copied to the test directory for execve() to find it # and it can't be renamed (i.e., no -shared). add_executable (accum_swmr_reader ${HDF5_TEST_SOURCE_DIR}/accum_swmr_reader.c) -set_property(TARGET accum_swmr_reader APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") -TARGET_C_PROPERTIES (accum_swmr_reader STATIC " " " ") -target_link_libraries (accum_swmr_reader ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) +target_include_directories(accum_swmr_reader PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") +TARGET_C_PROPERTIES (accum_swmr_reader STATIC) +target_link_libraries (accum_swmr_reader PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) set_target_properties (accum_swmr_reader PROPERTIES FOLDER test) #-- Set accum dependencies @@ -410,15 +391,15 @@ endif () ############################################################################## if (BUILD_SHARED_LIBS) add_executable (filter_plugin ${HDF5_TEST_SOURCE_DIR}/filter_plugin.c) - set_property(TARGET filter_plugin APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") - TARGET_C_PROPERTIES (filter_plugin SHARED " " " ") - target_link_libraries (filter_plugin ${HDF5_TEST_LIB_TARGET}) + target_include_directories(filter_plugin PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") + TARGET_C_PROPERTIES (filter_plugin SHARED) + target_link_libraries (filter_plugin PRIVATE ${HDF5_TEST_LIB_TARGET}) set_target_properties (filter_plugin PROPERTIES FOLDER test) else () add_executable (filter_plugin ${HDF5_TEST_SOURCE_DIR}/filter_plugin.c) - set_property(TARGET filter_plugin APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") - TARGET_C_PROPERTIES (filter_plugin STATIC " " " ") - target_link_libraries (filter_plugin ${HDF5_TEST_LIB_TARGET}) + target_include_directories(filter_plugin PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") + TARGET_C_PROPERTIES (filter_plugin STATIC) + target_link_libraries (filter_plugin PRIVATE ${HDF5_TEST_LIB_TARGET}) set_target_properties (filter_plugin PROPERTIES FOLDER test) endif () @@ -427,43 +408,43 @@ endif () ############################################################################## set (use_append_chunk_SOURCES ${HDF5_TEST_SOURCE_DIR}/use_append_chunk.c ${HDF5_TEST_SOURCE_DIR}/use_common.c) add_executable (use_append_chunk ${use_append_chunk_SOURCES}) -set_property(TARGET use_append_chunk APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") -TARGET_C_PROPERTIES (use_append_chunk STATIC " " " ") -target_link_libraries (use_append_chunk ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) +target_include_directories(use_append_chunk PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") +TARGET_C_PROPERTIES (use_append_chunk STATIC) +target_link_libraries (use_append_chunk PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) set_target_properties (use_append_chunk PROPERTIES FOLDER test) if (BUILD_SHARED_LIBS) add_executable (use_append_chunk-shared ${use_append_chunk_SOURCES}) - set_property(TARGET use_append_chunk-shared APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") - TARGET_C_PROPERTIES (use_append_chunk-shared SHARED " " " ") - target_link_libraries (use_append_chunk-shared ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + target_include_directories(use_append_chunk-shared PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") + TARGET_C_PROPERTIES (use_append_chunk-shared SHARED) + target_link_libraries (use_append_chunk-shared PRIVATE ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) set_target_properties (use_append_chunk-shared PROPERTIES FOLDER test) endif () set (use_append_mchunks_SOURCES ${HDF5_TEST_SOURCE_DIR}/use_append_mchunks.c ${HDF5_TEST_SOURCE_DIR}/use_common.c) add_executable (use_append_mchunks ${use_append_mchunks_SOURCES}) -set_property(TARGET use_append_mchunks APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") -TARGET_C_PROPERTIES (use_append_mchunks STATIC " " " ") -target_link_libraries (use_append_mchunks ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) +target_include_directories(use_append_mchunks PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") +TARGET_C_PROPERTIES (use_append_mchunks STATIC) +target_link_libraries (use_append_mchunks PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) set_target_properties (use_append_mchunks PROPERTIES FOLDER test) if (BUILD_SHARED_LIBS) add_executable (use_append_mchunks-shared ${use_append_mchunks_SOURCES}) - set_property(TARGET use_append_mchunks-shared APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") - TARGET_C_PROPERTIES (use_append_mchunks-shared SHARED " " " ") - target_link_libraries (use_append_mchunks-shared ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + target_include_directories(use_append_mchunks-shared PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") + TARGET_C_PROPERTIES (use_append_mchunks-shared SHARED) + target_link_libraries (use_append_mchunks-shared PRIVATE ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) set_target_properties (use_append_mchunks-shared PROPERTIES FOLDER test) endif () set (use_disable_mdc_flushes_SOURCES ${HDF5_TEST_SOURCE_DIR}/use_disable_mdc_flushes.c) add_executable (use_disable_mdc_flushes ${use_disable_mdc_flushes_SOURCES}) -set_property(TARGET use_disable_mdc_flushes APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") -TARGET_C_PROPERTIES (use_disable_mdc_flushes STATIC " " " ") -target_link_libraries (use_disable_mdc_flushes ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) +target_include_directories(use_disable_mdc_flushes PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") +TARGET_C_PROPERTIES (use_disable_mdc_flushes STATIC) +target_link_libraries (use_disable_mdc_flushes PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) set_target_properties (use_disable_mdc_flushes PROPERTIES FOLDER test) if (BUILD_SHARED_LIBS) add_executable (use_disable_mdc_flushes-shared ${use_disable_mdc_flushes_SOURCES}) - set_property(TARGET use_disable_mdc_flushes-shared APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") - TARGET_C_PROPERTIES (use_disable_mdc_flushes-shared SHARED " " " ") - target_link_libraries (use_disable_mdc_flushes-shared ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + target_include_directories(use_disable_mdc_flushes-shared PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") + TARGET_C_PROPERTIES (use_disable_mdc_flushes-shared SHARED) + target_link_libraries (use_disable_mdc_flushes-shared PRIVATE ${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) set_target_properties (use_disable_mdc_flushes-shared PROPERTIES FOLDER test) endif () diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index 7b93311..b4b71e1 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -1008,9 +1008,9 @@ endif () if (HDF5_BUILD_GENERATORS) macro (ADD_H5_GENERATOR genfile) add_executable (${genfile} ${HDF5_TEST_SOURCE_DIR}/${genfile}.c) - set_property(TARGET ${genfile} APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") - TARGET_C_PROPERTIES (${genfile} STATIC " " " ") - target_link_libraries (${genfile} ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) + target_include_directories(${genfile} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") + TARGET_C_PROPERTIES (${genfile} STATIC) + target_link_libraries (${genfile} PRIVATE ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (${genfile} PROPERTIES FOLDER generator/test) endmacro () diff --git a/testpar/CMakeLists.txt b/testpar/CMakeLists.txt index 326c34f..e843811 100644 --- a/testpar/CMakeLists.txt +++ b/testpar/CMakeLists.txt @@ -2,11 +2,6 @@ cmake_minimum_required (VERSION 3.10) project (HDF5_TEST_PAR C) #----------------------------------------------------------------------------- -# Apply Definitions to compiler in this directory and below -#----------------------------------------------------------------------------- -add_definitions (${HDF_EXTRA_C_FLAGS}) - -#----------------------------------------------------------------------------- # Define Tests #----------------------------------------------------------------------------- @@ -26,22 +21,24 @@ set (testphdf5_SOURCES #-- Adding test for testhdf5 add_executable (testphdf5 ${testphdf5_SOURCES}) -set_property(TARGET testphdf5 APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") -TARGET_C_PROPERTIES (testphdf5 STATIC " " " ") -target_link_libraries (testphdf5 PUBLIC ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) -if (HDF5_ENABLE_PARALLEL AND MPI_C_FOUND) - target_link_libraries (testphdf5 PRIVATE ${MPI_C_LIBRARIES}) -endif () +target_include_directories(testphdf5 + PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" +) +TARGET_C_PROPERTIES (testphdf5 STATIC) +target_link_libraries (testphdf5 + PRIVATE ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET} $<$:${MPI_C_LIBRARIES}> +) set_target_properties (testphdf5 PROPERTIES FOLDER test/par) MACRO (ADD_H5P_EXE file) add_executable (${file} ${HDF5_TEST_PAR_SOURCE_DIR}/${file}.c) - set_property(TARGET ${file} APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") - TARGET_C_PROPERTIES (${file} STATIC " " " ") - target_link_libraries (${file} PUBLIC ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) - if (HDF5_ENABLE_PARALLEL AND MPI_C_FOUND) - target_link_libraries (${file} PRIVATE ${MPI_C_LIBRARIES}) - endif () + target_include_directories(${file} + PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" + ) + TARGET_C_PROPERTIES (${file} STATIC) + target_link_libraries (${file} + PRIVATE ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET} $<$:${MPI_C_LIBRARIES}> + ) set_target_properties (${file} PROPERTIES FOLDER test/par) ENDMACRO (ADD_H5P_EXE file) diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 1047138..7d41c8f 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -1,11 +1,6 @@ cmake_minimum_required (VERSION 3.10) project (HDF5_TOOLS C) -#----------------------------------------------------------------------------- -# Apply Definitions to compiler in this directory and below -#----------------------------------------------------------------------------- -add_definitions (${HDF_EXTRA_C_FLAGS}) - # -------------------------------------------------------------------- # If testing was NOT enabled, then we need to build the tools library # -------------------------------------------------------------------- diff --git a/tools/lib/CMakeLists.txt b/tools/lib/CMakeLists.txt index 090c8a4..32166bc 100644 --- a/tools/lib/CMakeLists.txt +++ b/tools/lib/CMakeLists.txt @@ -2,11 +2,6 @@ cmake_minimum_required (VERSION 3.10) project (HDF5_TOOLS_LIB C) #----------------------------------------------------------------------------- -# Apply Definitions to compiler in this directory and below -#----------------------------------------------------------------------------- -add_definitions (${HDF_EXTRA_C_FLAGS}) - -#----------------------------------------------------------------------------- # Define Sources #----------------------------------------------------------------------------- @@ -38,40 +33,39 @@ set (H5_TOOLS_LIB_HDRS ) add_library (${HDF5_TOOLS_LIB_TARGET} STATIC ${H5_TOOLS_LIB_SOURCES} ${H5_TOOLS_LIB_HDRS}) -target_include_directories(${HDF5_TOOLS_LIB_TARGET} INTERFACE "${HDF5_TOOLS_LIB_SOURCE_DIR}") -set_property(TARGET ${HDF5_TOOLS_LIB_TARGET} APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") -TARGET_C_PROPERTIES (${HDF5_TOOLS_LIB_TARGET} STATIC " " " ") -target_link_libraries (${HDF5_TOOLS_LIB_TARGET} PUBLIC ${HDF5_LIB_TARGET}) -if (HDF5_ENABLE_PARALLEL AND MPI_C_FOUND) - target_link_libraries (${HDF5_TOOLS_LIB_TARGET} PRIVATE ${MPI_C_LIBRARIES}) -endif () +target_include_directories(${HDF5_TOOLS_LIB_TARGET} + PRIVATE "${HDF5_TOOLS_LIB_SOURCE_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" + INTERFACE "$/include>" +) +#target_compile_definitions(${HDF5_TOOLS_LIB_TARGET} PRIVATE H5DIFF_DEBUG>) +TARGET_C_PROPERTIES (${HDF5_TOOLS_LIB_TARGET} STATIC) +target_link_libraries (${HDF5_TOOLS_LIB_TARGET} + PUBLIC ${HDF5_LIB_TARGET} + PRIVATE $<$:${MPI_C_LIBRARIES}> +) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_TOOLS_LIB_TARGET}") H5_SET_LIB_OPTIONS (${HDF5_TOOLS_LIB_TARGET} ${HDF5_TOOLS_LIB_NAME} STATIC 0) -set_target_properties (${HDF5_TOOLS_LIB_TARGET} PROPERTIES - FOLDER libraries/tools - INTERFACE_INCLUDE_DIRECTORIES "$/include>" -) -#set_property (TARGET ${HDF5_TOOLS_LIB_TARGET} APPEND PROPERTY COMPILE_DEFINITIONS H5DIFF_DEBUG) +set_target_properties (${HDF5_TOOLS_LIB_TARGET} PROPERTIES FOLDER libraries/tools) set (install_targets ${HDF5_TOOLS_LIB_TARGET}) if (BUILD_SHARED_LIBS) add_library (${HDF5_TOOLS_LIBSH_TARGET} SHARED ${H5_TOOLS_LIB_SOURCES} ${H5_TOOLS_LIB_HDRS}) - target_include_directories(${HDF5_TOOLS_LIBSH_TARGET} INTERFACE "${HDF5_TOOLS_LIB_SOURCE_DIR}") - set_property(TARGET ${HDF5_TOOLS_LIBSH_TARGET} APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") - TARGET_C_PROPERTIES (${HDF5_TOOLS_LIBSH_TARGET} SHARED " " " ") - target_link_libraries (${HDF5_TOOLS_LIBSH_TARGET} PUBLIC ${HDF5_LIBSH_TARGET}) - if (HDF5_ENABLE_PARALLEL AND MPI_C_FOUND) - target_link_libraries (${HDF5_TOOLS_LIBSH_TARGET} PRIVATE ${MPI_C_LIBRARIES}) - endif () + target_include_directories(${HDF5_TOOLS_LIBSH_TARGET} + PRIVATE "${HDF5_TOOLS_LIB_SOURCE_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" + INTERFACE "$/include>" + ) + target_compile_definitions(${HDF5_TOOLS_LIBSH_TARGET} + PUBLIC "H5_BUILT_AS_DYNAMIC_LIB" + #PRIVATE H5DIFF_DEBUG + ) + TARGET_C_PROPERTIES (${HDF5_TOOLS_LIBSH_TARGET} SHARED) + target_link_libraries (${HDF5_TOOLS_LIBSH_TARGET} + PUBLIC ${HDF5_LIBSH_TARGET} + PRIVATE $<$:${MPI_C_LIBRARIES}> + ) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_TOOLS_LIBSH_TARGET}") H5_SET_LIB_OPTIONS (${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_TOOLS_LIB_NAME} SHARED "TOOLS") - set_target_properties (${HDF5_TOOLS_LIBSH_TARGET} PROPERTIES - FOLDER libraries/tools - COMPILE_DEFINITIONS "H5_BUILT_AS_DYNAMIC_LIB" - INTERFACE_INCLUDE_DIRECTORIES "$/include>" - INTERFACE_COMPILE_DEFINITIONS H5_BUILT_AS_DYNAMIC_LIB=1 - ) - #set_property (TARGET ${HDF5_TOOLS_LIBSH_TARGET} APPEND PROPERTY COMPILE_DEFINITIONS H5DIFF_DEBUG) + set_target_properties (${HDF5_TOOLS_LIBSH_TARGET} PROPERTIES FOLDER libraries/tools) set (install_targets ${install_targets} ${HDF5_TOOLS_LIBSH_TARGET}) endif () diff --git a/tools/src/h5copy/CMakeLists.txt b/tools/src/h5copy/CMakeLists.txt index 9fe6a5f..500484e 100644 --- a/tools/src/h5copy/CMakeLists.txt +++ b/tools/src/h5copy/CMakeLists.txt @@ -5,9 +5,9 @@ project (HDF5_TOOLS_SRC_H5COPY C) # Add the h5copy and test executables # -------------------------------------------------------------------- add_executable (h5copy ${HDF5_TOOLS_SRC_H5COPY_SOURCE_DIR}/h5copy.c) -set_property(TARGET h5copy APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") -TARGET_C_PROPERTIES (h5copy STATIC " " " ") -target_link_libraries (h5copy ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) +target_include_directories(h5copy PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") +TARGET_C_PROPERTIES (h5copy STATIC) +target_link_libraries (h5copy PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (h5copy PROPERTIES FOLDER tools) set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5copy") @@ -15,9 +15,9 @@ set (H5_DEP_EXECUTABLES h5copy) if (BUILD_SHARED_LIBS) add_executable (h5copy-shared ${HDF5_TOOLS_SRC_H5COPY_SOURCE_DIR}/h5copy.c) - set_property(TARGET h5copy-shared APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") - TARGET_C_PROPERTIES (h5copy-shared SHARED " " " ") - target_link_libraries (h5copy-shared ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + target_include_directories(h5copy-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") + TARGET_C_PROPERTIES (h5copy-shared SHARED) + target_link_libraries (h5copy-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) set_target_properties (h5copy-shared PROPERTIES FOLDER tools) set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5copy-shared") diff --git a/tools/src/h5diff/CMakeLists.txt b/tools/src/h5diff/CMakeLists.txt index fd8ede3..3d9b3e0 100644 --- a/tools/src/h5diff/CMakeLists.txt +++ b/tools/src/h5diff/CMakeLists.txt @@ -8,9 +8,9 @@ add_executable (h5diff ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_common.c ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_main.c ) -set_property(TARGET h5diff APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") -TARGET_C_PROPERTIES (h5diff STATIC " " " ") -target_link_libraries (h5diff ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) +target_include_directories(h5diff PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") +TARGET_C_PROPERTIES (h5diff STATIC) +target_link_libraries (h5diff PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (h5diff PROPERTIES FOLDER tools) set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5diff") @@ -21,9 +21,9 @@ if (BUILD_SHARED_LIBS) ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_common.c ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_main.c ) - set_property(TARGET h5diff-shared APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") - TARGET_C_PROPERTIES (h5diff-shared SHARED " " " ") - target_link_libraries (h5diff-shared ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + target_include_directories(h5diff-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") + TARGET_C_PROPERTIES (h5diff-shared SHARED) + target_link_libraries (h5diff-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) set_target_properties (h5diff-shared PROPERTIES FOLDER tools) set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5diff-shared") @@ -35,9 +35,9 @@ if (H5_HAVE_PARALLEL) ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/h5diff_common.c ${HDF5_TOOLS_SRC_H5DIFF_SOURCE_DIR}/ph5diff_main.c ) - set_property(TARGET ph5diff APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") - TARGET_C_PROPERTIES (ph5diff STATIC " " " ") - target_link_libraries (ph5diff ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) + target_include_directories(ph5diff PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + TARGET_C_PROPERTIES (ph5diff STATIC) + target_link_libraries (ph5diff PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET} $<$:${MPI_C_LIBRARIES}>) set_target_properties (ph5diff PROPERTIES FOLDER tools) set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};ph5diff") endif () diff --git a/tools/src/h5dump/CMakeLists.txt b/tools/src/h5dump/CMakeLists.txt index 6f74ac6..1d15759 100644 --- a/tools/src/h5dump/CMakeLists.txt +++ b/tools/src/h5dump/CMakeLists.txt @@ -9,9 +9,9 @@ add_executable (h5dump ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_ddl.c ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_xml.c ) -set_property(TARGET h5dump APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") -TARGET_C_PROPERTIES (h5dump STATIC " " " ") -target_link_libraries (h5dump ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) +target_include_directories(h5dump PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") +TARGET_C_PROPERTIES (h5dump STATIC) +target_link_libraries (h5dump PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (h5dump PROPERTIES FOLDER tools) set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5dump") @@ -23,9 +23,9 @@ if (BUILD_SHARED_LIBS) ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_ddl.c ${HDF5_TOOLS_SRC_H5DUMP_SOURCE_DIR}/h5dump_xml.c ) - set_property(TARGET h5dump-shared APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") - TARGET_C_PROPERTIES (h5dump-shared SHARED " " " ") - target_link_libraries (h5dump-shared ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + target_include_directories(h5dump-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") + TARGET_C_PROPERTIES (h5dump-shared SHARED) + target_link_libraries (h5dump-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) set_target_properties (h5dump-shared PROPERTIES FOLDER tools) set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5dump-shared") diff --git a/tools/src/h5format_convert/CMakeLists.txt b/tools/src/h5format_convert/CMakeLists.txt index beebeac..914d05b 100644 --- a/tools/src/h5format_convert/CMakeLists.txt +++ b/tools/src/h5format_convert/CMakeLists.txt @@ -5,9 +5,9 @@ project (HDF5_TOOLS_SRC_H5FC C) # Add the h5format_convert executables # -------------------------------------------------------------------- add_executable (h5format_convert ${HDF5_TOOLS_SRC_H5FC_SOURCE_DIR}/h5format_convert.c) -set_property(TARGET h5format_convert APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") -TARGET_C_PROPERTIES (h5format_convert STATIC " " " ") -target_link_libraries (h5format_convert ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) +target_include_directories(h5format_convert PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") +TARGET_C_PROPERTIES (h5format_convert STATIC) +target_link_libraries (h5format_convert PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (h5format_convert PROPERTIES FOLDER tools) set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5format_convert") diff --git a/tools/src/h5import/CMakeLists.txt b/tools/src/h5import/CMakeLists.txt index d79c4f8..7874e33 100644 --- a/tools/src/h5import/CMakeLists.txt +++ b/tools/src/h5import/CMakeLists.txt @@ -5,9 +5,9 @@ project (HDF5_TOOLS_SRC_H5IMPORT C) # Add the h5import executables # -------------------------------------------------------------------- add_executable (h5import ${HDF5_TOOLS_SRC_H5IMPORT_SOURCE_DIR}/h5import.c) -set_property(TARGET h5import APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") -TARGET_C_PROPERTIES (h5import STATIC " " " ") -target_link_libraries (h5import ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) +target_include_directories(h5import PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") +TARGET_C_PROPERTIES (h5import STATIC) +target_link_libraries (h5import PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) #set_target_properties (h5import PROPERTIES COMPILE_DEFINITIONS H5DEBUGIMPORT) set_target_properties (h5import PROPERTIES FOLDER tools) set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5import") diff --git a/tools/src/h5jam/CMakeLists.txt b/tools/src/h5jam/CMakeLists.txt index c40405b..87062b6 100644 --- a/tools/src/h5jam/CMakeLists.txt +++ b/tools/src/h5jam/CMakeLists.txt @@ -5,16 +5,16 @@ project (HDF5_TOOLS_SRC_H5JAM C) # Add the h5jam executables # -------------------------------------------------------------------- add_executable (h5jam ${HDF5_TOOLS_SRC_H5JAM_SOURCE_DIR}/h5jam.c) -set_property(TARGET h5jam APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") -TARGET_C_PROPERTIES (h5jam STATIC " " " ") -target_link_libraries (h5jam ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) +target_include_directories(h5jam PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") +TARGET_C_PROPERTIES (h5jam STATIC) +target_link_libraries (h5jam PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (h5jam PROPERTIES FOLDER tools) set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5jam") add_executable (h5unjam ${HDF5_TOOLS_SRC_H5JAM_SOURCE_DIR}/h5unjam.c) -set_property(TARGET h5unjam APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") -TARGET_C_PROPERTIES (h5unjam STATIC " " " ") -target_link_libraries (h5unjam ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) +target_include_directories(h5unjam PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") +TARGET_C_PROPERTIES (h5unjam STATIC) +target_link_libraries (h5unjam PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (h5unjam PROPERTIES FOLDER tools) set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5unjam") diff --git a/tools/src/h5ls/CMakeLists.txt b/tools/src/h5ls/CMakeLists.txt index af3a552..d72b43e 100644 --- a/tools/src/h5ls/CMakeLists.txt +++ b/tools/src/h5ls/CMakeLists.txt @@ -5,9 +5,9 @@ project (HDF5_TOOLS_SRC_H5LS C) # Add the h5ls executable #----------------------------------------------------------------------------- add_executable (h5ls ${HDF5_TOOLS_SRC_H5LS_SOURCE_DIR}/h5ls.c) -set_property(TARGET h5ls APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") -TARGET_C_PROPERTIES (h5ls STATIC " " " ") -target_link_libraries (h5ls ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) +target_include_directories(h5ls PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") +TARGET_C_PROPERTIES (h5ls STATIC) +target_link_libraries (h5ls PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (h5ls PROPERTIES FOLDER tools) set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5ls") @@ -15,9 +15,9 @@ set (H5_DEP_EXECUTABLES h5ls) if (BUILD_SHARED_LIBS) add_executable (h5ls-shared ${HDF5_TOOLS_SRC_H5LS_SOURCE_DIR}/h5ls.c) - set_property(TARGET h5ls-shared APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") - TARGET_C_PROPERTIES (h5ls-shared SHARED " " " ") - target_link_libraries (h5ls-shared ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + target_include_directories(h5ls-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") + TARGET_C_PROPERTIES (h5ls-shared SHARED) + target_link_libraries (h5ls-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) set_target_properties (h5ls-shared PROPERTIES FOLDER tools) set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5ls-shared") diff --git a/tools/src/h5repack/CMakeLists.txt b/tools/src/h5repack/CMakeLists.txt index 631b426..e4faa37 100644 --- a/tools/src/h5repack/CMakeLists.txt +++ b/tools/src/h5repack/CMakeLists.txt @@ -15,9 +15,9 @@ set (REPACK_COMMON_SOURCES ) add_executable (h5repack ${REPACK_COMMON_SOURCES} ${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR}/h5repack_main.c) -set_property(TARGET h5repack APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") -TARGET_C_PROPERTIES (h5repack STATIC " " " ") -target_link_libraries (h5repack ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) +target_include_directories(h5repack PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") +TARGET_C_PROPERTIES (h5repack STATIC) +target_link_libraries (h5repack PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (h5repack PROPERTIES FOLDER tools) set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5repack") @@ -25,9 +25,9 @@ set (H5_DEP_EXECUTABLES h5repack) if (BUILD_SHARED_LIBS) add_executable (h5repack-shared ${REPACK_COMMON_SOURCES} ${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR}/h5repack_main.c) - set_property(TARGET h5repack-shared APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") - TARGET_C_PROPERTIES (h5repack-shared SHARED " " " ") - target_link_libraries (h5repack-shared ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + target_include_directories(h5repack-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") + TARGET_C_PROPERTIES (h5repack-shared SHARED) + target_link_libraries (h5repack-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) set_target_properties (h5repack-shared PROPERTIES FOLDER tools) set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5repack-shared") diff --git a/tools/src/h5stat/CMakeLists.txt b/tools/src/h5stat/CMakeLists.txt index 2f7e957..810d916 100644 --- a/tools/src/h5stat/CMakeLists.txt +++ b/tools/src/h5stat/CMakeLists.txt @@ -5,9 +5,9 @@ project (HDF5_TOOLS_SRC_H5STAT C) # Add the h5stat executables # -------------------------------------------------------------------- add_executable (h5stat ${HDF5_TOOLS_SRC_H5STAT_SOURCE_DIR}/h5stat.c) -set_property(TARGET h5stat APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") -TARGET_C_PROPERTIES (h5stat STATIC " " " ") -target_link_libraries (h5stat ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) +target_include_directories(h5stat PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") +TARGET_C_PROPERTIES (h5stat STATIC) +target_link_libraries (h5stat PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (h5stat PROPERTIES FOLDER tools) set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5stat") @@ -15,9 +15,9 @@ set (H5_DEP_EXECUTABLES h5stat) if (BUILD_SHARED_LIBS) add_executable (h5stat-shared ${HDF5_TOOLS_SRC_H5STAT_SOURCE_DIR}/h5stat.c) - set_property(TARGET h5stat-shared APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") - TARGET_C_PROPERTIES (h5stat-shared SHARED " " " ") - target_link_libraries (h5stat-shared ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) + target_include_directories(h5stat-shared PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") + TARGET_C_PROPERTIES (h5stat-shared SHARED) + target_link_libraries (h5stat-shared PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) set_target_properties (h5stat-shared PROPERTIES FOLDER tools) set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5stat-shared") diff --git a/tools/src/misc/CMakeLists.txt b/tools/src/misc/CMakeLists.txt index 021912e..45b38c1 100644 --- a/tools/src/misc/CMakeLists.txt +++ b/tools/src/misc/CMakeLists.txt @@ -6,30 +6,30 @@ project (HDF5_TOOLS_SRC_MISC C) # -------------------------------------------------------------------- #-- Misc Executables add_executable (h5debug ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5debug.c) -set_property(TARGET h5debug APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") -TARGET_C_PROPERTIES (h5debug STATIC " " " ") -target_link_libraries (h5debug ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) +target_include_directories(h5debug PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") +TARGET_C_PROPERTIES (h5debug STATIC) +target_link_libraries (h5debug PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) set_target_properties (h5debug PROPERTIES FOLDER tools) set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5debug") add_executable (h5repart ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5repart.c) -set_property(TARGET h5repart APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") -TARGET_C_PROPERTIES (h5repart STATIC " " " ") -target_link_libraries (h5repart ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) +target_include_directories(h5repart PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") +TARGET_C_PROPERTIES (h5repart STATIC) +target_link_libraries (h5repart PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) set_target_properties (h5repart PROPERTIES FOLDER tools) set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5repart") add_executable (h5mkgrp ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5mkgrp.c) -set_property(TARGET h5mkgrp APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") -TARGET_C_PROPERTIES (h5mkgrp STATIC " " " ") -target_link_libraries (h5mkgrp ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) +target_include_directories(h5mkgrp PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") +TARGET_C_PROPERTIES (h5mkgrp STATIC) +target_link_libraries (h5mkgrp PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (h5mkgrp PROPERTIES FOLDER tools) set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5mkgrp") add_executable (h5clear ${HDF5_TOOLS_SRC_MISC_SOURCE_DIR}/h5clear.c) -set_property(TARGET h5clear APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") -TARGET_C_PROPERTIES (h5clear STATIC " " " ") -target_link_libraries (h5clear ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) +target_include_directories(h5clear PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") +TARGET_C_PROPERTIES (h5clear STATIC) +target_link_libraries (h5clear PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (h5clear PROPERTIES FOLDER tools) set_global_variable (HDF5_UTILS_TO_EXPORT "${HDF5_UTILS_TO_EXPORT};h5clear") diff --git a/tools/test/h5copy/CMakeLists.txt b/tools/test/h5copy/CMakeLists.txt index 583f808..487d9dc 100644 --- a/tools/test/h5copy/CMakeLists.txt +++ b/tools/test/h5copy/CMakeLists.txt @@ -6,9 +6,9 @@ project (HDF5_TOOLS_TEST_H5COPY C) # -------------------------------------------------------------------- if (HDF5_BUILD_GENERATORS) add_executable (h5copygentest ${HDF5_TOOLS_TEST_H5COPY_SOURCE_DIR}/h5copygentest.c) - set_property(TARGET h5copygentest APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") - TARGET_C_PROPERTIES (h5copygentest STATIC " " " ") - target_link_libraries (h5copygentest ${HDF5_LIB_TARGET}) + target_include_directories(h5copygentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") + TARGET_C_PROPERTIES (h5copygentest STATIC) + target_link_libraries (h5copygentest PRIVATE ${HDF5_LIB_TARGET}) set_target_properties (h5copygentest PROPERTIES FOLDER generator/tools) #add_test (NAME h5copygentest COMMAND $) @@ -23,9 +23,9 @@ if (BUILD_SHARED_LIBS) set (HDF5_TOOL_PLUGIN_LIB_TARGET ${HDF5_TOOL_PLUGIN_LIB_CORENAME}) add_library (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_copy.c) - set_property(TARGET ${HDF5_TOOL_PLUGIN_LIB_TARGET} APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") - TARGET_C_PROPERTIES (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED " " " ") - target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) + target_include_directories(${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") + TARGET_C_PROPERTIES (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED) + target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIB_TARGET}) H5_SET_LIB_OPTIONS (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TOOL_PLUGIN_LIB_NAME} SHARED "LIB") # make plugins dir diff --git a/tools/test/h5diff/CMakeLists.txt b/tools/test/h5diff/CMakeLists.txt index edab48b..00be8fc 100644 --- a/tools/test/h5diff/CMakeLists.txt +++ b/tools/test/h5diff/CMakeLists.txt @@ -6,9 +6,9 @@ project (HDF5_TOOLS_TEST_H5DIFF C) # -------------------------------------------------------------------- if (HDF5_BUILD_GENERATORS) add_executable (h5diffgentest ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/h5diffgentest.c) - set_property(TARGET h5diffgentest APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") - TARGET_C_PROPERTIES (h5diffgentest STATIC " " " ") - target_link_libraries (h5diffgentest ${HDF5_LIB_TARGET}) + target_include_directories(h5diffgentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") + TARGET_C_PROPERTIES (h5diffgentest STATIC) + target_link_libraries (h5diffgentest PRIVATE ${HDF5_LIB_TARGET}) set_target_properties (h5diffgentest PROPERTIES FOLDER generator/tools) #add_test (NAME h5diffgentest COMMAND $) @@ -23,9 +23,9 @@ if (BUILD_SHARED_LIBS) set (HDF5_TOOL_PLUGIN_LIB_TARGET ${HDF5_TOOL_PLUGIN_LIB_CORENAME}) add_library (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_diff.c) - set_property(TARGET ${HDF5_TOOL_PLUGIN_LIB_TARGET} APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") - TARGET_C_PROPERTIES (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED " " " ") - target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) + target_include_directories(${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") + TARGET_C_PROPERTIES (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED) + target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIB_TARGET}) H5_SET_LIB_OPTIONS (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TOOL_PLUGIN_LIB_NAME} SHARED "LIB") # make plugins dir diff --git a/tools/test/h5dump/CMakeLists.txt b/tools/test/h5dump/CMakeLists.txt index b9f110f..d1d5412 100644 --- a/tools/test/h5dump/CMakeLists.txt +++ b/tools/test/h5dump/CMakeLists.txt @@ -9,9 +9,9 @@ set (HDF5_TOOL_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TO set (HDF5_TOOL_PLUGIN_LIB_TARGET ${HDF5_TOOL_PLUGIN_LIB_CORENAME}) add_library (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_dump.c) -set_property(TARGET ${HDF5_TOOL_PLUGIN_LIB_TARGET} APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") -TARGET_C_PROPERTIES (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED " " " ") -target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) +target_include_directories(${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") +TARGET_C_PROPERTIES (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED) +target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIB_TARGET}) H5_SET_LIB_OPTIONS (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TOOL_PLUGIN_LIB_NAME} SHARED "LIB") # make plugins dir @@ -33,9 +33,9 @@ add_custom_command ( # -------------------------------------------------------------------- if (HDF5_BUILD_GENERATORS) add_executable (h5dumpgentest ${HDF5_TOOLS_TEST_H5DUMP_SOURCE_DIR}/h5dumpgentest.c) - set_property(TARGET h5dumpgentest APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") - TARGET_C_PROPERTIES (h5dumpgentest STATIC " " " ") - target_link_libraries (h5dumpgentest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) + target_include_directories(h5dumpgentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") + TARGET_C_PROPERTIES (h5dumpgentest STATIC) + target_link_libraries (h5dumpgentest PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) set_target_properties (h5dumpgentest PROPERTIES FOLDER generator/tools) #add_test (NAME h5dumpgentest COMMAND $) diff --git a/tools/test/h5format_convert/CMakeLists.txt b/tools/test/h5format_convert/CMakeLists.txt index 37449f2..516b36b 100644 --- a/tools/test/h5format_convert/CMakeLists.txt +++ b/tools/test/h5format_convert/CMakeLists.txt @@ -5,16 +5,16 @@ project (HDF5_TOOLS_TEST_H5FC C) # Add the h5format_convert test executables # -------------------------------------------------------------------- add_executable (h5fc_chk_idx ${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/h5fc_chk_idx.c) -set_property(TARGET h5fc_chk_idx APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") -TARGET_C_PROPERTIES (h5fc_chk_idx STATIC " " " ") -target_link_libraries (h5fc_chk_idx ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) +target_include_directories(h5fc_chk_idx PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") +TARGET_C_PROPERTIES (h5fc_chk_idx STATIC) +target_link_libraries (h5fc_chk_idx PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) set_target_properties (h5fc_chk_idx PROPERTIES FOLDER tools) if (HDF5_BUILD_GENERATORS) add_executable (h5fc_gentest ${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/h5fc_gentest.c) - set_property(TARGET h5fc_gentest APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") - TARGET_C_PROPERTIES (h5fc_gentest STATIC " " " ") - target_link_libraries (h5fc_gentest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) + target_include_directories(h5fc_gentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") + TARGET_C_PROPERTIES (h5fc_gentest STATIC) + target_link_libraries (h5fc_gentest PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) set_target_properties (h5fc_gentest PROPERTIES FOLDER generator/tools) #add_test (NAME h5fc_gentest COMMAND $) diff --git a/tools/test/h5import/CMakeLists.txt b/tools/test/h5import/CMakeLists.txt index 37029c4..33fa181 100644 --- a/tools/test/h5import/CMakeLists.txt +++ b/tools/test/h5import/CMakeLists.txt @@ -5,9 +5,9 @@ project (HDF5_TOOLS_TEST_H5IMPORT C) # Add the h5import executables # -------------------------------------------------------------------- add_executable (h5importtest ${HDF5_TOOLS_TEST_H5IMPORT_SOURCE_DIR}/h5importtest.c) -set_property(TARGET h5importtest APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") -TARGET_C_PROPERTIES (h5importtest STATIC " " " ") -target_link_libraries (h5importtest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) +target_include_directories(h5importtest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") +TARGET_C_PROPERTIES (h5importtest STATIC) +target_link_libraries (h5importtest PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) set_target_properties (h5importtest PROPERTIES FOLDER tools) include (CMakeTests.cmake) diff --git a/tools/test/h5jam/CMakeLists.txt b/tools/test/h5jam/CMakeLists.txt index 2f01aa3..38713ba 100644 --- a/tools/test/h5jam/CMakeLists.txt +++ b/tools/test/h5jam/CMakeLists.txt @@ -6,24 +6,24 @@ project (HDF5_TOOLS_TEST_H5JAM C) # -------------------------------------------------------------------- if (HDF5_BUILD_GENERATORS) add_executable (h5jamgentest ${HDF5_TOOLS_TEST_H5JAM_SOURCE_DIR}/h5jamgentest.c) - set_property(TARGET h5jamgentest APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") - TARGET_C_PROPERTIES (testhdf5 STATIC " " " ") - target_link_libraries (h5jamgentest ${HDF5_LIB_TARGET}) + target_include_directories(h5jamgentest PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") + TARGET_C_PROPERTIES (h5jamgentest STATIC) + target_link_libraries (h5jamgentest PRIVATE ${HDF5_LIB_TARGET}) set_target_properties (h5jamgentest PROPERTIES FOLDER generator/tools) #add_test (NAME h5jamgentest COMMAND $) endif () add_executable (getub ${HDF5_TOOLS_TEST_H5JAM_SOURCE_DIR}/getub.c) -set_property(TARGET getub APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") -TARGET_C_PROPERTIES (getub STATIC " " " ") -target_link_libraries (getub ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) +target_include_directories(getub PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") +TARGET_C_PROPERTIES (getub STATIC) +target_link_libraries (getub PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (getub PROPERTIES FOLDER tools) add_executable (tellub ${HDF5_TOOLS_TEST_H5JAM_SOURCE_DIR}/tellub.c) -set_property(TARGET tellub APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") -TARGET_C_PROPERTIES (tellub STATIC " " " ") -target_link_libraries (tellub ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) +target_include_directories(tellub PRIVATE "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") +TARGET_C_PROPERTIES (tellub STATIC) +target_link_libraries (tellub PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (tellub PROPERTIES FOLDER tools) include (CMakeTests.cmake) diff --git a/tools/test/h5jam/h5jamgentest.c b/tools/test/h5jam/h5jamgentest.c index bd07fb4..1644440 100644 --- a/tools/test/h5jam/h5jamgentest.c +++ b/tools/test/h5jam/h5jamgentest.c @@ -270,10 +270,7 @@ gent_ub(const char * filename, size_t ub_size, size_t ub_fill) H5Fclose(fid); /* If a user block is being used, write to it here */ - if(ub_size > 0) - { - ssize_t nbytes; - + if(ub_size > 0) { HDassert(ub_size <= BUF_SIZE); fd = HDopen(filename, O_RDWR); @@ -285,8 +282,7 @@ gent_ub(const char * filename, size_t ub_size, size_t ub_fill) for (u = 0; u < ub_fill; u++) *bp++ = pattern[u % 10]; - nbytes = HDwrite(fd, buf, ub_size); - HDassert(nbytes >= 0); + HDwrite(fd, buf, ub_size); HDclose(fd); } @@ -299,7 +295,6 @@ create_textfile(const char *name, size_t size) int fd; size_t i; char *bp; - ssize_t nbytes; fd = HDcreat(name,0777); HDassert(fd >= 0); @@ -311,8 +306,7 @@ create_textfile(const char *name, size_t size) for(i = 0; i < size; i++) *bp++ = pattern[i % 10]; - nbytes = HDwrite(fd, buf, size); - HDassert(nbytes >= 0); + HDwrite(fd, buf, size); HDfree(buf); diff --git a/tools/test/h5ls/CMakeLists.txt b/tools/test/h5ls/CMakeLists.txt index 8da3f4d..d6f71eb 100644 --- a/tools/test/h5ls/CMakeLists.txt +++ b/tools/test/h5ls/CMakeLists.txt @@ -9,9 +9,9 @@ set (HDF5_TOOL_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TO set (HDF5_TOOL_PLUGIN_LIB_TARGET ${HDF5_TOOL_PLUGIN_LIB_CORENAME}) add_library (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_ls.c) -set_property(TARGET ${HDF5_TOOL_PLUGIN_LIB_TARGET} APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") -TARGET_C_PROPERTIES (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED " " " ") -target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) +target_include_directories(${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") +TARGET_C_PROPERTIES (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED) +target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIB_TARGET}) H5_SET_LIB_OPTIONS (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TOOL_PLUGIN_LIB_NAME} SHARED "LIB") # make plugins dir diff --git a/tools/test/h5repack/CMakeLists.txt b/tools/test/h5repack/CMakeLists.txt index 1381fd7..fa26e90 100644 --- a/tools/test/h5repack/CMakeLists.txt +++ b/tools/test/h5repack/CMakeLists.txt @@ -5,9 +5,9 @@ project (HDF5_TOOLS_TEST_H5REPACK C) # Add h5Repack test executables # -------------------------------------------------------------------- add_executable (testh5repack_detect_szip ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testh5repack_detect_szip.c) -set_property(TARGET testh5repack_detect_szip APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR};${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") -TARGET_C_PROPERTIES (testh5repack_detect_szip STATIC " " " ") -target_link_libraries (testh5repack_detect_szip ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) +target_include_directories(testh5repack_detect_szip PRIVATE "${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR};${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") +TARGET_C_PROPERTIES (testh5repack_detect_szip STATIC) +target_link_libraries (testh5repack_detect_szip PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) set_target_properties (testh5repack_detect_szip PROPERTIES FOLDER tools) set (REPACK_COMMON_SOURCES @@ -20,9 +20,9 @@ set (REPACK_COMMON_SOURCES ${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR}/h5repack.c ) add_executable (h5repacktest ${REPACK_COMMON_SOURCES} ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/h5repacktst.c) -set_property(TARGET h5repacktest APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR};${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") -TARGET_C_PROPERTIES (h5repacktest STATIC " " " ") -target_link_libraries (h5repacktest ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) +target_include_directories(h5repacktest PRIVATE "${HDF5_TOOLS_SRC_H5REPACK_SOURCE_DIR};${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") +TARGET_C_PROPERTIES (h5repacktest STATIC) +target_link_libraries (h5repacktest PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) set_target_properties (h5repacktest PROPERTIES FOLDER tools) #----------------------------------------------------------------------------- @@ -36,15 +36,15 @@ set (HDF5_TOOL_PLUGIN_LIB_VNAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TO set (HDF5_TOOL_PLUGIN_LIB_VTARGET ${HDF5_TOOL_PLUGIN_LIB_VCORENAME}) add_library (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_rpk.c) -set_property(TARGET ${HDF5_TOOL_PLUGIN_LIB_TARGET} APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") -TARGET_C_PROPERTIES (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED " " " ") -target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) +target_include_directories(${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") +TARGET_C_PROPERTIES (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED) +target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIB_TARGET}) H5_SET_LIB_OPTIONS (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TOOL_PLUGIN_LIB_NAME} SHARED "LIB") add_library (${HDF5_TOOL_PLUGIN_LIB_VTARGET} SHARED dynlib_vrpk.c) -set_property(TARGET ${HDF5_TOOL_PLUGIN_LIB_VTARGET} APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") -TARGET_C_PROPERTIES (${HDF5_TOOL_PLUGIN_LIB_VTARGET} SHARED " " " ") -target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_VTARGET} ${HDF5_TEST_LIB_TARGET}) +target_include_directories(${HDF5_TOOL_PLUGIN_LIB_VTARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") +TARGET_C_PROPERTIES (${HDF5_TOOL_PLUGIN_LIB_VTARGET} SHARED) +target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_VTARGET} PRIVATE ${HDF5_TEST_LIB_TARGET}) H5_SET_LIB_OPTIONS (${HDF5_TOOL_PLUGIN_LIB_VTARGET} ${HDF5_TOOL_PLUGIN_LIB_VNAME} SHARED "LIB") # make plugins dir diff --git a/tools/test/h5stat/CMakeLists.txt b/tools/test/h5stat/CMakeLists.txt index 3d171fc..59e2fb3 100644 --- a/tools/test/h5stat/CMakeLists.txt +++ b/tools/test/h5stat/CMakeLists.txt @@ -6,9 +6,9 @@ project (HDF5_TOOLS_TEST_H5STAT C) # -------------------------------------------------------------------- if (HDF5_BUILD_GENERATORS) add_executable (h5stat_gentest ${HDF5_TOOLS_TEST_H5STAT_SOURCE_DIR}/h5stat_gentest.c) - set_property(TARGET h5stat_gentest APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") - TARGET_C_PROPERTIES (h5stat_gentest STATIC " " " ") - target_link_libraries (h5stat_gentest ${HDF5_LIB_TARGET}) + target_include_directories(h5stat_gentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") + TARGET_C_PROPERTIES (h5stat_gentest STATIC) + target_link_libraries (h5stat_gentest PRIVATE ${HDF5_LIB_TARGET}) set_target_properties (h5stat_gentest PROPERTIES FOLDER generator/tools) #add_test (NAME h5stat_gentest COMMAND $) diff --git a/tools/test/misc/CMakeLists.txt b/tools/test/misc/CMakeLists.txt index baf1dea..fbd9c29 100644 --- a/tools/test/misc/CMakeLists.txt +++ b/tools/test/misc/CMakeLists.txt @@ -6,16 +6,16 @@ project (HDF5_TOOLS_TEST_MISC C) # -------------------------------------------------------------------- if (HDF5_BUILD_GENERATORS) add_executable (h5repart_gentest ${HDF5_TOOLS_TEST_MISC_SOURCE_DIR}/h5repart_gentest.c) - set_property(TARGET h5repart_gentest APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") - TARGET_C_PROPERTIES (h5repart_gentest STATIC " " " ") - target_link_libraries (h5repart_gentest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) + target_include_directories(h5repart_gentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") + TARGET_C_PROPERTIES (h5repart_gentest STATIC) + target_link_libraries (h5repart_gentest PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) set_target_properties (h5repart_gentest PROPERTIES FOLDER generator/tools) #add_test (NAME h5repart_gentest COMMAND $) add_executable (h5clear_gentest ${HDF5_TOOLS_TEST_MISC_SOURCE_DIR}/h5clear_gentest.c) - set_property(TARGET h5clear_gentest APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") - TARGET_C_PROPERTIES (h5clear_gentest STATIC " " " ") - target_link_libraries (h5clear_gentest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) + target_include_directories(h5clear_gentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") + TARGET_C_PROPERTIES (h5clear_gentest STATIC) + target_link_libraries (h5clear_gentest PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) set_target_properties (h5clear_gentest PROPERTIES FOLDER tools) #add_test (NAME H5CLEAR-h5clear_gentest COMMAND $) @@ -24,15 +24,15 @@ if (HDF5_BUILD_GENERATORS) endif () add_executable (h5repart_test ${HDF5_TOOLS_TEST_MISC_SOURCE_DIR}/repart_test.c) -set_property(TARGET h5repart_test APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") -TARGET_C_PROPERTIES (h5repart_test STATIC " " " ") -target_link_libraries (h5repart_test ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) +target_include_directories(h5repart_test PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") +TARGET_C_PROPERTIES (h5repart_test STATIC) +target_link_libraries (h5repart_test PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) set_target_properties (h5repart_test PROPERTIES FOLDER tools) add_executable (clear_open_chk ${HDF5_TOOLS_TEST_MISC_SOURCE_DIR}/clear_open_chk.c) -set_property(TARGET clear_open_chk APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") -TARGET_C_PROPERTIES (clear_open_chk STATIC " " " ") -target_link_libraries (clear_open_chk ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) +target_include_directories(clear_open_chk PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") +TARGET_C_PROPERTIES (clear_open_chk STATIC) +target_link_libraries (clear_open_chk PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) set_target_properties (clear_open_chk PROPERTIES FOLDER tools) include (CMakeTestsRepart.cmake) diff --git a/tools/test/misc/vds/CMakeLists.txt b/tools/test/misc/vds/CMakeLists.txt index 586be6c..dc7df20 100644 --- a/tools/test/misc/vds/CMakeLists.txt +++ b/tools/test/misc/vds/CMakeLists.txt @@ -3,9 +3,9 @@ project (HDF5_TOOLS_TEST_MISC_VDS C) MACRO (ADD_H5_GENERATOR genfile) add_executable (${genfile} ${HDF5_TOOLS_TEST_MISC_VDS_SOURCE_DIR}/${genfile}.c) - set_property(TARGET ${genfile} APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") - TARGET_C_PROPERTIES (${genfile} STATIC " " " ") - target_link_libraries (${genfile} ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) + target_include_directories(${genfile} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") + TARGET_C_PROPERTIES (${genfile} STATIC) + target_link_libraries (${genfile} PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) set_target_properties (${genfile} PROPERTIES FOLDER generator/tools) ENDMACRO () diff --git a/tools/test/perform/CMakeLists.txt b/tools/test/perform/CMakeLists.txt index b7c9263..7b80c99 100644 --- a/tools/test/perform/CMakeLists.txt +++ b/tools/test/perform/CMakeLists.txt @@ -10,9 +10,9 @@ set (h5perf_serial_SOURCES ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/sio_engine.c ) add_executable (h5perf_serial ${h5perf_serial_SOURCES}) -set_property(TARGET h5perf_serial APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") -TARGET_C_PROPERTIES (h5perf_serial STATIC " " " ") -target_link_libraries (h5perf_serial ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) +target_include_directories(h5perf_serial PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") +TARGET_C_PROPERTIES (h5perf_serial STATIC) +target_link_libraries (h5perf_serial PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) set_target_properties (h5perf_serial PROPERTIES FOLDER perform) if (HDF5_BUILD_PERFORM_STANDALONE) @@ -22,9 +22,9 @@ if (HDF5_BUILD_PERFORM_STANDALONE) ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/sio_engine.c ) add_executable (h5perf_serial_alone ${h5perf_serial_alone_SOURCES}) - set_property(TARGET h5perf_serial_alone APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") - TARGET_C_PROPERTIES (h5perf_serial_alone STATIC " " " ") - target_link_libraries (h5perf_serial_alone ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) + target_include_directories(h5perf_serial_alone PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") + TARGET_C_PROPERTIES (h5perf_serial_alone STATIC) + target_link_libraries (h5perf_serial_alone PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) set_target_properties (h5perf_serial_alone PROPERTIES FOLDER perform) set_property (TARGET h5perf_serial_alone APPEND PROPERTY COMPILE_DEFINITIONS STANDALONE @@ -36,9 +36,9 @@ set (chunk_SOURCES ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/chunk.c ) add_executable(chunk ${chunk_SOURCES}) -set_property(TARGET chunk APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") -TARGET_C_PROPERTIES (chunk STATIC " " " ") -target_link_libraries(chunk ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) +target_include_directories(chunk PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") +TARGET_C_PROPERTIES (chunk STATIC) +target_link_libraries(chunk PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) set_target_properties (chunk PROPERTIES FOLDER perform) #-- Adding test for iopipe @@ -46,9 +46,9 @@ set (iopipe_SOURCES ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/iopipe.c ) add_executable (iopipe ${iopipe_SOURCES}) -set_property(TARGET iopipe APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") -TARGET_C_PROPERTIES (iopipe STATIC " " " ") -target_link_libraries (iopipe ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) +target_include_directories(iopipe PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") +TARGET_C_PROPERTIES (iopipe STATIC) +target_link_libraries (iopipe PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) set_target_properties (iopipe PROPERTIES FOLDER perform) #-- Adding test for overhead @@ -56,9 +56,9 @@ set (overhead_SOURCES ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/overhead.c ) add_executable (overhead ${overhead_SOURCES}) -set_property(TARGET overhead APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") -TARGET_C_PROPERTIES (overhead STATIC " " " ") -target_link_libraries (overhead ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) +target_include_directories(overhead PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") +TARGET_C_PROPERTIES (overhead STATIC) +target_link_libraries (overhead PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) set_target_properties (overhead PROPERTIES FOLDER perform) #-- Adding test for perf_meta @@ -66,9 +66,9 @@ set (perf_meta_SOURCES ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/perf_meta.c ) add_executable (perf_meta ${perf_meta_SOURCES}) -set_property(TARGET perf_meta APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") -TARGET_C_PROPERTIES (perf_meta STATIC " " " ") -target_link_libraries (perf_meta ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) +target_include_directories(perf_meta PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") +TARGET_C_PROPERTIES (perf_meta STATIC) +target_link_libraries (perf_meta PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) set_target_properties (perf_meta PROPERTIES FOLDER perform) #-- Adding test for zip_perf @@ -76,9 +76,9 @@ set (zip_perf_SOURCES ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/zip_perf.c ) add_executable (zip_perf ${zip_perf_SOURCES}) -set_property(TARGET zip_perf APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") -TARGET_C_PROPERTIES (zip_perf STATIC " " " ") -target_link_libraries (zip_perf ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) +target_include_directories(zip_perf PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") +TARGET_C_PROPERTIES (zip_perf STATIC) +target_link_libraries (zip_perf PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_target_properties (zip_perf PROPERTIES FOLDER perform) if (H5_HAVE_PARALLEL AND BUILD_TESTING) @@ -88,9 +88,9 @@ if (H5_HAVE_PARALLEL AND BUILD_TESTING) ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/pio_engine.c ) add_executable (h5perf ${h5perf_SOURCES}) - set_property(TARGET h5perf APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") - TARGET_C_PROPERTIES (h5perf STATIC " " " ") - target_link_libraries (h5perf ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) + target_include_directories(h5perf PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") + TARGET_C_PROPERTIES (h5perf STATIC) + target_link_libraries (h5perf PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) set_target_properties (h5perf PROPERTIES FOLDER perform) if (HDF5_BUILD_PERFORM_STANDALONE) @@ -100,9 +100,9 @@ if (H5_HAVE_PARALLEL AND BUILD_TESTING) ${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/pio_engine.c ) add_executable (h5perf_alone ${h5perf_alone_SOURCES}) - set_property(TARGET h5perf_alone APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") - TARGET_C_PROPERTIES (h5perf_alone STATIC " " " ") - target_link_libraries (h5perf_alone ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) + target_include_directories(h5perf_alone PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR}") + TARGET_C_PROPERTIES (h5perf_alone STATIC) + target_link_libraries (h5perf_alone PRIVATE ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) set_target_properties (h5perf_alone PROPERTIES FOLDER perform) set_property (TARGET h5perf_alone APPEND PROPERTY COMPILE_DEFINITIONS STANDALONE -- cgit v0.12 From 61d818aedafea9f2d5a3a50d78269fb14722b39f Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 26 Apr 2018 17:19:20 -0500 Subject: TRILABS-19 add mpi libs to utility programs --- src/CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4c47e17..ea4640e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -853,11 +853,11 @@ endif () # specific type checks inside #----------------------------------------------------------------------------- add_executable (H5detect ${HDF5_SRC_DIR}/H5detect.c) -target_include_directories(H5detect PRIVATE ${HDF5_BINARY_DIR}) +target_include_directories(H5detect PRIVATE "${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}") target_compile_definitions(H5detect PUBLIC ${HDF_EXTRA_C_FLAGS} ${HDF_EXTRA_FLAGS}) TARGET_C_PROPERTIES (H5detect STATIC) target_link_libraries (H5detect - PRIVATE $<$:ws2_32.lib> + PRIVATE $<$:${MPI_C_LIBRARIES}> $<$:ws2_32.lib> INTERFACE $<$:"-O0"> ) @@ -869,11 +869,11 @@ add_custom_command ( ) add_executable (H5make_libsettings ${HDF5_SRC_DIR}/H5make_libsettings.c) -target_include_directories(H5make_libsettings PRIVATE ${HDF5_BINARY_DIR}) +target_include_directories(H5make_libsettings PRIVATE "${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}") target_compile_definitions(H5make_libsettings PUBLIC ${HDF_EXTRA_C_FLAGS} ${HDF_EXTRA_FLAGS}) TARGET_C_PROPERTIES (H5make_libsettings STATIC) target_link_libraries (H5make_libsettings - PRIVATE $<$:ws2_32.lib> + PRIVATE $<$:${MPI_C_LIBRARIES}> $<$:ws2_32.lib> INTERFACE $<$:"-O0"> ) -- cgit v0.12 From a1cb2638f3cf55a025487e1e72e4f213a819ba76 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 27 Apr 2018 07:59:42 -0500 Subject: TRILABS-19 Fix missing angle char --- src/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ea4640e..70e18a2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -853,7 +853,7 @@ endif () # specific type checks inside #----------------------------------------------------------------------------- add_executable (H5detect ${HDF5_SRC_DIR}/H5detect.c) -target_include_directories(H5detect PRIVATE "${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}") +target_include_directories(H5detect PRIVATE "${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") target_compile_definitions(H5detect PUBLIC ${HDF_EXTRA_C_FLAGS} ${HDF_EXTRA_FLAGS}) TARGET_C_PROPERTIES (H5detect STATIC) target_link_libraries (H5detect @@ -869,7 +869,7 @@ add_custom_command ( ) add_executable (H5make_libsettings ${HDF5_SRC_DIR}/H5make_libsettings.c) -target_include_directories(H5make_libsettings PRIVATE "${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}") +target_include_directories(H5make_libsettings PRIVATE "${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") target_compile_definitions(H5make_libsettings PUBLIC ${HDF_EXTRA_C_FLAGS} ${HDF_EXTRA_FLAGS}) TARGET_C_PROPERTIES (H5make_libsettings STATIC) target_link_libraries (H5make_libsettings -- cgit v0.12 From 120195e5aadaa200e33520f2cee92b05492b9585 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 27 Apr 2018 12:44:42 -0500 Subject: TRILABS-19 fix typos --- fortran/examples/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fortran/examples/CMakeLists.txt b/fortran/examples/CMakeLists.txt index d2253ed..f9ee539 100644 --- a/fortran/examples/CMakeLists.txt +++ b/fortran/examples/CMakeLists.txt @@ -41,7 +41,7 @@ foreach (example ${examples}) ${HDF5_LIB_TARGET} ) target_include_directories (f90_ex_${example} PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/static);${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static" + "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static" ) set_target_properties (f90_ex_${example} PROPERTIES LINKER_LANGUAGE Fortran -- cgit v0.12 From 80afe46e70a824086f4744081eaf92836639109d Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 27 Apr 2018 13:04:40 -0500 Subject: TRILABS-19 revert to previous method --- config/cmake_ext_mod/HDFMacros.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/cmake_ext_mod/HDFMacros.cmake b/config/cmake_ext_mod/HDFMacros.cmake index 66e581d..6586e81 100644 --- a/config/cmake_ext_mod/HDFMacros.cmake +++ b/config/cmake_ext_mod/HDFMacros.cmake @@ -242,7 +242,7 @@ macro (TARGET_FORTRAN_PROPERTIES forttarget libtype) $<$:${WIN_COMPILE_FLAGS}> ) endif () - target_link_libraries(${forttarget} INTERFACE + set_target_properties (${forttarget} PROPERTIES LINK_FLAGS $<$:"/SUBSYSTEM:CONSOLE"> $<$:${WIN_LINK_FLAGS}> ) -- cgit v0.12 From 76d0cc0ca992e3f373c64ddc578ebfed09c77455 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 30 Apr 2018 09:03:29 -0500 Subject: TRILABS-19 Refactor fortran properties --- config/cmake_ext_mod/HDFMacros.cmake | 18 --- fortran/examples/CMakeLists.txt | 117 +++++++++----- fortran/src/CMakeLists.txt | 56 ++++--- fortran/test/CMakeLists.txt | 287 +++++++++++++++++++++++------------ fortran/testpar/CMakeLists.txt | 28 ++-- hl/fortran/examples/CMakeLists.txt | 26 ++-- hl/fortran/src/CMakeLists.txt | 57 ++++--- hl/fortran/test/CMakeLists.txt | 196 ++++++++++++++++++------ 8 files changed, 531 insertions(+), 254 deletions(-) diff --git a/config/cmake_ext_mod/HDFMacros.cmake b/config/cmake_ext_mod/HDFMacros.cmake index 6586e81..791fe2e 100644 --- a/config/cmake_ext_mod/HDFMacros.cmake +++ b/config/cmake_ext_mod/HDFMacros.cmake @@ -230,24 +230,6 @@ macro (TARGET_C_PROPERTIES wintarget libtype) ) endmacro () -#------------------------------------------------------------------------------- -macro (TARGET_FORTRAN_PROPERTIES forttarget libtype) - if (${libtype} MATCHES "SHARED") - target_compile_options(${forttarget} PRIVATE - $<$:"/dll"> - $<$:${WIN_COMPILE_FLAGS}> - ) - else () - target_compile_options(${forttarget} PRIVATE - $<$:${WIN_COMPILE_FLAGS}> - ) - endif () - set_target_properties (${forttarget} PROPERTIES LINK_FLAGS - $<$:"/SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> - ) -endmacro () - #----------------------------------------------------------------------------- # Configure the README.txt file for the binary package #----------------------------------------------------------------------------- diff --git a/fortran/examples/CMakeLists.txt b/fortran/examples/CMakeLists.txt index f9ee539..d89fbdc 100644 --- a/fortran/examples/CMakeLists.txt +++ b/fortran/examples/CMakeLists.txt @@ -35,99 +35,144 @@ set (F2003_examples foreach (example ${examples}) add_executable (f90_ex_${example} ${HDF5_F90_EXAMPLES_SOURCE_DIR}/${example}.f90) - TARGET_FORTRAN_PROPERTIES (f90_ex_${example} STATIC) - target_link_libraries (f90_ex_${example} PRIVATE - ${HDF5_F90_LIB_TARGET} - ${HDF5_LIB_TARGET} + target_include_directories (f90_ex_${example} + PRIVATE + "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static" ) - target_include_directories (f90_ex_${example} PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static" + target_compile_options(f90_ex_${example} + PRIVATE + $<$:${WIN_COMPILE_FLAGS}> + ) + target_link_libraries (f90_ex_${example} + PRIVATE + ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} ) set_target_properties (f90_ex_${example} PROPERTIES LINKER_LANGUAGE Fortran FOLDER examples/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static + LINK_FLAGS + $<$:"/SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) if (BUILD_SHARED_LIBS) add_executable (f90_ex_${example}-shared ${HDF5_F90_EXAMPLES_SOURCE_DIR}/${example}.f90) - TARGET_FORTRAN_PROPERTIES (f90_ex_${example}-shared SHARED) - target_link_libraries (f90_ex_${example}-shared PRIVATE - ${HDF5_F90_LIBSH_TARGET} - ${HDF5_LIBSH_TARGET} + target_include_directories (f90_ex_${example}-shared + PRIVATE + "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared" + ) + target_compile_options(${forttarget} + PRIVATE + $<$:"/dll"> + $<$:${WIN_COMPILE_FLAGS}> ) - target_include_directories (f90_ex_${example}-shared PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared" + target_link_libraries (f90_ex_${example}-shared + PRIVATE + ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ) set_target_properties (f90_ex_${example}-shared PROPERTIES LINKER_LANGUAGE Fortran FOLDER examples/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared + LINK_FLAGS + $<$:"/SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) endif () endforeach () foreach (example ${F2003_examples}) add_executable (f03_ex_${example} ${HDF5_F90_EXAMPLES_SOURCE_DIR}/${example}.f90) - TARGET_FORTRAN_PROPERTIES (f03_ex_${example} STATIC) - target_link_libraries (f03_ex_${example} PRIVATE - ${HDF5_F90_LIB_TARGET} - ${HDF5_LIB_TARGET} + target_include_directories (f03_ex_${example} + PRIVATE + "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static" + ) + target_compile_options(f03_ex_${example} + PRIVATE + $<$:${WIN_COMPILE_FLAGS}> ) - target_include_directories (f03_ex_${example} PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static" + target_link_libraries (f03_ex_${example} + PRIVATE + ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} ) set_target_properties (f03_ex_${example} PROPERTIES LINKER_LANGUAGE Fortran FOLDER examples/fortran03 Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static + LINK_FLAGS + $<$:"/SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) if (BUILD_SHARED_LIBS) add_executable (f03_ex_${example}-shared ${HDF5_F90_EXAMPLES_SOURCE_DIR}/${example}.f90) - TARGET_FORTRAN_PROPERTIES (f03_ex_${example}-shared SHARED) - target_link_libraries (f03_ex_${example}-shared PRIVATE - ${HDF5_F90_LIBSH_TARGET} - ${HDF5_LIBSH_TARGET} + target_include_directories (f03_ex_${example}-shared + PRIVATE + "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared" ) - target_include_directories (f03_ex_${example}-shared PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared" + target_compile_options(${forttarget} + PRIVATE + $<$:"/dll"> + $<$:${WIN_COMPILE_FLAGS}> + ) + target_link_libraries (f03_ex_${example}-shared + PRIVATE + ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ) set_target_properties (f03_ex_${example}-shared PROPERTIES LINKER_LANGUAGE Fortran FOLDER examples/fortran03 Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared + LINK_FLAGS + $<$:"/SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) endif () endforeach () if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) add_executable (f90_ex_ph5example ${HDF5_F90_EXAMPLES_SOURCE_DIR}/ph5example.f90) - TARGET_FORTRAN_PROPERTIES (f90_ex_ph5example STATIC) - target_link_libraries (f90_ex_ph5example PRIVATE - ${HDF5_F90_LIB_TARGET} - ${HDF5_LIB_TARGET} + target_include_directories (f90_ex_ph5example + PRIVATE + "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static" + ) + target_compile_options(f90_ex_ph5example + PRIVATE + $<$:${WIN_COMPILE_FLAGS}> ) - target_include_directories (f90_ex_ph5example PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static" + target_link_libraries (f90_ex_ph5example + PRIVATE + ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} ) set_target_properties (f90_ex_ph5example PROPERTIES LINKER_LANGUAGE Fortran FOLDER examples/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static + LINK_FLAGS + $<$:"/SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) if (BUILD_SHARED_LIBS) add_executable (f90_ex_ph5example-shared ${HDF5_F90_EXAMPLES_SOURCE_DIR}/ph5example.f90) - TARGET_FORTRAN_PROPERTIES (f90_ex_ph5example-shared SHARED) - target_link_libraries (f90_ex_ph5example-shared PRIVATE - ${HDF5_F90_LIBSH_TARGET} - ${HDF5_LIBSH_TARGET} + target_include_directories (f90_ex_ph5example-shared + PRIVATE + "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared" + ) + target_compile_options(${forttarget} + PRIVATE + $<$:"/dll"> + $<$:${WIN_COMPILE_FLAGS}> ) - target_include_directories (f90_ex_ph5example-shared PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared" + target_link_libraries (f90_ex_ph5example-shared + PRIVATE + ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ) set_target_properties (f90_ex_ph5example-shared PROPERTIES LINKER_LANGUAGE Fortran FOLDER examples/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared + LINK_FLAGS + $<$:"/SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) endif () endif () diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index c53a90f..4081f2b 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -245,51 +245,69 @@ endif () #----------------------------------------------------------------------------- add_library (${HDF5_F90_LIB_TARGET} STATIC ${f90_F_SOURCES}) target_include_directories (${HDF5_F90_LIB_TARGET} - PRIVATE "${HDF5_F90_SRC_SOURCE_DIR};${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};$<$:${MPI_Fortran_INCLUDE_DIRS}>" - INTERFACE "$/include>" + PRIVATE + "${HDF5_F90_SRC_SOURCE_DIR};${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};$<$:${MPI_Fortran_INCLUDE_DIRS}>" + INTERFACE + "$/include>" ) target_compile_definitions(${HDF5_F90_LIB_TARGET} - PRIVATE $<$:"HDF5F90_WINDOWS"> + PRIVATE + $<$:"HDF5F90_WINDOWS"> + $<$:${WIN_COMPILE_FLAGS}> ) -set (SHARED_LINK_FLAGS " ") -TARGET_FORTRAN_PROPERTIES (${HDF5_F90_LIB_TARGET} STATIC) target_link_libraries (${HDF5_F90_LIB_TARGET} - PUBLIC ${HDF5_F90_C_LIB_TARGET} - PRIVATE ${LINK_Fortran_LIBS} $<$:${MPI_Fortran_LIBRARIES}> + PUBLIC + ${HDF5_F90_C_LIB_TARGET} + PRIVATE + ${LINK_Fortran_LIBS} $<$:${MPI_Fortran_LIBRARIES}> ) -set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_F90_LIB_TARGET}") -H5_SET_LIB_OPTIONS (${HDF5_F90_LIB_TARGET} ${HDF5_F90_LIB_NAME} STATIC 0) set_target_properties (${HDF5_F90_LIB_TARGET} PROPERTIES FOLDER libraries/fortran LINKER_LANGUAGE Fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static + LINK_FLAGS + $<$:"/SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) +H5_SET_LIB_OPTIONS (${HDF5_F90_LIB_TARGET} ${HDF5_F90_LIB_NAME} STATIC 0) +set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_F90_LIB_TARGET}") set (install_targets ${install_targets} ${HDF5_F90_LIB_TARGET}) add_dependencies(${HDF5_F90_LIB_TARGET} H5gen) if (BUILD_SHARED_LIBS) add_library (${HDF5_F90_LIBSH_TARGET} SHARED ${f90_F_SOURCES_SHARED}) target_include_directories (${HDF5_F90_LIBSH_TARGET} - PRIVATE "${HDF5_F90_SRC_SOURCE_DIR};${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};$<$:${MPI_Fortran_INCLUDE_DIRS}>" - INTERFACE "$/include>" + PRIVATE + "${HDF5_F90_SRC_SOURCE_DIR};${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};$<$:${MPI_Fortran_INCLUDE_DIRS}>" + INTERFACE + "$/include>" ) target_compile_definitions(${HDF5_F90_LIBSH_TARGET} - PUBLIC "H5_BUILT_AS_DYNAMIC_LIB" - PRIVATE $<$:"BUILD_HDF5_DLL;HDF5F90_WINDOWS"> + PUBLIC + "H5_BUILT_AS_DYNAMIC_LIB" + PRIVATE + $<$:"BUILD_HDF5_DLL;HDF5F90_WINDOWS"> + $<$:"/dll"> + $<$:${WIN_COMPILE_FLAGS}> ) - TARGET_FORTRAN_PROPERTIES (${HDF5_F90_LIBSH_TARGET} SHARED) target_link_libraries (${HDF5_F90_LIBSH_TARGET} - PUBLIC ${HDF5_F90_C_LIBSH_TARGET} - PRIVATE ${LINK_Fortran_LIBS} $<$:${MPI_Fortran_LIBRARIES}> - INTERFACE $<$:"/DLL /DEF:${HDF5_F90_SRC_BINARY_DIR}/hdf5_fortrandll.def"> + PUBLIC + ${HDF5_F90_C_LIBSH_TARGET} + PRIVATE + ${LINK_Fortran_LIBS} $<$:${MPI_Fortran_LIBRARIES}> + INTERFACE + $<$:"/DLL /DEF:${HDF5_F90_SRC_BINARY_DIR}/hdf5_fortrandll.def"> ) - set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_F90_LIBSH_TARGET}") - H5_SET_LIB_OPTIONS (${HDF5_F90_LIBSH_TARGET} ${HDF5_F90_LIB_NAME} SHARED "F") set_target_properties (${HDF5_F90_LIBSH_TARGET} PROPERTIES FOLDER libraries/fortran LINKER_LANGUAGE Fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared + LINK_FLAGS + $<$:"/SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) + set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_F90_LIBSH_TARGET}") + H5_SET_LIB_OPTIONS (${HDF5_F90_LIBSH_TARGET} ${HDF5_F90_LIB_NAME} SHARED "F") set (install_targets ${install_targets} ${HDF5_F90_LIBSH_TARGET}) add_dependencies(${HDF5_F90_LIBSH_TARGET} H5genSH) endif () diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index 1fb26f5..73bfc19 100644 --- a/fortran/test/CMakeLists.txt +++ b/fortran/test/CMakeLists.txt @@ -115,47 +115,62 @@ endif () add_library (${HDF5_F90_TEST_LIB_TARGET} STATIC ${HDF5_F90_TF_SOURCES}) target_include_directories (${HDF5_F90_TEST_LIB_TARGET} - PRIVATE "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static" - INTERFACE "$/include>" + PRIVATE + "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static" + INTERFACE + "$/include>" ) target_compile_definitions(${HDF5_F90_TEST_LIB_TARGET} - PRIVATE $<$:"HDF5F90_WINDOWS"> + PRIVATE + $<$:"HDF5F90_WINDOWS"> + $<$:${WIN_COMPILE_FLAGS}> ) -TARGET_FORTRAN_PROPERTIES (${HDF5_F90_TEST_LIB_TARGET} STATIC) -target_link_libraries (${HDF5_F90_TEST_LIB_TARGET} PUBLIC - ${HDF5_F90_C_TEST_LIB_TARGET} - ${HDF5_F90_LIB_TARGET} - ${HDF5_LIB_TARGET} +target_link_libraries (${HDF5_F90_TEST_LIB_TARGET} + PUBLIC + ${HDF5_F90_C_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} ) -H5_SET_LIB_OPTIONS (${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_TEST_LIB_NAME} STATIC 0) set_target_properties (${HDF5_F90_TEST_LIB_TARGET} PROPERTIES FOLDER libraries/test/fortran LINKER_LANGUAGE Fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static + LINK_FLAGS + $<$:"/SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) +H5_SET_LIB_OPTIONS (${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_TEST_LIB_NAME} STATIC 0) add_dependencies(${HDF5_F90_TEST_LIB_TARGET} H5testgen) if (BUILD_SHARED_LIBS) add_library (${HDF5_F90_TEST_LIBSH_TARGET} SHARED ${HDF5_F90_TF_SOURCES_SHARED}) target_include_directories (${HDF5_F90_TEST_LIBSH_TARGET} - PRIVATE "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared" - INTERFACE "$/include>" + PRIVATE + "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared" + INTERFACE + "$/include>" ) target_compile_definitions(${HDF5_F90_TEST_LIBSH_TARGET} - PUBLIC "H5_BUILT_AS_DYNAMIC_LIB" - PRIVATE $<$:"BUILD_HDF5_TEST_DLL;HDF5F90_WINDOWS"> + PUBLIC + "H5_BUILT_AS_DYNAMIC_LIB" + PRIVATE + $<$:"BUILD_HDF5_TEST_DLL;HDF5F90_WINDOWS"> + $<$:"/dll"> + $<$:${WIN_COMPILE_FLAGS}> ) - TARGET_FORTRAN_PROPERTIES (${HDF5_F90_TEST_LIBSH_TARGET} SHARED) target_link_libraries (${HDF5_F90_TEST_LIBSH_TARGET} - PUBLIC ${HDF5_F90_C_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} - INTERFACE $<$:"/DLL"> + PUBLIC + ${HDF5_F90_C_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} + INTERFACE + $<$:"/DLL"> ) - H5_SET_LIB_OPTIONS (${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_TEST_LIB_NAME} SHARED "F") set_target_properties (${HDF5_F90_TEST_LIBSH_TARGET} PROPERTIES FOLDER libraries/test/fortran LINKER_LANGUAGE Fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared + LINK_FLAGS + $<$:"/SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) + H5_SET_LIB_OPTIONS (${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_TEST_LIB_NAME} SHARED "F") add_dependencies(${HDF5_F90_TEST_LIBSH_TARGET} H5testgenSH) endif () @@ -181,18 +196,24 @@ add_executable (testhdf5_fortran tH5Z.F90 tHDF5.F90 ) -target_include_directories (testhdf5_fortran PRIVATE "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static") -TARGET_FORTRAN_PROPERTIES (testhdf5_fortran STATIC) -target_link_libraries (testhdf5_fortran PRIVATE - ${HDF5_F90_TEST_LIB_TARGET} - ${HDF5_F90_LIB_TARGET} - ${HDF5_LIB_TARGET} - $<$:ws2_32.lib> +target_include_directories (testhdf5_fortran + PRIVATE + "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static") +target_compile_options(testhdf5_fortran + PRIVATE + $<$:${WIN_COMPILE_FLAGS}> +) +target_link_libraries (testhdf5_fortran + PRIVATE + ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} $<$:ws2_32.lib> ) set_target_properties (testhdf5_fortran PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static + LINK_FLAGS + $<$:"/SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) add_dependencies (testhdf5_fortran ${HDF5_F90_TEST_LIB_TARGET}) @@ -214,18 +235,26 @@ if (BUILD_SHARED_LIBS) tH5Z.F90 tHDF5.F90 ) - target_include_directories (testhdf5_fortran-shared PRIVATE "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared") - TARGET_FORTRAN_PROPERTIES (testhdf5_fortran-shared SHARED) - target_link_libraries (testhdf5_fortran-shared PRIVATE - ${HDF5_F90_TEST_LIBSH_TARGET} - ${HDF5_F90_LIBSH_TARGET} - ${HDF5_LIBSH_TARGET} - $<$:ws2_32.lib> + target_include_directories (testhdf5_fortran-shared + PRIVATE + "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared" + ) + target_compile_options(testhdf5_fortran-shared + PRIVATE + $<$:"/dll"> + $<$:${WIN_COMPILE_FLAGS}> + ) + target_link_libraries (testhdf5_fortran-shared + PRIVATE + ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$:ws2_32.lib> ) set_target_properties (testhdf5_fortran-shared PROPERTIES - LINKER_LANGUAGE Fortran - FOLDER test/fortran - Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared + LINKER_LANGUAGE Fortran + FOLDER test/fortran + Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared + LINK_FLAGS + $<$:"/SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) add_dependencies (testhdf5_fortran-shared ${HDF5_F90_TEST_LIBSH_TARGET}) endif () @@ -239,18 +268,25 @@ add_executable (testhdf5_fortran_1_8 tH5MISC_1_8.F90 tHDF5_1_8.F90 ) -target_include_directories (testhdf5_fortran_1_8 PRIVATE "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static") -TARGET_FORTRAN_PROPERTIES (testhdf5_fortran_1_8 STATIC) -target_link_libraries (testhdf5_fortran_1_8 PRIVATE - ${HDF5_F90_TEST_LIB_TARGET} - ${HDF5_F90_LIB_TARGET} - ${HDF5_LIB_TARGET} - $<$:ws2_32.lib> +target_include_directories (testhdf5_fortran_1_8 + PRIVATE + "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static" +) +target_compile_options(testhdf5_fortran_1_8 + PRIVATE + $<$:${WIN_COMPILE_FLAGS}> +) +target_link_libraries (testhdf5_fortran_1_8 + PRIVATE + ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} $<$:ws2_32.lib> ) set_target_properties (testhdf5_fortran_1_8 PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static + LINK_FLAGS + $<$:"/SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) add_dependencies (testhdf5_fortran_1_8 ${HDF5_F90_TEST_LIB_TARGET}) @@ -263,18 +299,26 @@ if (BUILD_SHARED_LIBS) tH5MISC_1_8.F90 tHDF5_1_8.F90 ) - target_include_directories (testhdf5_fortran_1_8-shared PRIVATE "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared") - TARGET_FORTRAN_PROPERTIES (testhdf5_fortran_1_8-shared SHARED) - target_link_libraries (testhdf5_fortran_1_8-shared PRIVATE - ${HDF5_F90_TEST_LIBSH_TARGET} - ${HDF5_F90_LIBSH_TARGET} - ${HDF5_LIBSH_TARGET} - $<$:ws2_32.lib> + target_include_directories (testhdf5_fortran_1_8-shared + PRIVATE + "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared" + ) + target_compile_options(testhdf5_fortran_1_8-shared + PRIVATE + $<$:"/dll"> + $<$:${WIN_COMPILE_FLAGS}> + ) + target_link_libraries (testhdf5_fortran_1_8-shared + PRIVATE + ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$:ws2_32.lib> ) set_target_properties (testhdf5_fortran_1_8-shared PROPERTIES - LINKER_LANGUAGE Fortran - FOLDER test/fortran - Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared + LINKER_LANGUAGE Fortran + FOLDER test/fortran + Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared + LINK_FLAGS + $<$:"/SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) add_dependencies (testhdf5_fortran_1_8-shared ${HDF5_F90_TEST_LIBSH_TARGET}) endif () @@ -290,18 +334,25 @@ add_executable (fortranlib_test_F03 tH5T_F03.F90 tHDF5_F03.F90 ) -target_include_directories (fortranlib_test_F03 PRIVATE "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static") -TARGET_FORTRAN_PROPERTIES (fortranlib_test_F03 STATIC) -target_link_libraries (fortranlib_test_F03 PRIVATE - ${HDF5_F90_TEST_LIB_TARGET} - ${HDF5_F90_LIB_TARGET} - ${HDF5_LIB_TARGET} - $<$:ws2_32.lib> +target_include_directories (fortranlib_test_F03 + PRIVATE + "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static" +) +target_compile_options(fortranlib_test_F03 + PRIVATE + $<$:${WIN_COMPILE_FLAGS}> +) +target_link_libraries (fortranlib_test_F03 + PRIVATE + ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} $<$:ws2_32.lib> ) set_target_properties (fortranlib_test_F03 PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static + LINK_FLAGS + $<$:"/SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) add_dependencies (fortranlib_test_F03 ${HDF5_F90_TEST_LIB_TARGET}) @@ -316,88 +367,126 @@ if (BUILD_SHARED_LIBS) tH5T_F03.F90 tHDF5_F03.F90 ) - target_include_directories (fortranlib_test_F03-shared PRIVATE "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared") - TARGET_FORTRAN_PROPERTIES (fortranlib_test_F03-shared SHARED) - target_link_libraries (fortranlib_test_F03-shared PRIVATE - ${HDF5_F90_TEST_LIBSH_TARGET} - ${HDF5_F90_LIBSH_TARGET} - ${HDF5_LIBSH_TARGET} - $<$:ws2_32.lib> + target_include_directories (fortranlib_test_F03-shared + PRIVATE + "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared" + ) + target_compile_options(fortranlib_test_F03-shared + PRIVATE + $<$:"/dll"> + $<$:${WIN_COMPILE_FLAGS}> + ) + target_link_libraries (fortranlib_test_F03-shared + PRIVATE + ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$:ws2_32.lib> ) set_target_properties (fortranlib_test_F03-shared PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared + LINK_FLAGS + $<$:"/SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) add_dependencies (fortranlib_test_F03-shared ${HDF5_F90_TEST_LIBSH_TARGET}) endif () #-- Adding test for fflush1 add_executable (fflush1 fflush1.F90) -target_include_directories (fflush1 PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/static) -TARGET_FORTRAN_PROPERTIES (fflush1 STATIC) -target_link_libraries (fflush1 PRIVATE - ${HDF5_F90_LIB_TARGET} - ${HDF5_F90_TEST_LIB_TARGET} - ${HDF5_LIB_TARGET} - $<$:ws2_32.lib> +target_include_directories (fflush1 + PRIVATE + ${CMAKE_Fortran_MODULE_DIRECTORY}/static +) +target_compile_options(fflush1 + PRIVATE + $<$:${WIN_COMPILE_FLAGS}> +) +target_link_libraries (fflush1 + PRIVATE + ${HDF5_F90_LIB_TARGET} ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_LIB_TARGET} $<$:ws2_32.lib> ) set_target_properties (fflush1 PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static + LINK_FLAGS + $<$:"/SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) add_dependencies (fflush1 ${HDF5_F90_TEST_LIB_TARGET}) if (BUILD_SHARED_LIBS) add_executable (fflush1-shared fflush1.F90) - target_include_directories (fflush1-shared PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/shared) - TARGET_FORTRAN_PROPERTIES (fflush1-shared SHARED) - target_link_libraries (fflush1-shared PRIVATE - ${HDF5_F90_LIBSH_TARGET} - ${HDF5_F90_TEST_LIBSH_TARGET} - ${HDF5_LIBSH_TARGET} - $<$:ws2_32.lib> + target_include_directories (fflush1-shared + PRIVATE + ${CMAKE_Fortran_MODULE_DIRECTORY}/shared + ) + target_compile_options(fflush1-shared + PRIVATE + $<$:"/dll"> + $<$:${WIN_COMPILE_FLAGS}> + ) + target_link_libraries (fflush1-shared + PRIVATE + ${HDF5_F90_LIBSH_TARGET} ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$:ws2_32.lib> ) set_target_properties (fflush1-shared PROPERTIES - LINKER_LANGUAGE Fortran - FOLDER test/fortran - Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared + LINKER_LANGUAGE Fortran + FOLDER test/fortran + Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared + LINK_FLAGS + $<$:"/SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) add_dependencies (fflush1-shared ${HDF5_F90_TEST_LIBSH_TARGET}) endif () #-- Adding test for fflush2 add_executable (fflush2 fflush2.F90) -target_include_directories (fflush2 PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/static) -TARGET_FORTRAN_PROPERTIES (fflush2 STATIC) -target_link_libraries (fflush2 PRIVATE - ${HDF5_F90_TEST_LIB_TARGET} - ${HDF5_F90_LIB_TARGET} - ${HDF5_LIB_TARGET} - $<$:ws2_32.lib> +target_include_directories (fflush2 + PRIVATE + ${CMAKE_Fortran_MODULE_DIRECTORY}/static +) +target_compile_options (fflush2 + PRIVATE + $<$:${WIN_COMPILE_FLAGS}> +) +target_link_libraries (fflush2 + PRIVATE + ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} $<$:ws2_32.lib> ) set_target_properties (fflush2 PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static + LINK_FLAGS + $<$:"/SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) add_dependencies (fflush2 ${HDF5_F90_TEST_LIB_TARGET}) if (BUILD_SHARED_LIBS) add_executable (fflush2-shared fflush2.F90) - target_include_directories (fflush2-shared PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/shared) - TARGET_FORTRAN_PROPERTIES (fflush2-shared SHARED) - target_link_libraries (fflush2-shared PRIVATE - ${HDF5_F90_TEST_LIBSH_TARGET} - ${HDF5_F90_LIBSH_TARGET} - ${HDF5_LIBSH_TARGET} - $<$:ws2_32.lib> + target_include_directories (fflush2-shared + PRIVATE + ${CMAKE_Fortran_MODULE_DIRECTORY}/shared + ) + target_compile_options(fflush2-shared + PRIVATE + $<$:"/dll"> + $<$:${WIN_COMPILE_FLAGS}> + ) + target_link_libraries (fflush2-shared + PRIVATE + ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$:ws2_32.lib> ) set_target_properties (fflush2-shared PROPERTIES - LINKER_LANGUAGE Fortran - FOLDER test/fortran - Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared + LINKER_LANGUAGE Fortran + FOLDER test/fortran + Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared + LINK_FLAGS + $<$:"/SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) add_dependencies (fflush2-shared ${HDF5_F90_TEST_LIBSH_TARGET}) endif () diff --git a/fortran/testpar/CMakeLists.txt b/fortran/testpar/CMakeLists.txt index a6984b7..f08d6a6 100644 --- a/fortran/testpar/CMakeLists.txt +++ b/fortran/testpar/CMakeLists.txt @@ -16,18 +16,26 @@ add_executable (parallel_test hyper.f90 mdset.f90 ) -TARGET_FORTRAN_PROPERTIES (parallel_test STATIC) +target_include_directories (parallel_test + PRIVATE + ${TESTPAR_INCLUDES} +) +target_compile_options(parallel_test + PRIVATE + $<$:${WIN_COMPILE_FLAGS}> +) target_link_libraries (parallel_test - ${HDF5_F90_TEST_LIB_TARGET} - ${HDF5_F90_LIB_TARGET} - ${HDF5_LIB_TARGET} - ${LINK_Fortran_LIBS} + PRIVATE + ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} ${LINK_Fortran_LIBS} + $<$:"ws2_32.lib"> +) +set_target_properties (parallel_test PROPERTIES + FOLDER test/fortran + LINKER_LANGUAGE Fortran + LINK_FLAGS + $<$:"/SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) -if (WIN32 AND MSVC) - target_link_libraries (parallel_test "ws2_32.lib") endif () -target_include_directories (parallel_test PRIVATE ${TESTPAR_INCLUDES}) -set_target_properties (parallel_test PROPERTIES LINKER_LANGUAGE Fortran) -set_target_properties (parallel_test PROPERTIES FOLDER test/fortran) include (CMakeTests.cmake) diff --git a/hl/fortran/examples/CMakeLists.txt b/hl/fortran/examples/CMakeLists.txt index db047d0..7805ff4 100644 --- a/hl/fortran/examples/CMakeLists.txt +++ b/hl/fortran/examples/CMakeLists.txt @@ -8,17 +8,25 @@ set (examples foreach (example ${examples}) add_executable (hl_f90_ex_${example} ${HDF5_HL_F90_EXAMPLES_SOURCE_DIR}/${example}.f90) - target_include_directories (hl_f90_ex_${example} PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src" + target_include_directories (hl_f90_ex_${example} + PRIVATE + "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src" ) - TARGET_FORTRAN_PROPERTIES (hl_f90_ex_${example} STATIC) - target_link_libraries (hl_f90_ex_${example} PRIVATE - ${HDF5_HL_F90_LIB_TARGET} - ${HDF5_F90_LIB_TARGET} - ${HDF5_LIB_TARGET} + target_compile_options(hl_f90_ex_${example} + PRIVATE + $<$:${WIN_COMPILE_FLAGS}> + ) + target_link_libraries (hl_f90_ex_${example} + PRIVATE + ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} + ) + set_target_properties (hl_f90_ex_${example} PROPERTIES + LINKER_LANGUAGE Fortran + FOLDER examples/hl/fortran + LINK_FLAGS + $<$:"/SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) - set_target_properties (hl_f90_ex_${example} PROPERTIES LINKER_LANGUAGE Fortran) - set_target_properties (hl_f90_ex_${example} PROPERTIES FOLDER examples/hl/fortran) endforeach () diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt index 6e808c3..ffe8f16 100644 --- a/hl/fortran/src/CMakeLists.txt +++ b/hl/fortran/src/CMakeLists.txt @@ -149,49 +149,68 @@ endif () add_library (${HDF5_HL_F90_LIB_TARGET} STATIC ${HDF5_HL_F90_F_SOURCES}) target_include_directories (${HDF5_HL_F90_LIB_TARGET} - PRIVATE "${HDF5_F90_BINARY_DIR};${CMAKE_Fortran_MODULE_DIRECTORY}/static;$<$:${MPI_Fortran_INCLUDE_DIRS}>" - INTERFACE "$/include>" + PRIVATE + "${HDF5_F90_BINARY_DIR};${CMAKE_Fortran_MODULE_DIRECTORY}/static;$<$:${MPI_Fortran_INCLUDE_DIRS}>" + INTERFACE + "$/include>" ) -target_compile_definitions(${HDF5_LIBSH_TARGET} - PUBLIC $<$:"HDF5F90_WINDOWS"> +target_compile_definitions(${HDF5_HL_F90_LIB_TARGET} + PUBLIC + $<$:"HDF5F90_WINDOWS"> + PRIVATE + $<$:${WIN_COMPILE_FLAGS}> ) -TARGET_FORTRAN_PROPERTIES (${HDF5_HL_F90_LIB_TARGET} STATIC) target_link_libraries (${HDF5_HL_F90_LIB_TARGET} - PUBLIC ${HDF5_HL_F90_C_LIB_TARGET} ${HDF5_F90_LIB_TARGET} + PUBLIC + ${HDF5_HL_F90_C_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ) -set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_F90_LIB_TARGET}") -H5_SET_LIB_OPTIONS (${HDF5_HL_F90_LIB_TARGET} ${HDF5_HL_F90_LIB_NAME} STATIC 0) set_target_properties (${HDF5_HL_F90_LIB_TARGET} PROPERTIES FOLDER libraries/hl/fortran LINKER_LANGUAGE Fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static + LINK_FLAGS + $<$:"/SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) +H5_SET_LIB_OPTIONS (${HDF5_HL_F90_LIB_TARGET} ${HDF5_HL_F90_LIB_NAME} STATIC 0) +set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_F90_LIB_TARGET}") set (install_targets ${install_targets} ${HDF5_HL_F90_LIB_TARGET}) add_dependencies(${HDF5_HL_F90_LIB_TARGET} H5HLgen) if (BUILD_SHARED_LIBS) add_library (${HDF5_HL_F90_LIBSH_TARGET} SHARED ${HDF5_HL_F90_F_SOURCES_SHARED}) target_include_directories (${HDF5_HL_F90_LIBSH_TARGET} - PRIVATE "${HDF5_F90_BINARY_DIR};${CMAKE_Fortran_MODULE_DIRECTORY}/shared;$<$:${MPI_Fortran_INCLUDE_DIRS}>" - INTERFACE "$/include>" + PRIVATE + "${HDF5_F90_BINARY_DIR};${CMAKE_Fortran_MODULE_DIRECTORY}/shared;$<$:${MPI_Fortran_INCLUDE_DIRS}>" + INTERFACE + "$/include>" ) - target_compile_definitions(${HDF5_LIBSH_TARGET} - PRIVATE $<$:"BUILD_HDF5_HL_DLL;HDF5F90_WINDOWS"> - PUBLIC "H5_BUILT_AS_DYNAMIC_LIB" + target_compile_definitions(${HDF5_HL_F90_LIBSH_TARGET} + PUBLIC + "H5_BUILT_AS_DYNAMIC_LIB" + PRIVATE + $<$:"BUILD_HDF5_HL_DLL;HDF5F90_WINDOWS"> + $<$:"/dll"> + $<$:${WIN_COMPILE_FLAGS}> ) - TARGET_FORTRAN_PROPERTIES (${HDF5_HL_F90_LIBSH_TARGET} SHARED) target_link_libraries (${HDF5_HL_F90_LIBSH_TARGET} - PUBLIC ${HDF5_HL_F90_C_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} - PRIVATE ${LINK_Fortran_LIBS} - INTERFACE $<$:"/DLL /DEF:${HDF5_HL_F90_SRC_BINARY_DIR}/hdf5_hl_fortrandll.def"> + PUBLIC + ${HDF5_HL_F90_C_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} + PRIVATE + ${LINK_Fortran_LIBS} + INTERFACE + $<$:"/DLL /DEF:${HDF5_HL_F90_SRC_BINARY_DIR}/hdf5_hl_fortrandll.def"> ) - set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_F90_LIBSH_TARGET}") - H5_SET_LIB_OPTIONS (${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_HL_F90_LIB_NAME} SHARED "HL_F") set_target_properties (${HDF5_HL_F90_LIBSH_TARGET} PROPERTIES FOLDER libraries/hl/fortran LINKER_LANGUAGE Fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared + LINK_FLAGS + $<$:"/SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) + H5_SET_LIB_OPTIONS (${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_HL_F90_LIB_NAME} SHARED "HL_F") + set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_F90_LIBSH_TARGET}") set (install_targets ${install_targets} ${HDF5_HL_F90_LIBSH_TARGET}) add_dependencies(${HDF5_HL_F90_LIBSH_TARGET} H5HLgenSH) endif () diff --git a/hl/fortran/test/CMakeLists.txt b/hl/fortran/test/CMakeLists.txt index d5aac56..074d87a 100644 --- a/hl/fortran/test/CMakeLists.txt +++ b/hl/fortran/test/CMakeLists.txt @@ -7,77 +7,185 @@ project (HDF5_HL_FORTRAN_TESTS C Fortran) #-- Adding test for hl_f90_tstds add_executable (hl_f90_tstds tstds.F90) -target_include_directories (hl_f90_tstds PRIVATE "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src") -TARGET_FORTRAN_PROPERTIES (hl_f90_tstds STATIC) -target_link_libraries (hl_f90_tstds PRIVATE ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET}) -set_target_properties (hl_f90_tstds PROPERTIES LINKER_LANGUAGE Fortran) -set_target_properties (hl_f90_tstds PROPERTIES FOLDER test/hl/fortran) +target_include_directories (hl_f90_tstds + PRIVATE + "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src" +) +target_compile_options(hl_f90_tstds + PRIVATE + $<$:${WIN_COMPILE_FLAGS}> +) +target_link_libraries (hl_f90_tstds + PRIVATE + ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET} +) +set_target_properties (hl_f90_tstds PROPERTIES + LINKER_LANGUAGE Fortran + FOLDER test/hl/fortran + LINK_FLAGS + $<$:"/SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> +) if (BUILD_SHARED_LIBS) add_executable (hl_f90_tstds-shared tstds.F90) - target_include_directories (hl_f90_tstds-shared PRIVATE "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src") - TARGET_FORTRAN_PROPERTIES (hl_f90_tstds-shared SHARED) - target_link_libraries (hl_f90_tstds-shared PRIVATE ${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET}) + target_include_directories (hl_f90_tstds-shared + PRIVATE + "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src" + ) + target_compile_options(hl_f90_tstds-shared + PRIVATE + $<$:"/dll"> + $<$:${WIN_COMPILE_FLAGS}> + ) + target_link_libraries (hl_f90_tstds-shared + PRIVATE + ${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} + ) set_target_properties (hl_f90_tstds-shared PROPERTIES - LINKER_LANGUAGE Fortran - FOLDER test/hl/fortran - Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared + LINKER_LANGUAGE Fortran + FOLDER test/hl/fortran + Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared + LINK_FLAGS + $<$:"/SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) endif () #-- Adding test for hl_f90_tstlite add_executable (hl_f90_tstlite tstlite.F90) -target_include_directories (hl_f90_tstlite PRIVATE "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src") -TARGET_FORTRAN_PROPERTIES (hl_f90_tstlite STATIC) -target_link_libraries (hl_f90_tstlite PRIVATE ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_F90_TEST_LIB_TARGET}) -set_target_properties (hl_f90_tstlite PROPERTIES LINKER_LANGUAGE Fortran) -set_target_properties (hl_f90_tstlite PROPERTIES FOLDER test/hl/fortran) +target_include_directories (hl_f90_tstlite + PRIVATE + "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src" +) +target_compile_options(hl_f90_tstlite + PRIVATE + $<$:${WIN_COMPILE_FLAGS}> +) +target_link_libraries (hl_f90_tstlite + PRIVATE + ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_F90_TEST_LIB_TARGET} +) +set_target_properties (hl_f90_tstlite PROPERTIES + LINKER_LANGUAGE Fortran + FOLDER test/hl/fortran + LINK_FLAGS + $<$:"/SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> +) if (BUILD_SHARED_LIBS) add_executable (hl_f90_tstlite-shared tstlite.F90) - target_include_directories (hl_f90_tstlite-shared PRIVATE "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src") - TARGET_FORTRAN_PROPERTIES (hl_f90_tstlite-shared SHARED) - target_link_libraries (hl_f90_tstlite-shared PRIVATE ${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_F90_TEST_LIBSH_TARGET}) + target_include_directories (hl_f90_tstlite-shared + PRIVATE + "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src" + ) + target_compile_options(hl_f90_tstlite-shared + PRIVATE + $<$:"/dll"> + $<$:${WIN_COMPILE_FLAGS}> + ) + target_link_libraries (hl_f90_tstlite-shared + PRIVATE + ${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_F90_TEST_LIBSH_TARGET} + ) set_target_properties (hl_f90_tstlite-shared PROPERTIES - LINKER_LANGUAGE Fortran - FOLDER test/hl/fortran - Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared + LINKER_LANGUAGE Fortran + FOLDER test/hl/fortran + Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared + LINK_FLAGS + $<$:"/SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) endif () #-- Adding test for hl_f90_tstimage add_executable (hl_f90_tstimage tstimage.F90) -target_include_directories (hl_f90_tstimage PRIVATE "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src") -TARGET_FORTRAN_PROPERTIES (hl_f90_tstimage STATIC) -target_link_libraries (hl_f90_tstimage PRIVATE ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET}) -set_target_properties (hl_f90_tstimage PROPERTIES LINKER_LANGUAGE Fortran) -set_target_properties (hl_f90_tstimage PROPERTIES FOLDER test/hl/fortran) +target_include_directories (hl_f90_tstimage + PRIVATE + "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src" +) +target_compile_options(hl_f90_tstimage + PRIVATE + $<$:${WIN_COMPILE_FLAGS}> +) +target_link_libraries (hl_f90_tstimage + PRIVATE + ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET} +) +set_target_properties (hl_f90_tstimage PROPERTIES + FOLDER test/hl/fortran + LINKER_LANGUAGE Fortran + LINK_FLAGS + $<$:"/SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> +) if (BUILD_SHARED_LIBS) add_executable (hl_f90_tstimage-shared tstimage.F90) - target_include_directories (hl_f90_tstimage-shared PRIVATE "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src") - TARGET_FORTRAN_PROPERTIES (hl_f90_tstimage-shared SHARED) - target_link_libraries (hl_f90_tstimage-shared PRIVATE ${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET}) + target_include_directories (hl_f90_tstimage-shared + PRIVATE + "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src" + ) + target_compile_options(hl_f90_tstimage-shared + PRIVATE + $<$:"/dll"> + $<$:${WIN_COMPILE_FLAGS}> + ) + target_link_libraries (hl_f90_tstimage-shared + PRIVATE + ${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} + ) set_target_properties (hl_f90_tstimage-shared PROPERTIES - LINKER_LANGUAGE Fortran - FOLDER test/hl/fortran - Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared + LINKER_LANGUAGE Fortran + FOLDER test/hl/fortran + Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared + LINK_FLAGS + $<$:"/SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) endif () #-- Adding test for hl_f90_tsttable add_executable (hl_f90_tsttable tsttable.F90) -target_include_directories (hl_f90_tsttable PRIVATE "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src") -TARGET_FORTRAN_PROPERTIES (hl_f90_tsttable STATIC) -target_link_libraries (hl_f90_tsttable PRIVATE ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_F90_TEST_LIB_TARGET}) -set_target_properties (hl_f90_tsttable PROPERTIES LINKER_LANGUAGE Fortran) -set_target_properties (hl_f90_tsttable PROPERTIES FOLDER test/hl/fortran) +target_include_directories (hl_f90_tsttable + PRIVATE + "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src" +) +target_compile_options(hl_f90_tsttable + PRIVATE + $<$:${WIN_COMPILE_FLAGS}> +) +target_link_libraries (hl_f90_tsttable + PRIVATE + ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_F90_TEST_LIB_TARGET} +) +set_target_properties (hl_f90_tsttable PROPERTIES + FOLDER test/hl/fortran + LINKER_LANGUAGE Fortran + LINK_FLAGS + $<$:"/SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> +) if (BUILD_SHARED_LIBS) add_executable (hl_f90_tsttable-shared tsttable.F90) - target_include_directories (hl_f90_tsttable-shared PRIVATE "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src") - TARGET_FORTRAN_PROPERTIES (hl_f90_tsttable-shared SHARED) - target_link_libraries (hl_f90_tsttable-shared PRIVATE ${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_F90_TEST_LIBSH_TARGET}) + target_include_directories (hl_f90_tsttable-shared + PRIVATE + "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src" + ) + target_compile_options(hl_f90_tsttable-shared + PRIVATE + $<$:"/dll"> + $<$:${WIN_COMPILE_FLAGS}> + ) + target_link_libraries (hl_f90_tsttable-shared + PRIVATE + ${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_F90_TEST_LIBSH_TARGET} + ) set_target_properties (hl_f90_tsttable-shared PROPERTIES - LINKER_LANGUAGE Fortran - FOLDER test/hl/fortran - Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared + LINKER_LANGUAGE Fortran + FOLDER test/hl/fortran + Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared + LINK_FLAGS + $<$:"/SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) endif () -- cgit v0.12 From 6fb94eb3a38ea5f6d7253b72f7038ac00f295962 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 30 Apr 2018 09:56:27 -0500 Subject: TRILABS-19 fix fortran link flags --- fortran/examples/CMakeLists.txt | 18 +++++++++--------- fortran/src/CMakeLists.txt | 4 ++-- fortran/test/CMakeLists.txt | 24 ++++++++++++------------ hl/fortran/examples/CMakeLists.txt | 2 +- hl/fortran/src/CMakeLists.txt | 4 ++-- hl/fortran/test/CMakeLists.txt | 16 ++++++++-------- 6 files changed, 34 insertions(+), 34 deletions(-) diff --git a/fortran/examples/CMakeLists.txt b/fortran/examples/CMakeLists.txt index d89fbdc..8a372d5 100644 --- a/fortran/examples/CMakeLists.txt +++ b/fortran/examples/CMakeLists.txt @@ -51,7 +51,7 @@ foreach (example ${examples}) LINKER_LANGUAGE Fortran FOLDER examples/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static - LINK_FLAGS + LINK_FLAGS "" $<$:"/SUBSYSTEM:CONSOLE"> $<$:${WIN_LINK_FLAGS}> ) @@ -61,7 +61,7 @@ foreach (example ${examples}) PRIVATE "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared" ) - target_compile_options(${forttarget} + target_compile_options(f90_ex_${example}-shared PRIVATE $<$:"/dll"> $<$:${WIN_COMPILE_FLAGS}> @@ -74,7 +74,7 @@ foreach (example ${examples}) LINKER_LANGUAGE Fortran FOLDER examples/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared - LINK_FLAGS + LINK_FLAGS "" $<$:"/SUBSYSTEM:CONSOLE"> $<$:${WIN_LINK_FLAGS}> ) @@ -99,7 +99,7 @@ foreach (example ${F2003_examples}) LINKER_LANGUAGE Fortran FOLDER examples/fortran03 Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static - LINK_FLAGS + LINK_FLAGS "" $<$:"/SUBSYSTEM:CONSOLE"> $<$:${WIN_LINK_FLAGS}> ) @@ -109,7 +109,7 @@ foreach (example ${F2003_examples}) PRIVATE "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared" ) - target_compile_options(${forttarget} + target_compile_options(f03_ex_${example}-shared PRIVATE $<$:"/dll"> $<$:${WIN_COMPILE_FLAGS}> @@ -122,7 +122,7 @@ foreach (example ${F2003_examples}) LINKER_LANGUAGE Fortran FOLDER examples/fortran03 Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared - LINK_FLAGS + LINK_FLAGS "" $<$:"/SUBSYSTEM:CONSOLE"> $<$:${WIN_LINK_FLAGS}> ) @@ -147,7 +147,7 @@ if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) LINKER_LANGUAGE Fortran FOLDER examples/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static - LINK_FLAGS + LINK_FLAGS "" $<$:"/SUBSYSTEM:CONSOLE"> $<$:${WIN_LINK_FLAGS}> ) @@ -157,7 +157,7 @@ if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) PRIVATE "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/shared" ) - target_compile_options(${forttarget} + target_compile_options(f90_ex_ph5example-shared PRIVATE $<$:"/dll"> $<$:${WIN_COMPILE_FLAGS}> @@ -170,7 +170,7 @@ if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) LINKER_LANGUAGE Fortran FOLDER examples/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared - LINK_FLAGS + LINK_FLAGS "" $<$:"/SUBSYSTEM:CONSOLE"> $<$:${WIN_LINK_FLAGS}> ) diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index 4081f2b..8b66997 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -265,7 +265,7 @@ set_target_properties (${HDF5_F90_LIB_TARGET} PROPERTIES FOLDER libraries/fortran LINKER_LANGUAGE Fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static - LINK_FLAGS + LINK_FLAGS "" $<$:"/SUBSYSTEM:CONSOLE"> $<$:${WIN_LINK_FLAGS}> ) @@ -302,7 +302,7 @@ if (BUILD_SHARED_LIBS) FOLDER libraries/fortran LINKER_LANGUAGE Fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared - LINK_FLAGS + LINK_FLAGS "" $<$:"/SUBSYSTEM:CONSOLE"> $<$:${WIN_LINK_FLAGS}> ) diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index 73bfc19..8b44571 100644 --- a/fortran/test/CMakeLists.txt +++ b/fortran/test/CMakeLists.txt @@ -133,7 +133,7 @@ set_target_properties (${HDF5_F90_TEST_LIB_TARGET} PROPERTIES FOLDER libraries/test/fortran LINKER_LANGUAGE Fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static - LINK_FLAGS + LINK_FLAGS "" $<$:"/SUBSYSTEM:CONSOLE"> $<$:${WIN_LINK_FLAGS}> ) @@ -166,7 +166,7 @@ if (BUILD_SHARED_LIBS) FOLDER libraries/test/fortran LINKER_LANGUAGE Fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared - LINK_FLAGS + LINK_FLAGS "" $<$:"/SUBSYSTEM:CONSOLE"> $<$:${WIN_LINK_FLAGS}> ) @@ -211,7 +211,7 @@ set_target_properties (testhdf5_fortran PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static - LINK_FLAGS + LINK_FLAGS "" $<$:"/SUBSYSTEM:CONSOLE"> $<$:${WIN_LINK_FLAGS}> ) @@ -252,7 +252,7 @@ if (BUILD_SHARED_LIBS) LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared - LINK_FLAGS + LINK_FLAGS "" $<$:"/SUBSYSTEM:CONSOLE"> $<$:${WIN_LINK_FLAGS}> ) @@ -284,7 +284,7 @@ set_target_properties (testhdf5_fortran_1_8 PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static - LINK_FLAGS + LINK_FLAGS "" $<$:"/SUBSYSTEM:CONSOLE"> $<$:${WIN_LINK_FLAGS}> ) @@ -316,7 +316,7 @@ if (BUILD_SHARED_LIBS) LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared - LINK_FLAGS + LINK_FLAGS "" $<$:"/SUBSYSTEM:CONSOLE"> $<$:${WIN_LINK_FLAGS}> ) @@ -350,7 +350,7 @@ set_target_properties (fortranlib_test_F03 PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static - LINK_FLAGS + LINK_FLAGS "" $<$:"/SUBSYSTEM:CONSOLE"> $<$:${WIN_LINK_FLAGS}> ) @@ -384,7 +384,7 @@ if (BUILD_SHARED_LIBS) LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared - LINK_FLAGS + LINK_FLAGS "" $<$:"/SUBSYSTEM:CONSOLE"> $<$:${WIN_LINK_FLAGS}> ) @@ -409,7 +409,7 @@ set_target_properties (fflush1 PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static - LINK_FLAGS + LINK_FLAGS "" $<$:"/SUBSYSTEM:CONSOLE"> $<$:${WIN_LINK_FLAGS}> ) @@ -434,7 +434,7 @@ if (BUILD_SHARED_LIBS) LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared - LINK_FLAGS + LINK_FLAGS "" $<$:"/SUBSYSTEM:CONSOLE"> $<$:${WIN_LINK_FLAGS}> ) @@ -459,7 +459,7 @@ set_target_properties (fflush2 PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static - LINK_FLAGS + LINK_FLAGS "" $<$:"/SUBSYSTEM:CONSOLE"> $<$:${WIN_LINK_FLAGS}> ) @@ -484,7 +484,7 @@ if (BUILD_SHARED_LIBS) LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared - LINK_FLAGS + LINK_FLAGS "" $<$:"/SUBSYSTEM:CONSOLE"> $<$:${WIN_LINK_FLAGS}> ) diff --git a/hl/fortran/examples/CMakeLists.txt b/hl/fortran/examples/CMakeLists.txt index 7805ff4..803bdf5 100644 --- a/hl/fortran/examples/CMakeLists.txt +++ b/hl/fortran/examples/CMakeLists.txt @@ -23,7 +23,7 @@ foreach (example ${examples}) set_target_properties (hl_f90_ex_${example} PROPERTIES LINKER_LANGUAGE Fortran FOLDER examples/hl/fortran - LINK_FLAGS + LINK_FLAGS "" $<$:"/SUBSYSTEM:CONSOLE"> $<$:${WIN_LINK_FLAGS}> ) diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt index ffe8f16..bf05a7b 100644 --- a/hl/fortran/src/CMakeLists.txt +++ b/hl/fortran/src/CMakeLists.txt @@ -168,7 +168,7 @@ set_target_properties (${HDF5_HL_F90_LIB_TARGET} PROPERTIES FOLDER libraries/hl/fortran LINKER_LANGUAGE Fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static - LINK_FLAGS + LINK_FLAGS "" $<$:"/SUBSYSTEM:CONSOLE"> $<$:${WIN_LINK_FLAGS}> ) @@ -205,7 +205,7 @@ if (BUILD_SHARED_LIBS) FOLDER libraries/hl/fortran LINKER_LANGUAGE Fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared - LINK_FLAGS + LINK_FLAGS "" $<$:"/SUBSYSTEM:CONSOLE"> $<$:${WIN_LINK_FLAGS}> ) diff --git a/hl/fortran/test/CMakeLists.txt b/hl/fortran/test/CMakeLists.txt index 074d87a..093b1f6 100644 --- a/hl/fortran/test/CMakeLists.txt +++ b/hl/fortran/test/CMakeLists.txt @@ -22,7 +22,7 @@ target_link_libraries (hl_f90_tstds set_target_properties (hl_f90_tstds PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/hl/fortran - LINK_FLAGS + LINK_FLAGS "" $<$:"/SUBSYSTEM:CONSOLE"> $<$:${WIN_LINK_FLAGS}> ) @@ -45,7 +45,7 @@ if (BUILD_SHARED_LIBS) LINKER_LANGUAGE Fortran FOLDER test/hl/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared - LINK_FLAGS + LINK_FLAGS "" $<$:"/SUBSYSTEM:CONSOLE"> $<$:${WIN_LINK_FLAGS}> ) @@ -68,7 +68,7 @@ target_link_libraries (hl_f90_tstlite set_target_properties (hl_f90_tstlite PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/hl/fortran - LINK_FLAGS + LINK_FLAGS "" $<$:"/SUBSYSTEM:CONSOLE"> $<$:${WIN_LINK_FLAGS}> ) @@ -91,7 +91,7 @@ if (BUILD_SHARED_LIBS) LINKER_LANGUAGE Fortran FOLDER test/hl/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared - LINK_FLAGS + LINK_FLAGS "" $<$:"/SUBSYSTEM:CONSOLE"> $<$:${WIN_LINK_FLAGS}> ) @@ -114,7 +114,7 @@ target_link_libraries (hl_f90_tstimage set_target_properties (hl_f90_tstimage PROPERTIES FOLDER test/hl/fortran LINKER_LANGUAGE Fortran - LINK_FLAGS + LINK_FLAGS "" $<$:"/SUBSYSTEM:CONSOLE"> $<$:${WIN_LINK_FLAGS}> ) @@ -137,7 +137,7 @@ if (BUILD_SHARED_LIBS) LINKER_LANGUAGE Fortran FOLDER test/hl/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared - LINK_FLAGS + LINK_FLAGS "" $<$:"/SUBSYSTEM:CONSOLE"> $<$:${WIN_LINK_FLAGS}> ) @@ -160,7 +160,7 @@ target_link_libraries (hl_f90_tsttable set_target_properties (hl_f90_tsttable PROPERTIES FOLDER test/hl/fortran LINKER_LANGUAGE Fortran - LINK_FLAGS + LINK_FLAGS "" $<$:"/SUBSYSTEM:CONSOLE"> $<$:${WIN_LINK_FLAGS}> ) @@ -183,7 +183,7 @@ if (BUILD_SHARED_LIBS) LINKER_LANGUAGE Fortran FOLDER test/hl/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared - LINK_FLAGS + LINK_FLAGS "" $<$:"/SUBSYSTEM:CONSOLE"> $<$:${WIN_LINK_FLAGS}> ) -- cgit v0.12 From 6dd91d206f6177585a32d0449bcb9abd6792c8a4 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 2 May 2018 10:04:14 -0500 Subject: TRILABS-19 Link flags need - character --- config/cmake/UserMacros/Windows_MT.cmake | 2 +- fortran/examples/CMakeLists.txt | 12 ++++++------ fortran/src/CMakeLists.txt | 6 +++--- fortran/test/CMakeLists.txt | 26 +++++++++++++------------- fortran/testpar/CMakeLists.txt | 2 +- hl/fortran/examples/CMakeLists.txt | 2 +- hl/fortran/src/CMakeLists.txt | 6 +++--- hl/fortran/test/CMakeLists.txt | 16 ++++++++-------- 8 files changed, 36 insertions(+), 36 deletions(-) diff --git a/config/cmake/UserMacros/Windows_MT.cmake b/config/cmake/UserMacros/Windows_MT.cmake index b6cc513..ea95908 100644 --- a/config/cmake/UserMacros/Windows_MT.cmake +++ b/config/cmake/UserMacros/Windows_MT.cmake @@ -40,7 +40,7 @@ macro (TARGET_STATIC_CRT_FLAGS) endif () endforeach () set (WIN_COMPILE_FLAGS "") - set (WIN_LINK_FLAGS "/NODEFAULTLIB:MSVCRT") + set (WIN_LINK_FLAGS "-NODEFAULTLIB:MSVCRT") endif () endmacro () diff --git a/fortran/examples/CMakeLists.txt b/fortran/examples/CMakeLists.txt index 8a372d5..aa2d138 100644 --- a/fortran/examples/CMakeLists.txt +++ b/fortran/examples/CMakeLists.txt @@ -52,7 +52,7 @@ foreach (example ${examples}) FOLDER examples/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static LINK_FLAGS "" - $<$:"/SUBSYSTEM:CONSOLE"> + $<$:"-SUBSYSTEM:CONSOLE"> $<$:${WIN_LINK_FLAGS}> ) if (BUILD_SHARED_LIBS) @@ -75,7 +75,7 @@ foreach (example ${examples}) FOLDER examples/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared LINK_FLAGS "" - $<$:"/SUBSYSTEM:CONSOLE"> + $<$:"-SUBSYSTEM:CONSOLE"> $<$:${WIN_LINK_FLAGS}> ) endif () @@ -100,7 +100,7 @@ foreach (example ${F2003_examples}) FOLDER examples/fortran03 Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static LINK_FLAGS "" - $<$:"/SUBSYSTEM:CONSOLE"> + $<$:"-SUBSYSTEM:CONSOLE"> $<$:${WIN_LINK_FLAGS}> ) if (BUILD_SHARED_LIBS) @@ -123,7 +123,7 @@ foreach (example ${F2003_examples}) FOLDER examples/fortran03 Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared LINK_FLAGS "" - $<$:"/SUBSYSTEM:CONSOLE"> + $<$:"-SUBSYSTEM:CONSOLE"> $<$:${WIN_LINK_FLAGS}> ) endif () @@ -148,7 +148,7 @@ if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) FOLDER examples/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static LINK_FLAGS "" - $<$:"/SUBSYSTEM:CONSOLE"> + $<$:"-SUBSYSTEM:CONSOLE"> $<$:${WIN_LINK_FLAGS}> ) if (BUILD_SHARED_LIBS) @@ -171,7 +171,7 @@ if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) FOLDER examples/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared LINK_FLAGS "" - $<$:"/SUBSYSTEM:CONSOLE"> + $<$:"-SUBSYSTEM:CONSOLE"> $<$:${WIN_LINK_FLAGS}> ) endif () diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index 8b66997..7959c05 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -51,7 +51,7 @@ if (WIN32 AND MSVC) if (BUILD_SHARED_LIBS) set_target_properties (H5_buildiface PROPERTIES COMPILE_FLAGS "/MT") endif () - set_target_properties (H5_buildiface PROPERTIES LINK_FLAGS "/SUBSYSTEM:CONSOLE") + set_target_properties (H5_buildiface PROPERTIES LINK_FLAGS "-SUBSYSTEM:CONSOLE") endif () set_target_properties (H5_buildiface PROPERTIES LINKER_LANGUAGE Fortran @@ -266,7 +266,7 @@ set_target_properties (${HDF5_F90_LIB_TARGET} PROPERTIES LINKER_LANGUAGE Fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static LINK_FLAGS "" - $<$:"/SUBSYSTEM:CONSOLE"> + $<$:"-SUBSYSTEM:CONSOLE"> $<$:${WIN_LINK_FLAGS}> ) H5_SET_LIB_OPTIONS (${HDF5_F90_LIB_TARGET} ${HDF5_F90_LIB_NAME} STATIC 0) @@ -303,7 +303,7 @@ if (BUILD_SHARED_LIBS) LINKER_LANGUAGE Fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared LINK_FLAGS "" - $<$:"/SUBSYSTEM:CONSOLE"> + $<$:"-SUBSYSTEM:CONSOLE"> $<$:${WIN_LINK_FLAGS}> ) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_F90_LIBSH_TARGET}") diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index 8b44571..13c16a5 100644 --- a/fortran/test/CMakeLists.txt +++ b/fortran/test/CMakeLists.txt @@ -14,7 +14,7 @@ if (WIN32 AND MSVC) if (BUILD_SHARED_LIBS) set_target_properties (H5_test_buildiface PROPERTIES COMPILE_FLAGS "/MT") endif () - set_target_properties (H5_test_buildiface PROPERTIES LINK_FLAGS "/SUBSYSTEM:CONSOLE") + set_target_properties (H5_test_buildiface PROPERTIES LINK_FLAGS "-SUBSYSTEM:CONSOLE") endif () set_target_properties (H5_test_buildiface PROPERTIES LINKER_LANGUAGE Fortran @@ -134,7 +134,7 @@ set_target_properties (${HDF5_F90_TEST_LIB_TARGET} PROPERTIES LINKER_LANGUAGE Fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static LINK_FLAGS "" - $<$:"/SUBSYSTEM:CONSOLE"> + $<$:"-SUBSYSTEM:CONSOLE"> $<$:${WIN_LINK_FLAGS}> ) H5_SET_LIB_OPTIONS (${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_TEST_LIB_NAME} STATIC 0) @@ -167,7 +167,7 @@ if (BUILD_SHARED_LIBS) LINKER_LANGUAGE Fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared LINK_FLAGS "" - $<$:"/SUBSYSTEM:CONSOLE"> + $<$:"-SUBSYSTEM:CONSOLE"> $<$:${WIN_LINK_FLAGS}> ) H5_SET_LIB_OPTIONS (${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_TEST_LIB_NAME} SHARED "F") @@ -212,7 +212,7 @@ set_target_properties (testhdf5_fortran PROPERTIES FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static LINK_FLAGS "" - $<$:"/SUBSYSTEM:CONSOLE"> + $<$:"-SUBSYSTEM:CONSOLE"> $<$:${WIN_LINK_FLAGS}> ) add_dependencies (testhdf5_fortran ${HDF5_F90_TEST_LIB_TARGET}) @@ -253,7 +253,7 @@ if (BUILD_SHARED_LIBS) FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared LINK_FLAGS "" - $<$:"/SUBSYSTEM:CONSOLE"> + $<$:"-SUBSYSTEM:CONSOLE"> $<$:${WIN_LINK_FLAGS}> ) add_dependencies (testhdf5_fortran-shared ${HDF5_F90_TEST_LIBSH_TARGET}) @@ -285,7 +285,7 @@ set_target_properties (testhdf5_fortran_1_8 PROPERTIES FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static LINK_FLAGS "" - $<$:"/SUBSYSTEM:CONSOLE"> + $<$:"-SUBSYSTEM:CONSOLE"> $<$:${WIN_LINK_FLAGS}> ) add_dependencies (testhdf5_fortran_1_8 ${HDF5_F90_TEST_LIB_TARGET}) @@ -317,7 +317,7 @@ if (BUILD_SHARED_LIBS) FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared LINK_FLAGS "" - $<$:"/SUBSYSTEM:CONSOLE"> + $<$:"-SUBSYSTEM:CONSOLE"> $<$:${WIN_LINK_FLAGS}> ) add_dependencies (testhdf5_fortran_1_8-shared ${HDF5_F90_TEST_LIBSH_TARGET}) @@ -351,7 +351,7 @@ set_target_properties (fortranlib_test_F03 PROPERTIES FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static LINK_FLAGS "" - $<$:"/SUBSYSTEM:CONSOLE"> + $<$:"-SUBSYSTEM:CONSOLE"> $<$:${WIN_LINK_FLAGS}> ) add_dependencies (fortranlib_test_F03 ${HDF5_F90_TEST_LIB_TARGET}) @@ -385,7 +385,7 @@ if (BUILD_SHARED_LIBS) FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared LINK_FLAGS "" - $<$:"/SUBSYSTEM:CONSOLE"> + $<$:"-SUBSYSTEM:CONSOLE"> $<$:${WIN_LINK_FLAGS}> ) add_dependencies (fortranlib_test_F03-shared ${HDF5_F90_TEST_LIBSH_TARGET}) @@ -410,7 +410,7 @@ set_target_properties (fflush1 PROPERTIES FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static LINK_FLAGS "" - $<$:"/SUBSYSTEM:CONSOLE"> + $<$:"-SUBSYSTEM:CONSOLE"> $<$:${WIN_LINK_FLAGS}> ) add_dependencies (fflush1 ${HDF5_F90_TEST_LIB_TARGET}) @@ -435,7 +435,7 @@ if (BUILD_SHARED_LIBS) FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared LINK_FLAGS "" - $<$:"/SUBSYSTEM:CONSOLE"> + $<$:"-SUBSYSTEM:CONSOLE"> $<$:${WIN_LINK_FLAGS}> ) add_dependencies (fflush1-shared ${HDF5_F90_TEST_LIBSH_TARGET}) @@ -460,7 +460,7 @@ set_target_properties (fflush2 PROPERTIES FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static LINK_FLAGS "" - $<$:"/SUBSYSTEM:CONSOLE"> + $<$:"-SUBSYSTEM:CONSOLE"> $<$:${WIN_LINK_FLAGS}> ) add_dependencies (fflush2 ${HDF5_F90_TEST_LIB_TARGET}) @@ -485,7 +485,7 @@ if (BUILD_SHARED_LIBS) FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared LINK_FLAGS "" - $<$:"/SUBSYSTEM:CONSOLE"> + $<$:"-SUBSYSTEM:CONSOLE"> $<$:${WIN_LINK_FLAGS}> ) add_dependencies (fflush2-shared ${HDF5_F90_TEST_LIBSH_TARGET}) diff --git a/fortran/testpar/CMakeLists.txt b/fortran/testpar/CMakeLists.txt index f08d6a6..b0a1820 100644 --- a/fortran/testpar/CMakeLists.txt +++ b/fortran/testpar/CMakeLists.txt @@ -33,7 +33,7 @@ set_target_properties (parallel_test PROPERTIES FOLDER test/fortran LINKER_LANGUAGE Fortran LINK_FLAGS - $<$:"/SUBSYSTEM:CONSOLE"> + $<$:"-SUBSYSTEM:CONSOLE"> $<$:${WIN_LINK_FLAGS}> ) endif () diff --git a/hl/fortran/examples/CMakeLists.txt b/hl/fortran/examples/CMakeLists.txt index 803bdf5..a218de5 100644 --- a/hl/fortran/examples/CMakeLists.txt +++ b/hl/fortran/examples/CMakeLists.txt @@ -24,7 +24,7 @@ foreach (example ${examples}) LINKER_LANGUAGE Fortran FOLDER examples/hl/fortran LINK_FLAGS "" - $<$:"/SUBSYSTEM:CONSOLE"> + $<$:"-SUBSYSTEM:CONSOLE"> $<$:${WIN_LINK_FLAGS}> ) diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt index bf05a7b..9764a65 100644 --- a/hl/fortran/src/CMakeLists.txt +++ b/hl/fortran/src/CMakeLists.txt @@ -21,7 +21,7 @@ if (WIN32 AND MSVC) if (BUILD_SHARED_LIBS) set_target_properties (H5HL_buildiface PROPERTIES COMPILE_FLAGS "/MT") endif () - set_target_properties (H5HL_buildiface PROPERTIES LINK_FLAGS "/SUBSYSTEM:CONSOLE") + set_target_properties (H5HL_buildiface PROPERTIES LINK_FLAGS "-SUBSYSTEM:CONSOLE") endif () set_target_properties (H5HL_buildiface PROPERTIES LINKER_LANGUAGE Fortran @@ -169,7 +169,7 @@ set_target_properties (${HDF5_HL_F90_LIB_TARGET} PROPERTIES LINKER_LANGUAGE Fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static LINK_FLAGS "" - $<$:"/SUBSYSTEM:CONSOLE"> + $<$:"-SUBSYSTEM:CONSOLE"> $<$:${WIN_LINK_FLAGS}> ) H5_SET_LIB_OPTIONS (${HDF5_HL_F90_LIB_TARGET} ${HDF5_HL_F90_LIB_NAME} STATIC 0) @@ -206,7 +206,7 @@ if (BUILD_SHARED_LIBS) LINKER_LANGUAGE Fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared LINK_FLAGS "" - $<$:"/SUBSYSTEM:CONSOLE"> + $<$:"-SUBSYSTEM:CONSOLE"> $<$:${WIN_LINK_FLAGS}> ) H5_SET_LIB_OPTIONS (${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_HL_F90_LIB_NAME} SHARED "HL_F") diff --git a/hl/fortran/test/CMakeLists.txt b/hl/fortran/test/CMakeLists.txt index 093b1f6..497ba7f 100644 --- a/hl/fortran/test/CMakeLists.txt +++ b/hl/fortran/test/CMakeLists.txt @@ -23,7 +23,7 @@ set_target_properties (hl_f90_tstds PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/hl/fortran LINK_FLAGS "" - $<$:"/SUBSYSTEM:CONSOLE"> + $<$:"-SUBSYSTEM:CONSOLE"> $<$:${WIN_LINK_FLAGS}> ) if (BUILD_SHARED_LIBS) @@ -46,7 +46,7 @@ if (BUILD_SHARED_LIBS) FOLDER test/hl/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared LINK_FLAGS "" - $<$:"/SUBSYSTEM:CONSOLE"> + $<$:"-SUBSYSTEM:CONSOLE"> $<$:${WIN_LINK_FLAGS}> ) endif () @@ -69,7 +69,7 @@ set_target_properties (hl_f90_tstlite PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/hl/fortran LINK_FLAGS "" - $<$:"/SUBSYSTEM:CONSOLE"> + $<$:"-SUBSYSTEM:CONSOLE"> $<$:${WIN_LINK_FLAGS}> ) if (BUILD_SHARED_LIBS) @@ -92,7 +92,7 @@ if (BUILD_SHARED_LIBS) FOLDER test/hl/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared LINK_FLAGS "" - $<$:"/SUBSYSTEM:CONSOLE"> + $<$:"-SUBSYSTEM:CONSOLE"> $<$:${WIN_LINK_FLAGS}> ) endif () @@ -115,7 +115,7 @@ set_target_properties (hl_f90_tstimage PROPERTIES FOLDER test/hl/fortran LINKER_LANGUAGE Fortran LINK_FLAGS "" - $<$:"/SUBSYSTEM:CONSOLE"> + $<$:"-SUBSYSTEM:CONSOLE"> $<$:${WIN_LINK_FLAGS}> ) if (BUILD_SHARED_LIBS) @@ -138,7 +138,7 @@ if (BUILD_SHARED_LIBS) FOLDER test/hl/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared LINK_FLAGS "" - $<$:"/SUBSYSTEM:CONSOLE"> + $<$:"-SUBSYSTEM:CONSOLE"> $<$:${WIN_LINK_FLAGS}> ) endif () @@ -161,7 +161,7 @@ set_target_properties (hl_f90_tsttable PROPERTIES FOLDER test/hl/fortran LINKER_LANGUAGE Fortran LINK_FLAGS "" - $<$:"/SUBSYSTEM:CONSOLE"> + $<$:"-SUBSYSTEM:CONSOLE"> $<$:${WIN_LINK_FLAGS}> ) if (BUILD_SHARED_LIBS) @@ -184,7 +184,7 @@ if (BUILD_SHARED_LIBS) FOLDER test/hl/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared LINK_FLAGS "" - $<$:"/SUBSYSTEM:CONSOLE"> + $<$:"-SUBSYSTEM:CONSOLE"> $<$:${WIN_LINK_FLAGS}> ) endif () -- cgit v0.12 From c6827191f928a44012d200aaaa5319c603a700bd Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 2 May 2018 12:19:30 -0500 Subject: TRILABS-19 fix syntax for windows --- fortran/examples/CMakeLists.txt | 6 +++--- fortran/src/CMakeLists.txt | 2 +- fortran/test/CMakeLists.txt | 12 ++++++------ hl/fortran/src/CMakeLists.txt | 2 +- hl/fortran/test/CMakeLists.txt | 8 ++++---- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/fortran/examples/CMakeLists.txt b/fortran/examples/CMakeLists.txt index aa2d138..ad3c9c6 100644 --- a/fortran/examples/CMakeLists.txt +++ b/fortran/examples/CMakeLists.txt @@ -63,7 +63,7 @@ foreach (example ${examples}) ) target_compile_options(f90_ex_${example}-shared PRIVATE - $<$:"/dll"> + $<$:/dll> $<$:${WIN_COMPILE_FLAGS}> ) target_link_libraries (f90_ex_${example}-shared @@ -111,7 +111,7 @@ foreach (example ${F2003_examples}) ) target_compile_options(f03_ex_${example}-shared PRIVATE - $<$:"/dll"> + $<$:/dll> $<$:${WIN_COMPILE_FLAGS}> ) target_link_libraries (f03_ex_${example}-shared @@ -159,7 +159,7 @@ if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) ) target_compile_options(f90_ex_ph5example-shared PRIVATE - $<$:"/dll"> + $<$:/dll> $<$:${WIN_COMPILE_FLAGS}> ) target_link_libraries (f90_ex_ph5example-shared diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index 7959c05..4ab51d2 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -287,7 +287,7 @@ if (BUILD_SHARED_LIBS) "H5_BUILT_AS_DYNAMIC_LIB" PRIVATE $<$:"BUILD_HDF5_DLL;HDF5F90_WINDOWS"> - $<$:"/dll"> + $<$:/dll> $<$:${WIN_COMPILE_FLAGS}> ) target_link_libraries (${HDF5_F90_LIBSH_TARGET} diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index 13c16a5..e81fab7 100644 --- a/fortran/test/CMakeLists.txt +++ b/fortran/test/CMakeLists.txt @@ -153,7 +153,7 @@ if (BUILD_SHARED_LIBS) "H5_BUILT_AS_DYNAMIC_LIB" PRIVATE $<$:"BUILD_HDF5_TEST_DLL;HDF5F90_WINDOWS"> - $<$:"/dll"> + $<$:/dll> $<$:${WIN_COMPILE_FLAGS}> ) target_link_libraries (${HDF5_F90_TEST_LIBSH_TARGET} @@ -241,7 +241,7 @@ if (BUILD_SHARED_LIBS) ) target_compile_options(testhdf5_fortran-shared PRIVATE - $<$:"/dll"> + $<$:/dll> $<$:${WIN_COMPILE_FLAGS}> ) target_link_libraries (testhdf5_fortran-shared @@ -305,7 +305,7 @@ if (BUILD_SHARED_LIBS) ) target_compile_options(testhdf5_fortran_1_8-shared PRIVATE - $<$:"/dll"> + $<$:/dll> $<$:${WIN_COMPILE_FLAGS}> ) target_link_libraries (testhdf5_fortran_1_8-shared @@ -373,7 +373,7 @@ if (BUILD_SHARED_LIBS) ) target_compile_options(fortranlib_test_F03-shared PRIVATE - $<$:"/dll"> + $<$:/dll> $<$:${WIN_COMPILE_FLAGS}> ) target_link_libraries (fortranlib_test_F03-shared @@ -423,7 +423,7 @@ if (BUILD_SHARED_LIBS) ) target_compile_options(fflush1-shared PRIVATE - $<$:"/dll"> + $<$:/dll> $<$:${WIN_COMPILE_FLAGS}> ) target_link_libraries (fflush1-shared @@ -473,7 +473,7 @@ if (BUILD_SHARED_LIBS) ) target_compile_options(fflush2-shared PRIVATE - $<$:"/dll"> + $<$:/dll> $<$:${WIN_COMPILE_FLAGS}> ) target_link_libraries (fflush2-shared diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt index 9764a65..9999261 100644 --- a/hl/fortran/src/CMakeLists.txt +++ b/hl/fortran/src/CMakeLists.txt @@ -190,7 +190,7 @@ if (BUILD_SHARED_LIBS) "H5_BUILT_AS_DYNAMIC_LIB" PRIVATE $<$:"BUILD_HDF5_HL_DLL;HDF5F90_WINDOWS"> - $<$:"/dll"> + $<$:/dll> $<$:${WIN_COMPILE_FLAGS}> ) target_link_libraries (${HDF5_HL_F90_LIBSH_TARGET} diff --git a/hl/fortran/test/CMakeLists.txt b/hl/fortran/test/CMakeLists.txt index 497ba7f..a639d9c 100644 --- a/hl/fortran/test/CMakeLists.txt +++ b/hl/fortran/test/CMakeLists.txt @@ -34,7 +34,7 @@ if (BUILD_SHARED_LIBS) ) target_compile_options(hl_f90_tstds-shared PRIVATE - $<$:"/dll"> + $<$:/dll> $<$:${WIN_COMPILE_FLAGS}> ) target_link_libraries (hl_f90_tstds-shared @@ -80,7 +80,7 @@ if (BUILD_SHARED_LIBS) ) target_compile_options(hl_f90_tstlite-shared PRIVATE - $<$:"/dll"> + $<$:/dll> $<$:${WIN_COMPILE_FLAGS}> ) target_link_libraries (hl_f90_tstlite-shared @@ -126,7 +126,7 @@ if (BUILD_SHARED_LIBS) ) target_compile_options(hl_f90_tstimage-shared PRIVATE - $<$:"/dll"> + $<$:/dll> $<$:${WIN_COMPILE_FLAGS}> ) target_link_libraries (hl_f90_tstimage-shared @@ -172,7 +172,7 @@ if (BUILD_SHARED_LIBS) ) target_compile_options(hl_f90_tsttable-shared PRIVATE - $<$:"/dll"> + $<$:/dll> $<$:${WIN_COMPILE_FLAGS}> ) target_link_libraries (hl_f90_tsttable-shared -- cgit v0.12 From 0c77fbaeb90b6b1e97b219c8176f8a02f2b57655 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 2 May 2018 13:52:02 -0500 Subject: Fix defs and additional MSVC items --- fortran/src/CMakeLists.txt | 9 ++++----- fortran/test/CMakeLists.txt | 7 +++---- hl/fortran/src/CMakeLists.txt | 6 +++--- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index 4ab51d2..c36487f 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -252,7 +252,7 @@ target_include_directories (${HDF5_F90_LIB_TARGET} ) target_compile_definitions(${HDF5_F90_LIB_TARGET} PRIVATE - $<$:"HDF5F90_WINDOWS"> + $<$:HDF5F90_WINDOWS> $<$:${WIN_COMPILE_FLAGS}> ) target_link_libraries (${HDF5_F90_LIB_TARGET} @@ -286,7 +286,7 @@ if (BUILD_SHARED_LIBS) PUBLIC "H5_BUILT_AS_DYNAMIC_LIB" PRIVATE - $<$:"BUILD_HDF5_DLL;HDF5F90_WINDOWS"> + $<$:BUILD_HDF5_DLL;HDF5F90_WINDOWS> $<$:/dll> $<$:${WIN_COMPILE_FLAGS}> ) @@ -295,9 +295,7 @@ if (BUILD_SHARED_LIBS) ${HDF5_F90_C_LIBSH_TARGET} PRIVATE ${LINK_Fortran_LIBS} $<$:${MPI_Fortran_LIBRARIES}> - INTERFACE - $<$:"/DLL /DEF:${HDF5_F90_SRC_BINARY_DIR}/hdf5_fortrandll.def"> - ) +- ) set_target_properties (${HDF5_F90_LIBSH_TARGET} PROPERTIES FOLDER libraries/fortran LINKER_LANGUAGE Fortran @@ -305,6 +303,7 @@ if (BUILD_SHARED_LIBS) LINK_FLAGS "" $<$:"-SUBSYSTEM:CONSOLE"> $<$:${WIN_LINK_FLAGS}> + $<$:"-DLL -DEF:${HDF5_F90_SRC_BINARY_DIR}/hdf5_fortrandll.def"> ) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_F90_LIBSH_TARGET}") H5_SET_LIB_OPTIONS (${HDF5_F90_LIBSH_TARGET} ${HDF5_F90_LIB_NAME} SHARED "F") diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index e81fab7..13cea5a 100644 --- a/fortran/test/CMakeLists.txt +++ b/fortran/test/CMakeLists.txt @@ -122,7 +122,7 @@ target_include_directories (${HDF5_F90_TEST_LIB_TARGET} ) target_compile_definitions(${HDF5_F90_TEST_LIB_TARGET} PRIVATE - $<$:"HDF5F90_WINDOWS"> + $<$:HDF5F90_WINDOWS> $<$:${WIN_COMPILE_FLAGS}> ) target_link_libraries (${HDF5_F90_TEST_LIB_TARGET} @@ -152,21 +152,20 @@ if (BUILD_SHARED_LIBS) PUBLIC "H5_BUILT_AS_DYNAMIC_LIB" PRIVATE - $<$:"BUILD_HDF5_TEST_DLL;HDF5F90_WINDOWS"> + $<$:BUILD_HDF5_TEST_DLL;HDF5F90_WINDOWS> $<$:/dll> $<$:${WIN_COMPILE_FLAGS}> ) target_link_libraries (${HDF5_F90_TEST_LIBSH_TARGET} PUBLIC ${HDF5_F90_C_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} - INTERFACE - $<$:"/DLL"> ) set_target_properties (${HDF5_F90_TEST_LIBSH_TARGET} PROPERTIES FOLDER libraries/test/fortran LINKER_LANGUAGE Fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared LINK_FLAGS "" + $<$:"-DLL"> $<$:"-SUBSYSTEM:CONSOLE"> $<$:${WIN_LINK_FLAGS}> ) diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt index 9999261..b032956 100644 --- a/hl/fortran/src/CMakeLists.txt +++ b/hl/fortran/src/CMakeLists.txt @@ -156,7 +156,7 @@ target_include_directories (${HDF5_HL_F90_LIB_TARGET} ) target_compile_definitions(${HDF5_HL_F90_LIB_TARGET} PUBLIC - $<$:"HDF5F90_WINDOWS"> + $<$:HDF5F90_WINDOWS> PRIVATE $<$:${WIN_COMPILE_FLAGS}> ) @@ -189,7 +189,7 @@ if (BUILD_SHARED_LIBS) PUBLIC "H5_BUILT_AS_DYNAMIC_LIB" PRIVATE - $<$:"BUILD_HDF5_HL_DLL;HDF5F90_WINDOWS"> + $<$:BUILD_HDF5_HL_DLL;HDF5F90_WINDOWS> $<$:/dll> $<$:${WIN_COMPILE_FLAGS}> ) @@ -199,7 +199,7 @@ if (BUILD_SHARED_LIBS) PRIVATE ${LINK_Fortran_LIBS} INTERFACE - $<$:"/DLL /DEF:${HDF5_HL_F90_SRC_BINARY_DIR}/hdf5_hl_fortrandll.def"> + $<$:"-DLL -DEF:${HDF5_HL_F90_SRC_BINARY_DIR}/hdf5_hl_fortrandll.def"> ) set_target_properties (${HDF5_HL_F90_LIBSH_TARGET} PROPERTIES FOLDER libraries/hl/fortran -- cgit v0.12 From d3a49988eb82bd44cfb426014e99952a3de6c823 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 2 May 2018 15:15:13 -0500 Subject: Refactor link flags --- fortran/src/CMakeLists.txt | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index c36487f..f21a9ba 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -259,15 +259,16 @@ target_link_libraries (${HDF5_F90_LIB_TARGET} PUBLIC ${HDF5_F90_C_LIB_TARGET} PRIVATE - ${LINK_Fortran_LIBS} $<$:${MPI_Fortran_LIBRARIES}> + ${LINK_Fortran_LIBS} + $<$:${MPI_Fortran_LIBRARIES}> + INTERFACE + $<$:"-SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) set_target_properties (${HDF5_F90_LIB_TARGET} PROPERTIES FOLDER libraries/fortran LINKER_LANGUAGE Fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static - LINK_FLAGS "" - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> ) H5_SET_LIB_OPTIONS (${HDF5_F90_LIB_TARGET} ${HDF5_F90_LIB_NAME} STATIC 0) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_F90_LIB_TARGET}") @@ -295,15 +296,16 @@ if (BUILD_SHARED_LIBS) ${HDF5_F90_C_LIBSH_TARGET} PRIVATE ${LINK_Fortran_LIBS} $<$:${MPI_Fortran_LIBRARIES}> -- ) + INTERFACE + $<$:"-SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> + $<$:"-DLL"> + $<$:"-DEF:${HDF5_F90_SRC_BINARY_DIR}/hdf5_fortrandll.def"> + ) set_target_properties (${HDF5_F90_LIBSH_TARGET} PROPERTIES FOLDER libraries/fortran LINKER_LANGUAGE Fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared - LINK_FLAGS "" - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> - $<$:"-DLL -DEF:${HDF5_F90_SRC_BINARY_DIR}/hdf5_fortrandll.def"> ) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_F90_LIBSH_TARGET}") H5_SET_LIB_OPTIONS (${HDF5_F90_LIBSH_TARGET} ${HDF5_F90_LIB_NAME} SHARED "F") -- cgit v0.12 From d906f2dcc5de59adde8335107d7fc9631a47face Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 2 May 2018 15:42:38 -0500 Subject: refactor link flags to interface --- fortran/examples/CMakeLists.txt | 36 +++++++------- fortran/src/CMakeLists.txt | 21 +++++---- fortran/test/CMakeLists.txt | 97 ++++++++++++++++++++------------------ fortran/testpar/CMakeLists.txt | 6 +-- hl/fortran/examples/CMakeLists.txt | 6 +-- hl/fortran/src/CMakeLists.txt | 14 +++--- hl/fortran/test/CMakeLists.txt | 48 +++++++++---------- 7 files changed, 119 insertions(+), 109 deletions(-) diff --git a/fortran/examples/CMakeLists.txt b/fortran/examples/CMakeLists.txt index ad3c9c6..32f22e4 100644 --- a/fortran/examples/CMakeLists.txt +++ b/fortran/examples/CMakeLists.txt @@ -46,14 +46,14 @@ foreach (example ${examples}) target_link_libraries (f90_ex_${example} PRIVATE ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} + INTERFACE + $<$:"-SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) set_target_properties (f90_ex_${example} PROPERTIES LINKER_LANGUAGE Fortran FOLDER examples/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static - LINK_FLAGS "" - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> ) if (BUILD_SHARED_LIBS) add_executable (f90_ex_${example}-shared ${HDF5_F90_EXAMPLES_SOURCE_DIR}/${example}.f90) @@ -69,14 +69,14 @@ foreach (example ${examples}) target_link_libraries (f90_ex_${example}-shared PRIVATE ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} + INTERFACE + $<$:"-SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) set_target_properties (f90_ex_${example}-shared PROPERTIES LINKER_LANGUAGE Fortran FOLDER examples/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared - LINK_FLAGS "" - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> ) endif () endforeach () @@ -94,14 +94,14 @@ foreach (example ${F2003_examples}) target_link_libraries (f03_ex_${example} PRIVATE ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} + INTERFACE + $<$:"-SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) set_target_properties (f03_ex_${example} PROPERTIES LINKER_LANGUAGE Fortran FOLDER examples/fortran03 Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static - LINK_FLAGS "" - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> ) if (BUILD_SHARED_LIBS) add_executable (f03_ex_${example}-shared ${HDF5_F90_EXAMPLES_SOURCE_DIR}/${example}.f90) @@ -117,14 +117,14 @@ foreach (example ${F2003_examples}) target_link_libraries (f03_ex_${example}-shared PRIVATE ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} + INTERFACE + $<$:"-SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) set_target_properties (f03_ex_${example}-shared PROPERTIES LINKER_LANGUAGE Fortran FOLDER examples/fortran03 Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared - LINK_FLAGS "" - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> ) endif () endforeach () @@ -142,14 +142,14 @@ if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) target_link_libraries (f90_ex_ph5example PRIVATE ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} + INTERFACE + $<$:"-SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) set_target_properties (f90_ex_ph5example PROPERTIES LINKER_LANGUAGE Fortran FOLDER examples/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static - LINK_FLAGS "" - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> ) if (BUILD_SHARED_LIBS) add_executable (f90_ex_ph5example-shared ${HDF5_F90_EXAMPLES_SOURCE_DIR}/ph5example.f90) @@ -165,14 +165,14 @@ if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) target_link_libraries (f90_ex_ph5example-shared PRIVATE ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} + INTERFACE + $<$:"-SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) set_target_properties (f90_ex_ph5example-shared PROPERTIES LINKER_LANGUAGE Fortran FOLDER examples/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared - LINK_FLAGS "" - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> ) endif () endif () diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index f21a9ba..c4df92f 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -43,16 +43,21 @@ set (Fortran_COMPILER_ID CMAKE_Fortran_COMPILER_ID) # H5fort_type_defines.h used to generate H5f90i_gen.h + H5fortran_types.F90 #----------------------------------------------------------------------------- -add_executable (H5_buildiface - ${HDF5_F90_SRC_SOURCE_DIR}/H5_buildiface.F90 +add_executable (H5_buildiface ${HDF5_F90_SRC_SOURCE_DIR}/H5_buildiface.F90) +target_include_directories(H5_buildiface + PRIVATE + "${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR}" +) +if (BUILD_SHARED_LIBS) + target_compile_definitions(H5_buildiface + PRIVATE + $<$:/MT> ) -target_include_directories(H5_buildiface PRIVATE "${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR}") -if (WIN32 AND MSVC) - if (BUILD_SHARED_LIBS) - set_target_properties (H5_buildiface PROPERTIES COMPILE_FLAGS "/MT") - endif () - set_target_properties (H5_buildiface PROPERTIES LINK_FLAGS "-SUBSYSTEM:CONSOLE") endif () +target_link_libraries (H5_buildiface + INTERFACE + $<$:"-SUBSYSTEM:CONSOLE"> +) set_target_properties (H5_buildiface PROPERTIES LINKER_LANGUAGE Fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY} diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index 13cea5a..e3f68d1 100644 --- a/fortran/test/CMakeLists.txt +++ b/fortran/test/CMakeLists.txt @@ -6,16 +6,21 @@ project (HDF5_FORTRAN_TESTS C Fortran) # H5_test_buildiface.F90 used to generate various KIND test interfaces #----------------------------------------------------------------------------- -add_executable (H5_test_buildiface - ${HDF5_F90_SRC_DIR}/test/H5_test_buildiface.F90 - ) -target_include_directories(H5_test_buildiface PRIVATE ${HDF5_BINARY_DIR} ${HDF5_F90_BINARY_DIR}) -if (WIN32 AND MSVC) - if (BUILD_SHARED_LIBS) - set_target_properties (H5_test_buildiface PROPERTIES COMPILE_FLAGS "/MT") - endif () - set_target_properties (H5_test_buildiface PROPERTIES LINK_FLAGS "-SUBSYSTEM:CONSOLE") +add_executable (H5_test_buildiface ${HDF5_F90_SRC_DIR}/test/H5_test_buildiface.F90) +target_include_directories(H5_test_buildiface + PRIVATE + ${HDF5_BINARY_DIR} ${HDF5_F90_BINARY_DIR} +) +if (BUILD_SHARED_LIBS) + target_compile_definitions(H5_test_buildiface + PRIVATE + $<$:/MT> + ) endif () +target_link_libraries (H5_test_buildiface + INTERFACE + $<$:"-SUBSYSTEM:CONSOLE"> +) set_target_properties (H5_test_buildiface PROPERTIES LINKER_LANGUAGE Fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY} @@ -128,14 +133,14 @@ target_compile_definitions(${HDF5_F90_TEST_LIB_TARGET} target_link_libraries (${HDF5_F90_TEST_LIB_TARGET} PUBLIC ${HDF5_F90_C_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} + INTERFACE + $<$:"-SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) set_target_properties (${HDF5_F90_TEST_LIB_TARGET} PROPERTIES FOLDER libraries/test/fortran LINKER_LANGUAGE Fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static - LINK_FLAGS "" - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> ) H5_SET_LIB_OPTIONS (${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_TEST_LIB_NAME} STATIC 0) add_dependencies(${HDF5_F90_TEST_LIB_TARGET} H5testgen) @@ -159,15 +164,15 @@ if (BUILD_SHARED_LIBS) target_link_libraries (${HDF5_F90_TEST_LIBSH_TARGET} PUBLIC ${HDF5_F90_C_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} + INTERFACE + $<$:"-SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> + $<$:"-DLL"> ) set_target_properties (${HDF5_F90_TEST_LIBSH_TARGET} PROPERTIES FOLDER libraries/test/fortran LINKER_LANGUAGE Fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared - LINK_FLAGS "" - $<$:"-DLL"> - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> ) H5_SET_LIB_OPTIONS (${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_TEST_LIB_NAME} SHARED "F") add_dependencies(${HDF5_F90_TEST_LIBSH_TARGET} H5testgenSH) @@ -205,14 +210,14 @@ target_compile_options(testhdf5_fortran target_link_libraries (testhdf5_fortran PRIVATE ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} $<$:ws2_32.lib> + INTERFACE + $<$:"-SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) set_target_properties (testhdf5_fortran PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static - LINK_FLAGS "" - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> ) add_dependencies (testhdf5_fortran ${HDF5_F90_TEST_LIB_TARGET}) @@ -246,14 +251,14 @@ if (BUILD_SHARED_LIBS) target_link_libraries (testhdf5_fortran-shared PRIVATE ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$:ws2_32.lib> + INTERFACE + $<$:"-SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) set_target_properties (testhdf5_fortran-shared PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared - LINK_FLAGS "" - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> ) add_dependencies (testhdf5_fortran-shared ${HDF5_F90_TEST_LIBSH_TARGET}) endif () @@ -278,14 +283,14 @@ target_compile_options(testhdf5_fortran_1_8 target_link_libraries (testhdf5_fortran_1_8 PRIVATE ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} $<$:ws2_32.lib> + INTERFACE + $<$:"-SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) set_target_properties (testhdf5_fortran_1_8 PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static - LINK_FLAGS "" - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> ) add_dependencies (testhdf5_fortran_1_8 ${HDF5_F90_TEST_LIB_TARGET}) @@ -310,14 +315,14 @@ if (BUILD_SHARED_LIBS) target_link_libraries (testhdf5_fortran_1_8-shared PRIVATE ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$:ws2_32.lib> + INTERFACE + $<$:"-SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) set_target_properties (testhdf5_fortran_1_8-shared PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared - LINK_FLAGS "" - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> ) add_dependencies (testhdf5_fortran_1_8-shared ${HDF5_F90_TEST_LIBSH_TARGET}) endif () @@ -344,14 +349,14 @@ target_compile_options(fortranlib_test_F03 target_link_libraries (fortranlib_test_F03 PRIVATE ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} $<$:ws2_32.lib> + INTERFACE + $<$:"-SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) set_target_properties (fortranlib_test_F03 PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static - LINK_FLAGS "" - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> ) add_dependencies (fortranlib_test_F03 ${HDF5_F90_TEST_LIB_TARGET}) @@ -378,14 +383,14 @@ if (BUILD_SHARED_LIBS) target_link_libraries (fortranlib_test_F03-shared PRIVATE ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$:ws2_32.lib> + INTERFACE + $<$:"-SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) set_target_properties (fortranlib_test_F03-shared PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared - LINK_FLAGS "" - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> ) add_dependencies (fortranlib_test_F03-shared ${HDF5_F90_TEST_LIBSH_TARGET}) endif () @@ -403,14 +408,14 @@ target_compile_options(fflush1 target_link_libraries (fflush1 PRIVATE ${HDF5_F90_LIB_TARGET} ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_LIB_TARGET} $<$:ws2_32.lib> + INTERFACE + $<$:"-SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) set_target_properties (fflush1 PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static - LINK_FLAGS "" - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> ) add_dependencies (fflush1 ${HDF5_F90_TEST_LIB_TARGET}) @@ -428,14 +433,14 @@ if (BUILD_SHARED_LIBS) target_link_libraries (fflush1-shared PRIVATE ${HDF5_F90_LIBSH_TARGET} ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$:ws2_32.lib> + INTERFACE + $<$:"-SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) set_target_properties (fflush1-shared PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared - LINK_FLAGS "" - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> ) add_dependencies (fflush1-shared ${HDF5_F90_TEST_LIBSH_TARGET}) endif () @@ -453,14 +458,14 @@ target_compile_options (fflush2 target_link_libraries (fflush2 PRIVATE ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} $<$:ws2_32.lib> + INTERFACE + $<$:"-SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) set_target_properties (fflush2 PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static - LINK_FLAGS "" - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> ) add_dependencies (fflush2 ${HDF5_F90_TEST_LIB_TARGET}) @@ -478,14 +483,14 @@ if (BUILD_SHARED_LIBS) target_link_libraries (fflush2-shared PRIVATE ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$:ws2_32.lib> + INTERFACE + $<$:"-SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) set_target_properties (fflush2-shared PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared - LINK_FLAGS "" - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> ) add_dependencies (fflush2-shared ${HDF5_F90_TEST_LIBSH_TARGET}) endif () diff --git a/fortran/testpar/CMakeLists.txt b/fortran/testpar/CMakeLists.txt index b0a1820..86ce11e 100644 --- a/fortran/testpar/CMakeLists.txt +++ b/fortran/testpar/CMakeLists.txt @@ -28,13 +28,13 @@ target_link_libraries (parallel_test PRIVATE ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} ${LINK_Fortran_LIBS} $<$:"ws2_32.lib"> + INTERFACE + $<$:"-SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) set_target_properties (parallel_test PROPERTIES FOLDER test/fortran LINKER_LANGUAGE Fortran - LINK_FLAGS - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> ) endif () diff --git a/hl/fortran/examples/CMakeLists.txt b/hl/fortran/examples/CMakeLists.txt index a218de5..bdd852a 100644 --- a/hl/fortran/examples/CMakeLists.txt +++ b/hl/fortran/examples/CMakeLists.txt @@ -19,13 +19,13 @@ foreach (example ${examples}) target_link_libraries (hl_f90_ex_${example} PRIVATE ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} + INTERFACE + $<$:"-SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) set_target_properties (hl_f90_ex_${example} PROPERTIES LINKER_LANGUAGE Fortran FOLDER examples/hl/fortran - LINK_FLAGS "" - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> ) endforeach () diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt index b032956..ef8e5fd 100644 --- a/hl/fortran/src/CMakeLists.txt +++ b/hl/fortran/src/CMakeLists.txt @@ -163,14 +163,14 @@ target_compile_definitions(${HDF5_HL_F90_LIB_TARGET} target_link_libraries (${HDF5_HL_F90_LIB_TARGET} PUBLIC ${HDF5_HL_F90_C_LIB_TARGET} ${HDF5_F90_LIB_TARGET} + INTERFACE + $<$:"-SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) set_target_properties (${HDF5_HL_F90_LIB_TARGET} PROPERTIES FOLDER libraries/hl/fortran LINKER_LANGUAGE Fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static - LINK_FLAGS "" - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> ) H5_SET_LIB_OPTIONS (${HDF5_HL_F90_LIB_TARGET} ${HDF5_HL_F90_LIB_NAME} STATIC 0) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_F90_LIB_TARGET}") @@ -199,15 +199,15 @@ if (BUILD_SHARED_LIBS) PRIVATE ${LINK_Fortran_LIBS} INTERFACE - $<$:"-DLL -DEF:${HDF5_HL_F90_SRC_BINARY_DIR}/hdf5_hl_fortrandll.def"> + $<$:"-DLL"> + $<$:"-DEF:${HDF5_HL_F90_SRC_BINARY_DIR}/hdf5_hl_fortrandll.def"> + $<$:"-SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) set_target_properties (${HDF5_HL_F90_LIBSH_TARGET} PROPERTIES FOLDER libraries/hl/fortran LINKER_LANGUAGE Fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared - LINK_FLAGS "" - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> ) H5_SET_LIB_OPTIONS (${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_HL_F90_LIB_NAME} SHARED "HL_F") set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_F90_LIBSH_TARGET}") diff --git a/hl/fortran/test/CMakeLists.txt b/hl/fortran/test/CMakeLists.txt index a639d9c..7721e0f 100644 --- a/hl/fortran/test/CMakeLists.txt +++ b/hl/fortran/test/CMakeLists.txt @@ -18,13 +18,13 @@ target_compile_options(hl_f90_tstds target_link_libraries (hl_f90_tstds PRIVATE ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET} + INTERFACE + $<$:"-SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) set_target_properties (hl_f90_tstds PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/hl/fortran - LINK_FLAGS "" - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> ) if (BUILD_SHARED_LIBS) add_executable (hl_f90_tstds-shared tstds.F90) @@ -40,14 +40,14 @@ if (BUILD_SHARED_LIBS) target_link_libraries (hl_f90_tstds-shared PRIVATE ${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} + INTERFACE + $<$:"-SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) set_target_properties (hl_f90_tstds-shared PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/hl/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared - LINK_FLAGS "" - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> ) endif () @@ -64,13 +64,13 @@ target_compile_options(hl_f90_tstlite target_link_libraries (hl_f90_tstlite PRIVATE ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_F90_TEST_LIB_TARGET} + INTERFACE + $<$:"-SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) set_target_properties (hl_f90_tstlite PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/hl/fortran - LINK_FLAGS "" - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> ) if (BUILD_SHARED_LIBS) add_executable (hl_f90_tstlite-shared tstlite.F90) @@ -86,14 +86,14 @@ if (BUILD_SHARED_LIBS) target_link_libraries (hl_f90_tstlite-shared PRIVATE ${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_F90_TEST_LIBSH_TARGET} + INTERFACE + $<$:"-SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) set_target_properties (hl_f90_tstlite-shared PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/hl/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared - LINK_FLAGS "" - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> ) endif () @@ -110,13 +110,13 @@ target_compile_options(hl_f90_tstimage target_link_libraries (hl_f90_tstimage PRIVATE ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET} + INTERFACE + $<$:"-SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) set_target_properties (hl_f90_tstimage PROPERTIES FOLDER test/hl/fortran LINKER_LANGUAGE Fortran - LINK_FLAGS "" - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> ) if (BUILD_SHARED_LIBS) add_executable (hl_f90_tstimage-shared tstimage.F90) @@ -132,14 +132,14 @@ if (BUILD_SHARED_LIBS) target_link_libraries (hl_f90_tstimage-shared PRIVATE ${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} + INTERFACE + $<$:"-SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) set_target_properties (hl_f90_tstimage-shared PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/hl/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared - LINK_FLAGS "" - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> ) endif () @@ -156,13 +156,13 @@ target_compile_options(hl_f90_tsttable target_link_libraries (hl_f90_tsttable PRIVATE ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_F90_TEST_LIB_TARGET} + INTERFACE + $<$:"-SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) set_target_properties (hl_f90_tsttable PROPERTIES FOLDER test/hl/fortran LINKER_LANGUAGE Fortran - LINK_FLAGS "" - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> ) if (BUILD_SHARED_LIBS) add_executable (hl_f90_tsttable-shared tsttable.F90) @@ -178,14 +178,14 @@ if (BUILD_SHARED_LIBS) target_link_libraries (hl_f90_tsttable-shared PRIVATE ${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_F90_TEST_LIBSH_TARGET} + INTERFACE + $<$:"-SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) set_target_properties (hl_f90_tsttable-shared PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/hl/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared - LINK_FLAGS "" - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> ) endif () -- cgit v0.12 From b73c0d2ab8c814634e44fa2d4b22abfaacdc1b67 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 2 May 2018 16:33:35 -0500 Subject: Revert refactor link flags --- fortran/examples/CMakeLists.txt | 36 ++++++++--------- fortran/src/CMakeLists.txt | 22 +++++------ fortran/test/CMakeLists.txt | 80 +++++++++++++++++++------------------- fortran/testpar/CMakeLists.txt | 6 +-- hl/fortran/examples/CMakeLists.txt | 6 +-- hl/fortran/src/CMakeLists.txt | 16 ++++---- hl/fortran/test/CMakeLists.txt | 48 +++++++++++------------ 7 files changed, 105 insertions(+), 109 deletions(-) diff --git a/fortran/examples/CMakeLists.txt b/fortran/examples/CMakeLists.txt index 32f22e4..ad3c9c6 100644 --- a/fortran/examples/CMakeLists.txt +++ b/fortran/examples/CMakeLists.txt @@ -46,14 +46,14 @@ foreach (example ${examples}) target_link_libraries (f90_ex_${example} PRIVATE ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} - INTERFACE - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> ) set_target_properties (f90_ex_${example} PROPERTIES LINKER_LANGUAGE Fortran FOLDER examples/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static + LINK_FLAGS "" + $<$:"-SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) if (BUILD_SHARED_LIBS) add_executable (f90_ex_${example}-shared ${HDF5_F90_EXAMPLES_SOURCE_DIR}/${example}.f90) @@ -69,14 +69,14 @@ foreach (example ${examples}) target_link_libraries (f90_ex_${example}-shared PRIVATE ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} - INTERFACE - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> ) set_target_properties (f90_ex_${example}-shared PROPERTIES LINKER_LANGUAGE Fortran FOLDER examples/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared + LINK_FLAGS "" + $<$:"-SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) endif () endforeach () @@ -94,14 +94,14 @@ foreach (example ${F2003_examples}) target_link_libraries (f03_ex_${example} PRIVATE ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} - INTERFACE - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> ) set_target_properties (f03_ex_${example} PROPERTIES LINKER_LANGUAGE Fortran FOLDER examples/fortran03 Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static + LINK_FLAGS "" + $<$:"-SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) if (BUILD_SHARED_LIBS) add_executable (f03_ex_${example}-shared ${HDF5_F90_EXAMPLES_SOURCE_DIR}/${example}.f90) @@ -117,14 +117,14 @@ foreach (example ${F2003_examples}) target_link_libraries (f03_ex_${example}-shared PRIVATE ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} - INTERFACE - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> ) set_target_properties (f03_ex_${example}-shared PROPERTIES LINKER_LANGUAGE Fortran FOLDER examples/fortran03 Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared + LINK_FLAGS "" + $<$:"-SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) endif () endforeach () @@ -142,14 +142,14 @@ if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) target_link_libraries (f90_ex_ph5example PRIVATE ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} - INTERFACE - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> ) set_target_properties (f90_ex_ph5example PROPERTIES LINKER_LANGUAGE Fortran FOLDER examples/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static + LINK_FLAGS "" + $<$:"-SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) if (BUILD_SHARED_LIBS) add_executable (f90_ex_ph5example-shared ${HDF5_F90_EXAMPLES_SOURCE_DIR}/ph5example.f90) @@ -165,14 +165,14 @@ if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) target_link_libraries (f90_ex_ph5example-shared PRIVATE ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} - INTERFACE - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> ) set_target_properties (f90_ex_ph5example-shared PROPERTIES LINKER_LANGUAGE Fortran FOLDER examples/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared + LINK_FLAGS "" + $<$:"-SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) endif () endif () diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index c4df92f..199c541 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -54,13 +54,11 @@ if (BUILD_SHARED_LIBS) $<$:/MT> ) endif () -target_link_libraries (H5_buildiface - INTERFACE - $<$:"-SUBSYSTEM:CONSOLE"> -) set_target_properties (H5_buildiface PROPERTIES LINKER_LANGUAGE Fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY} + LINK_FLAGS "" + $<$:"-SUBSYSTEM:CONSOLE"> ) if (BUILD_SHARED_LIBS) @@ -266,14 +264,14 @@ target_link_libraries (${HDF5_F90_LIB_TARGET} PRIVATE ${LINK_Fortran_LIBS} $<$:${MPI_Fortran_LIBRARIES}> - INTERFACE - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> ) set_target_properties (${HDF5_F90_LIB_TARGET} PROPERTIES FOLDER libraries/fortran LINKER_LANGUAGE Fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static + LINK_FLAGS "" + $<$:"-SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) H5_SET_LIB_OPTIONS (${HDF5_F90_LIB_TARGET} ${HDF5_F90_LIB_NAME} STATIC 0) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_F90_LIB_TARGET}") @@ -301,16 +299,16 @@ if (BUILD_SHARED_LIBS) ${HDF5_F90_C_LIBSH_TARGET} PRIVATE ${LINK_Fortran_LIBS} $<$:${MPI_Fortran_LIBRARIES}> - INTERFACE - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> - $<$:"-DLL"> - $<$:"-DEF:${HDF5_F90_SRC_BINARY_DIR}/hdf5_fortrandll.def"> ) set_target_properties (${HDF5_F90_LIBSH_TARGET} PROPERTIES FOLDER libraries/fortran LINKER_LANGUAGE Fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared + LINK_FLAGS "" + $<$:"-SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> + $<$:"-DLL"> + $<$:"-DEF:${HDF5_F90_SRC_BINARY_DIR}/hdf5_fortrandll.def"> ) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_F90_LIBSH_TARGET}") H5_SET_LIB_OPTIONS (${HDF5_F90_LIBSH_TARGET} ${HDF5_F90_LIB_NAME} SHARED "F") diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index e3f68d1..dbcae59 100644 --- a/fortran/test/CMakeLists.txt +++ b/fortran/test/CMakeLists.txt @@ -17,13 +17,11 @@ if (BUILD_SHARED_LIBS) $<$:/MT> ) endif () -target_link_libraries (H5_test_buildiface - INTERFACE - $<$:"-SUBSYSTEM:CONSOLE"> -) set_target_properties (H5_test_buildiface PROPERTIES LINKER_LANGUAGE Fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY} + LINK_FLAGS "" + $<$:"-SUBSYSTEM:CONSOLE"> ) if (BUILD_SHARED_LIBS) @@ -133,14 +131,14 @@ target_compile_definitions(${HDF5_F90_TEST_LIB_TARGET} target_link_libraries (${HDF5_F90_TEST_LIB_TARGET} PUBLIC ${HDF5_F90_C_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} - INTERFACE - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> ) set_target_properties (${HDF5_F90_TEST_LIB_TARGET} PROPERTIES FOLDER libraries/test/fortran LINKER_LANGUAGE Fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static + LINK_FLAGS "" + $<$:"-SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) H5_SET_LIB_OPTIONS (${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_TEST_LIB_NAME} STATIC 0) add_dependencies(${HDF5_F90_TEST_LIB_TARGET} H5testgen) @@ -164,15 +162,15 @@ if (BUILD_SHARED_LIBS) target_link_libraries (${HDF5_F90_TEST_LIBSH_TARGET} PUBLIC ${HDF5_F90_C_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} - INTERFACE - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> - $<$:"-DLL"> ) set_target_properties (${HDF5_F90_TEST_LIBSH_TARGET} PROPERTIES FOLDER libraries/test/fortran LINKER_LANGUAGE Fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared + LINK_FLAGS "" + $<$:"-SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> + $<$:"-DLL"> ) H5_SET_LIB_OPTIONS (${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_TEST_LIB_NAME} SHARED "F") add_dependencies(${HDF5_F90_TEST_LIBSH_TARGET} H5testgenSH) @@ -210,14 +208,14 @@ target_compile_options(testhdf5_fortran target_link_libraries (testhdf5_fortran PRIVATE ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} $<$:ws2_32.lib> - INTERFACE - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> ) set_target_properties (testhdf5_fortran PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static + LINK_FLAGS "" + $<$:"-SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) add_dependencies (testhdf5_fortran ${HDF5_F90_TEST_LIB_TARGET}) @@ -251,14 +249,14 @@ if (BUILD_SHARED_LIBS) target_link_libraries (testhdf5_fortran-shared PRIVATE ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$:ws2_32.lib> - INTERFACE - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> ) set_target_properties (testhdf5_fortran-shared PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared + LINK_FLAGS "" + $<$:"-SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) add_dependencies (testhdf5_fortran-shared ${HDF5_F90_TEST_LIBSH_TARGET}) endif () @@ -283,14 +281,14 @@ target_compile_options(testhdf5_fortran_1_8 target_link_libraries (testhdf5_fortran_1_8 PRIVATE ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} $<$:ws2_32.lib> - INTERFACE - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> ) set_target_properties (testhdf5_fortran_1_8 PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static + LINK_FLAGS "" + $<$:"-SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) add_dependencies (testhdf5_fortran_1_8 ${HDF5_F90_TEST_LIB_TARGET}) @@ -315,14 +313,14 @@ if (BUILD_SHARED_LIBS) target_link_libraries (testhdf5_fortran_1_8-shared PRIVATE ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$:ws2_32.lib> - INTERFACE - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> ) set_target_properties (testhdf5_fortran_1_8-shared PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared + LINK_FLAGS "" + $<$:"-SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) add_dependencies (testhdf5_fortran_1_8-shared ${HDF5_F90_TEST_LIBSH_TARGET}) endif () @@ -349,14 +347,14 @@ target_compile_options(fortranlib_test_F03 target_link_libraries (fortranlib_test_F03 PRIVATE ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} $<$:ws2_32.lib> - INTERFACE - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> ) set_target_properties (fortranlib_test_F03 PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static + LINK_FLAGS "" + $<$:"-SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) add_dependencies (fortranlib_test_F03 ${HDF5_F90_TEST_LIB_TARGET}) @@ -383,14 +381,14 @@ if (BUILD_SHARED_LIBS) target_link_libraries (fortranlib_test_F03-shared PRIVATE ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$:ws2_32.lib> - INTERFACE - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> ) set_target_properties (fortranlib_test_F03-shared PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared + LINK_FLAGS "" + $<$:"-SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) add_dependencies (fortranlib_test_F03-shared ${HDF5_F90_TEST_LIBSH_TARGET}) endif () @@ -408,14 +406,14 @@ target_compile_options(fflush1 target_link_libraries (fflush1 PRIVATE ${HDF5_F90_LIB_TARGET} ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_LIB_TARGET} $<$:ws2_32.lib> - INTERFACE - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> ) set_target_properties (fflush1 PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static + LINK_FLAGS "" + $<$:"-SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) add_dependencies (fflush1 ${HDF5_F90_TEST_LIB_TARGET}) @@ -433,14 +431,14 @@ if (BUILD_SHARED_LIBS) target_link_libraries (fflush1-shared PRIVATE ${HDF5_F90_LIBSH_TARGET} ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$:ws2_32.lib> - INTERFACE - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> ) set_target_properties (fflush1-shared PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared + LINK_FLAGS "" + $<$:"-SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) add_dependencies (fflush1-shared ${HDF5_F90_TEST_LIBSH_TARGET}) endif () @@ -458,14 +456,14 @@ target_compile_options (fflush2 target_link_libraries (fflush2 PRIVATE ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} $<$:ws2_32.lib> - INTERFACE - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> ) set_target_properties (fflush2 PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static + LINK_FLAGS "" + $<$:"-SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) add_dependencies (fflush2 ${HDF5_F90_TEST_LIB_TARGET}) @@ -483,14 +481,14 @@ if (BUILD_SHARED_LIBS) target_link_libraries (fflush2-shared PRIVATE ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$:ws2_32.lib> - INTERFACE - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> ) set_target_properties (fflush2-shared PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared + LINK_FLAGS "" + $<$:"-SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) add_dependencies (fflush2-shared ${HDF5_F90_TEST_LIBSH_TARGET}) endif () diff --git a/fortran/testpar/CMakeLists.txt b/fortran/testpar/CMakeLists.txt index 86ce11e..31ae6ba 100644 --- a/fortran/testpar/CMakeLists.txt +++ b/fortran/testpar/CMakeLists.txt @@ -28,13 +28,13 @@ target_link_libraries (parallel_test PRIVATE ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} ${LINK_Fortran_LIBS} $<$:"ws2_32.lib"> - INTERFACE - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> ) set_target_properties (parallel_test PROPERTIES FOLDER test/fortran LINKER_LANGUAGE Fortran + LINK_FLAGS "" + $<$:"-SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) endif () diff --git a/hl/fortran/examples/CMakeLists.txt b/hl/fortran/examples/CMakeLists.txt index bdd852a..a218de5 100644 --- a/hl/fortran/examples/CMakeLists.txt +++ b/hl/fortran/examples/CMakeLists.txt @@ -19,13 +19,13 @@ foreach (example ${examples}) target_link_libraries (hl_f90_ex_${example} PRIVATE ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} - INTERFACE - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> ) set_target_properties (hl_f90_ex_${example} PROPERTIES LINKER_LANGUAGE Fortran FOLDER examples/hl/fortran + LINK_FLAGS "" + $<$:"-SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) endforeach () diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt index ef8e5fd..5eea6bb 100644 --- a/hl/fortran/src/CMakeLists.txt +++ b/hl/fortran/src/CMakeLists.txt @@ -163,14 +163,14 @@ target_compile_definitions(${HDF5_HL_F90_LIB_TARGET} target_link_libraries (${HDF5_HL_F90_LIB_TARGET} PUBLIC ${HDF5_HL_F90_C_LIB_TARGET} ${HDF5_F90_LIB_TARGET} - INTERFACE - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> ) set_target_properties (${HDF5_HL_F90_LIB_TARGET} PROPERTIES FOLDER libraries/hl/fortran LINKER_LANGUAGE Fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static + LINK_FLAGS "" + $<$:"-SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) H5_SET_LIB_OPTIONS (${HDF5_HL_F90_LIB_TARGET} ${HDF5_HL_F90_LIB_NAME} STATIC 0) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_F90_LIB_TARGET}") @@ -198,16 +198,16 @@ if (BUILD_SHARED_LIBS) ${HDF5_HL_F90_C_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} PRIVATE ${LINK_Fortran_LIBS} - INTERFACE - $<$:"-DLL"> - $<$:"-DEF:${HDF5_HL_F90_SRC_BINARY_DIR}/hdf5_hl_fortrandll.def"> - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> ) set_target_properties (${HDF5_HL_F90_LIBSH_TARGET} PROPERTIES FOLDER libraries/hl/fortran LINKER_LANGUAGE Fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared + LINK_FLAGS "" + $<$:"-DLL"> + $<$:"-DEF:${HDF5_HL_F90_SRC_BINARY_DIR}/hdf5_hl_fortrandll.def"> + $<$:"-SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) H5_SET_LIB_OPTIONS (${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_HL_F90_LIB_NAME} SHARED "HL_F") set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_F90_LIBSH_TARGET}") diff --git a/hl/fortran/test/CMakeLists.txt b/hl/fortran/test/CMakeLists.txt index 7721e0f..a639d9c 100644 --- a/hl/fortran/test/CMakeLists.txt +++ b/hl/fortran/test/CMakeLists.txt @@ -18,13 +18,13 @@ target_compile_options(hl_f90_tstds target_link_libraries (hl_f90_tstds PRIVATE ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET} - INTERFACE - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> ) set_target_properties (hl_f90_tstds PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/hl/fortran + LINK_FLAGS "" + $<$:"-SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) if (BUILD_SHARED_LIBS) add_executable (hl_f90_tstds-shared tstds.F90) @@ -40,14 +40,14 @@ if (BUILD_SHARED_LIBS) target_link_libraries (hl_f90_tstds-shared PRIVATE ${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} - INTERFACE - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> ) set_target_properties (hl_f90_tstds-shared PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/hl/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared + LINK_FLAGS "" + $<$:"-SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) endif () @@ -64,13 +64,13 @@ target_compile_options(hl_f90_tstlite target_link_libraries (hl_f90_tstlite PRIVATE ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_F90_TEST_LIB_TARGET} - INTERFACE - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> ) set_target_properties (hl_f90_tstlite PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/hl/fortran + LINK_FLAGS "" + $<$:"-SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) if (BUILD_SHARED_LIBS) add_executable (hl_f90_tstlite-shared tstlite.F90) @@ -86,14 +86,14 @@ if (BUILD_SHARED_LIBS) target_link_libraries (hl_f90_tstlite-shared PRIVATE ${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_F90_TEST_LIBSH_TARGET} - INTERFACE - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> ) set_target_properties (hl_f90_tstlite-shared PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/hl/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared + LINK_FLAGS "" + $<$:"-SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) endif () @@ -110,13 +110,13 @@ target_compile_options(hl_f90_tstimage target_link_libraries (hl_f90_tstimage PRIVATE ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET} - INTERFACE - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> ) set_target_properties (hl_f90_tstimage PROPERTIES FOLDER test/hl/fortran LINKER_LANGUAGE Fortran + LINK_FLAGS "" + $<$:"-SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) if (BUILD_SHARED_LIBS) add_executable (hl_f90_tstimage-shared tstimage.F90) @@ -132,14 +132,14 @@ if (BUILD_SHARED_LIBS) target_link_libraries (hl_f90_tstimage-shared PRIVATE ${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} - INTERFACE - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> ) set_target_properties (hl_f90_tstimage-shared PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/hl/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared + LINK_FLAGS "" + $<$:"-SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) endif () @@ -156,13 +156,13 @@ target_compile_options(hl_f90_tsttable target_link_libraries (hl_f90_tsttable PRIVATE ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_F90_TEST_LIB_TARGET} - INTERFACE - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> ) set_target_properties (hl_f90_tsttable PROPERTIES FOLDER test/hl/fortran LINKER_LANGUAGE Fortran + LINK_FLAGS "" + $<$:"-SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) if (BUILD_SHARED_LIBS) add_executable (hl_f90_tsttable-shared tsttable.F90) @@ -178,14 +178,14 @@ if (BUILD_SHARED_LIBS) target_link_libraries (hl_f90_tsttable-shared PRIVATE ${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_F90_TEST_LIBSH_TARGET} - INTERFACE - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> ) set_target_properties (hl_f90_tsttable-shared PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/hl/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared + LINK_FLAGS "" + $<$:"-SUBSYSTEM:CONSOLE"> + $<$:${WIN_LINK_FLAGS}> ) endif () -- cgit v0.12 From 1ab0814a4320eb8a4b93a85048419302218aeb34 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 3 May 2018 09:28:54 -0500 Subject: Fix link flags syntax --- fortran/examples/CMakeLists.txt | 36 +++++++++--------- fortran/src/CMakeLists.txt | 20 +++++----- fortran/test/CMakeLists.txt | 78 +++++++++++++++++++------------------- fortran/testpar/CMakeLists.txt | 6 +-- hl/fortran/examples/CMakeLists.txt | 6 +-- hl/fortran/src/CMakeLists.txt | 19 +++++----- hl/fortran/test/CMakeLists.txt | 48 +++++++++++------------ 7 files changed, 107 insertions(+), 106 deletions(-) diff --git a/fortran/examples/CMakeLists.txt b/fortran/examples/CMakeLists.txt index ad3c9c6..3347480 100644 --- a/fortran/examples/CMakeLists.txt +++ b/fortran/examples/CMakeLists.txt @@ -51,9 +51,9 @@ foreach (example ${examples}) LINKER_LANGUAGE Fortran FOLDER examples/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static - LINK_FLAGS "" - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> + LINK_FLAGS + "$<$:\"-SUBSYSTEM:CONSOLE\"> + $<$:${WIN_LINK_FLAGS}>" ) if (BUILD_SHARED_LIBS) add_executable (f90_ex_${example}-shared ${HDF5_F90_EXAMPLES_SOURCE_DIR}/${example}.f90) @@ -74,9 +74,9 @@ foreach (example ${examples}) LINKER_LANGUAGE Fortran FOLDER examples/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared - LINK_FLAGS "" - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> + LINK_FLAGS + "$<$:\"-SUBSYSTEM:CONSOLE\"> + $<$:${WIN_LINK_FLAGS}>" ) endif () endforeach () @@ -99,9 +99,9 @@ foreach (example ${F2003_examples}) LINKER_LANGUAGE Fortran FOLDER examples/fortran03 Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static - LINK_FLAGS "" - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> + LINK_FLAGS + "$<$:\"-SUBSYSTEM:CONSOLE\"> + $<$:${WIN_LINK_FLAGS}>" ) if (BUILD_SHARED_LIBS) add_executable (f03_ex_${example}-shared ${HDF5_F90_EXAMPLES_SOURCE_DIR}/${example}.f90) @@ -122,9 +122,9 @@ foreach (example ${F2003_examples}) LINKER_LANGUAGE Fortran FOLDER examples/fortran03 Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared - LINK_FLAGS "" - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> + LINK_FLAGS + "$<$:\"-SUBSYSTEM:CONSOLE\"> + $<$:${WIN_LINK_FLAGS}>" ) endif () endforeach () @@ -147,9 +147,9 @@ if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) LINKER_LANGUAGE Fortran FOLDER examples/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static - LINK_FLAGS "" - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> + LINK_FLAGS + "$<$:\"-SUBSYSTEM:CONSOLE\"> + $<$:${WIN_LINK_FLAGS}>" ) if (BUILD_SHARED_LIBS) add_executable (f90_ex_ph5example-shared ${HDF5_F90_EXAMPLES_SOURCE_DIR}/ph5example.f90) @@ -170,9 +170,9 @@ if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) LINKER_LANGUAGE Fortran FOLDER examples/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared - LINK_FLAGS "" - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> + LINK_FLAGS + "$<$:\"-SUBSYSTEM:CONSOLE\"> + $<$:${WIN_LINK_FLAGS}>" ) endif () endif () diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index 199c541..cbc14c3 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -57,8 +57,8 @@ endif () set_target_properties (H5_buildiface PROPERTIES LINKER_LANGUAGE Fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY} - LINK_FLAGS "" - $<$:"-SUBSYSTEM:CONSOLE"> + LINK_FLAGS + "$<$:\"-SUBSYSTEM:CONSOLE\">" ) if (BUILD_SHARED_LIBS) @@ -269,9 +269,9 @@ set_target_properties (${HDF5_F90_LIB_TARGET} PROPERTIES FOLDER libraries/fortran LINKER_LANGUAGE Fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static - LINK_FLAGS "" - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> + LINK_FLAGS + "$<$:\"-SUBSYSTEM:CONSOLE\"> + $<$:${WIN_LINK_FLAGS}>" ) H5_SET_LIB_OPTIONS (${HDF5_F90_LIB_TARGET} ${HDF5_F90_LIB_NAME} STATIC 0) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_F90_LIB_TARGET}") @@ -304,11 +304,11 @@ if (BUILD_SHARED_LIBS) FOLDER libraries/fortran LINKER_LANGUAGE Fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared - LINK_FLAGS "" - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> - $<$:"-DLL"> - $<$:"-DEF:${HDF5_F90_SRC_BINARY_DIR}/hdf5_fortrandll.def"> + LINK_FLAGS + "$<$:\"-SUBSYSTEM:CONSOLE\"> + $<$:${WIN_LINK_FLAGS}> + $<$:\"-DLL\"> + $<$:\"-DEF:${HDF5_F90_SRC_BINARY_DIR}/hdf5_fortrandll.def\">" ) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_F90_LIBSH_TARGET}") H5_SET_LIB_OPTIONS (${HDF5_F90_LIBSH_TARGET} ${HDF5_F90_LIB_NAME} SHARED "F") diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index dbcae59..d1247a1 100644 --- a/fortran/test/CMakeLists.txt +++ b/fortran/test/CMakeLists.txt @@ -20,8 +20,8 @@ endif () set_target_properties (H5_test_buildiface PROPERTIES LINKER_LANGUAGE Fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY} - LINK_FLAGS "" - $<$:"-SUBSYSTEM:CONSOLE"> + LINK_FLAGS + "$<$:\"-SUBSYSTEM:CONSOLE\">" ) if (BUILD_SHARED_LIBS) @@ -136,9 +136,9 @@ set_target_properties (${HDF5_F90_TEST_LIB_TARGET} PROPERTIES FOLDER libraries/test/fortran LINKER_LANGUAGE Fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static - LINK_FLAGS "" - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> + LINK_FLAGS + "$<$:\"-SUBSYSTEM:CONSOLE\"> + $<$:${WIN_LINK_FLAGS}>" ) H5_SET_LIB_OPTIONS (${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_TEST_LIB_NAME} STATIC 0) add_dependencies(${HDF5_F90_TEST_LIB_TARGET} H5testgen) @@ -167,10 +167,10 @@ if (BUILD_SHARED_LIBS) FOLDER libraries/test/fortran LINKER_LANGUAGE Fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared - LINK_FLAGS "" - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> - $<$:"-DLL"> + LINK_FLAGS + "$<$:\"-SUBSYSTEM:CONSOLE\"> + $<$:${WIN_LINK_FLAGS}> + $<$:\"-DLL\">" ) H5_SET_LIB_OPTIONS (${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_TEST_LIB_NAME} SHARED "F") add_dependencies(${HDF5_F90_TEST_LIBSH_TARGET} H5testgenSH) @@ -213,9 +213,9 @@ set_target_properties (testhdf5_fortran PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static - LINK_FLAGS "" - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> + LINK_FLAGS + "$<$:\"-SUBSYSTEM:CONSOLE\"> + $<$:${WIN_LINK_FLAGS}>" ) add_dependencies (testhdf5_fortran ${HDF5_F90_TEST_LIB_TARGET}) @@ -254,9 +254,9 @@ if (BUILD_SHARED_LIBS) LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared - LINK_FLAGS "" - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> + LINK_FLAGS + "$<$:\"-SUBSYSTEM:CONSOLE\"> + $<$:${WIN_LINK_FLAGS}>" ) add_dependencies (testhdf5_fortran-shared ${HDF5_F90_TEST_LIBSH_TARGET}) endif () @@ -286,9 +286,9 @@ set_target_properties (testhdf5_fortran_1_8 PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static - LINK_FLAGS "" - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> + LINK_FLAGS + "$<$:\"-SUBSYSTEM:CONSOLE\"> + $<$:${WIN_LINK_FLAGS}>" ) add_dependencies (testhdf5_fortran_1_8 ${HDF5_F90_TEST_LIB_TARGET}) @@ -318,9 +318,9 @@ if (BUILD_SHARED_LIBS) LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared - LINK_FLAGS "" - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> + LINK_FLAGS + "$<$:\"-SUBSYSTEM:CONSOLE\"> + $<$:${WIN_LINK_FLAGS}>" ) add_dependencies (testhdf5_fortran_1_8-shared ${HDF5_F90_TEST_LIBSH_TARGET}) endif () @@ -352,9 +352,9 @@ set_target_properties (fortranlib_test_F03 PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static - LINK_FLAGS "" - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> + LINK_FLAGS + "$<$:\"-SUBSYSTEM:CONSOLE\"> + $<$:${WIN_LINK_FLAGS}>" ) add_dependencies (fortranlib_test_F03 ${HDF5_F90_TEST_LIB_TARGET}) @@ -386,9 +386,9 @@ if (BUILD_SHARED_LIBS) LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared - LINK_FLAGS "" - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> + LINK_FLAGS + "$<$:\"-SUBSYSTEM:CONSOLE\"> + $<$:${WIN_LINK_FLAGS}>" ) add_dependencies (fortranlib_test_F03-shared ${HDF5_F90_TEST_LIBSH_TARGET}) endif () @@ -411,9 +411,9 @@ set_target_properties (fflush1 PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static - LINK_FLAGS "" - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> + LINK_FLAGS + "$<$:\"-SUBSYSTEM:CONSOLE\"> + $<$:${WIN_LINK_FLAGS}>" ) add_dependencies (fflush1 ${HDF5_F90_TEST_LIB_TARGET}) @@ -436,9 +436,9 @@ if (BUILD_SHARED_LIBS) LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared - LINK_FLAGS "" - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> + LINK_FLAGS + "$<$:\"-SUBSYSTEM:CONSOLE\"> + $<$:${WIN_LINK_FLAGS}>" ) add_dependencies (fflush1-shared ${HDF5_F90_TEST_LIBSH_TARGET}) endif () @@ -461,9 +461,9 @@ set_target_properties (fflush2 PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static - LINK_FLAGS "" - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> + LINK_FLAGS + "$<$:\"-SUBSYSTEM:CONSOLE\"> + $<$:${WIN_LINK_FLAGS}>" ) add_dependencies (fflush2 ${HDF5_F90_TEST_LIB_TARGET}) @@ -486,9 +486,9 @@ if (BUILD_SHARED_LIBS) LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared - LINK_FLAGS "" - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> + LINK_FLAGS + "$<$:\"-SUBSYSTEM:CONSOLE\"> + $<$:${WIN_LINK_FLAGS}>" ) add_dependencies (fflush2-shared ${HDF5_F90_TEST_LIBSH_TARGET}) endif () diff --git a/fortran/testpar/CMakeLists.txt b/fortran/testpar/CMakeLists.txt index 31ae6ba..3d89e5e 100644 --- a/fortran/testpar/CMakeLists.txt +++ b/fortran/testpar/CMakeLists.txt @@ -32,9 +32,9 @@ target_link_libraries (parallel_test set_target_properties (parallel_test PROPERTIES FOLDER test/fortran LINKER_LANGUAGE Fortran - LINK_FLAGS "" - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> + LINK_FLAGS + "$<$:\"-SUBSYSTEM:CONSOLE\"> + $<$:${WIN_LINK_FLAGS}>" ) endif () diff --git a/hl/fortran/examples/CMakeLists.txt b/hl/fortran/examples/CMakeLists.txt index a218de5..05cfaa4 100644 --- a/hl/fortran/examples/CMakeLists.txt +++ b/hl/fortran/examples/CMakeLists.txt @@ -23,9 +23,9 @@ foreach (example ${examples}) set_target_properties (hl_f90_ex_${example} PROPERTIES LINKER_LANGUAGE Fortran FOLDER examples/hl/fortran - LINK_FLAGS "" - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> + LINK_FLAGS + "$<$:\"-SUBSYSTEM:CONSOLE\"> + $<$:${WIN_LINK_FLAGS}>" ) endforeach () diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt index 5eea6bb..a4cb21d 100644 --- a/hl/fortran/src/CMakeLists.txt +++ b/hl/fortran/src/CMakeLists.txt @@ -21,11 +21,12 @@ if (WIN32 AND MSVC) if (BUILD_SHARED_LIBS) set_target_properties (H5HL_buildiface PROPERTIES COMPILE_FLAGS "/MT") endif () - set_target_properties (H5HL_buildiface PROPERTIES LINK_FLAGS "-SUBSYSTEM:CONSOLE") endif () set_target_properties (H5HL_buildiface PROPERTIES LINKER_LANGUAGE Fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY} + LINK_FLAGS + "$<$:\"-SUBSYSTEM:CONSOLE\">" ) if (BUILD_SHARED_LIBS) @@ -168,9 +169,9 @@ set_target_properties (${HDF5_HL_F90_LIB_TARGET} PROPERTIES FOLDER libraries/hl/fortran LINKER_LANGUAGE Fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static - LINK_FLAGS "" - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> + LINK_FLAGS + "$<$:\"-SUBSYSTEM:CONSOLE\"> + $<$:${WIN_LINK_FLAGS}>" ) H5_SET_LIB_OPTIONS (${HDF5_HL_F90_LIB_TARGET} ${HDF5_HL_F90_LIB_NAME} STATIC 0) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_F90_LIB_TARGET}") @@ -203,11 +204,11 @@ if (BUILD_SHARED_LIBS) FOLDER libraries/hl/fortran LINKER_LANGUAGE Fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared - LINK_FLAGS "" - $<$:"-DLL"> - $<$:"-DEF:${HDF5_HL_F90_SRC_BINARY_DIR}/hdf5_hl_fortrandll.def"> - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> + LINK_FLAGS + "$<$:\"-SUBSYSTEM:CONSOLE\"> + $<$:${WIN_LINK_FLAGS}> + $<$:\"-DLL\"> + $<$:\"-DEF:${HDF5_HL_F90_SRC_BINARY_DIR}/hdf5_hl_fortrandll.def\">" ) H5_SET_LIB_OPTIONS (${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_HL_F90_LIB_NAME} SHARED "HL_F") set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_F90_LIBSH_TARGET}") diff --git a/hl/fortran/test/CMakeLists.txt b/hl/fortran/test/CMakeLists.txt index a639d9c..40afcd3 100644 --- a/hl/fortran/test/CMakeLists.txt +++ b/hl/fortran/test/CMakeLists.txt @@ -22,9 +22,9 @@ target_link_libraries (hl_f90_tstds set_target_properties (hl_f90_tstds PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/hl/fortran - LINK_FLAGS "" - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> + LINK_FLAGS + "$<$:\"-SUBSYSTEM:CONSOLE\"> + $<$:${WIN_LINK_FLAGS}>" ) if (BUILD_SHARED_LIBS) add_executable (hl_f90_tstds-shared tstds.F90) @@ -45,9 +45,9 @@ if (BUILD_SHARED_LIBS) LINKER_LANGUAGE Fortran FOLDER test/hl/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared - LINK_FLAGS "" - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> + LINK_FLAGS + "$<$:\"-SUBSYSTEM:CONSOLE\"> + $<$:${WIN_LINK_FLAGS}>" ) endif () @@ -68,9 +68,9 @@ target_link_libraries (hl_f90_tstlite set_target_properties (hl_f90_tstlite PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/hl/fortran - LINK_FLAGS "" - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> + LINK_FLAGS + "$<$:\"-SUBSYSTEM:CONSOLE\"> + $<$:${WIN_LINK_FLAGS}>" ) if (BUILD_SHARED_LIBS) add_executable (hl_f90_tstlite-shared tstlite.F90) @@ -91,9 +91,9 @@ if (BUILD_SHARED_LIBS) LINKER_LANGUAGE Fortran FOLDER test/hl/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared - LINK_FLAGS "" - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> + LINK_FLAGS + "$<$:\"-SUBSYSTEM:CONSOLE\"> + $<$:${WIN_LINK_FLAGS}>" ) endif () @@ -114,9 +114,9 @@ target_link_libraries (hl_f90_tstimage set_target_properties (hl_f90_tstimage PROPERTIES FOLDER test/hl/fortran LINKER_LANGUAGE Fortran - LINK_FLAGS "" - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> + LINK_FLAGS + "$<$:\"-SUBSYSTEM:CONSOLE\"> + $<$:${WIN_LINK_FLAGS}>" ) if (BUILD_SHARED_LIBS) add_executable (hl_f90_tstimage-shared tstimage.F90) @@ -137,9 +137,9 @@ if (BUILD_SHARED_LIBS) LINKER_LANGUAGE Fortran FOLDER test/hl/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared - LINK_FLAGS "" - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> + LINK_FLAGS + "$<$:\"-SUBSYSTEM:CONSOLE\"> + $<$:${WIN_LINK_FLAGS}>" ) endif () @@ -160,9 +160,9 @@ target_link_libraries (hl_f90_tsttable set_target_properties (hl_f90_tsttable PROPERTIES FOLDER test/hl/fortran LINKER_LANGUAGE Fortran - LINK_FLAGS "" - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> + LINK_FLAGS + "$<$:\"-SUBSYSTEM:CONSOLE\"> + $<$:${WIN_LINK_FLAGS}>" ) if (BUILD_SHARED_LIBS) add_executable (hl_f90_tsttable-shared tsttable.F90) @@ -183,9 +183,9 @@ if (BUILD_SHARED_LIBS) LINKER_LANGUAGE Fortran FOLDER test/hl/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared - LINK_FLAGS "" - $<$:"-SUBSYSTEM:CONSOLE"> - $<$:${WIN_LINK_FLAGS}> + LINK_FLAGS + "$<$:\"-SUBSYSTEM:CONSOLE\"> + $<$:${WIN_LINK_FLAGS}>" ) endif () -- cgit v0.12 From 01a77cbfb17d8802a9f135bb95a2b2ec57f75410 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 3 May 2018 10:44:57 -0500 Subject: LINK_FLAGS must be separate property sets --- config/cmake/HDF5Macros.cmake | 4 +- fortran/examples/CMakeLists.txt | 54 ++++++--- fortran/src/CMakeLists.txt | 31 ++++-- fortran/test/CMakeLists.txt | 120 +++++++++++++------- fortran/testpar/CMakeLists.txt | 9 +- hl/fortran/examples/CMakeLists.txt | 12 +- hl/fortran/src/CMakeLists.txt | 31 ++++-- hl/fortran/test/CMakeLists.txt | 217 ++++++++----------------------------- hl/fortran/test/CMakeTests.cmake | 167 +++++++--------------------- 9 files changed, 260 insertions(+), 385 deletions(-) diff --git a/config/cmake/HDF5Macros.cmake b/config/cmake/HDF5Macros.cmake index e472a67..7048db6 100644 --- a/config/cmake/HDF5Macros.cmake +++ b/config/cmake/HDF5Macros.cmake @@ -33,8 +33,10 @@ macro (H5_SET_LIB_OPTIONS libtarget libname libtype libpackage) if (APPLE) option (HDF5_BUILD_WITH_INSTALL_NAME "Build with library install_name set to the installation path" OFF) if (HDF5_BUILD_WITH_INSTALL_NAME) - set_target_properties (${libtarget} PROPERTIES + set_property(TARGET ${libtarget} APPEND_STRING PROPERTY LINK_FLAGS "-current_version ${HDF5_PACKAGE_VERSION} -compatibility_version ${HDF5_PACKAGE_VERSION}" + ) + set_target_properties (${libtarget} PROPERTIES INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib" BUILD_WITH_INSTALL_RPATH ${HDF5_BUILD_WITH_INSTALL_NAME} ) diff --git a/fortran/examples/CMakeLists.txt b/fortran/examples/CMakeLists.txt index 3347480..5329e29 100644 --- a/fortran/examples/CMakeLists.txt +++ b/fortran/examples/CMakeLists.txt @@ -47,13 +47,16 @@ foreach (example ${examples}) PRIVATE ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} ) + set_property(TARGET f90_ex_${example} APPEND_STRING PROPERTY + LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> + ) + set_property(TARGET f90_ex_${example} APPEND_STRING PROPERTY + LINK_FLAGS $<$:${WIN_LINK_FLAGS}> + ) set_target_properties (f90_ex_${example} PROPERTIES LINKER_LANGUAGE Fortran FOLDER examples/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static - LINK_FLAGS - "$<$:\"-SUBSYSTEM:CONSOLE\"> - $<$:${WIN_LINK_FLAGS}>" ) if (BUILD_SHARED_LIBS) add_executable (f90_ex_${example}-shared ${HDF5_F90_EXAMPLES_SOURCE_DIR}/${example}.f90) @@ -70,13 +73,16 @@ foreach (example ${examples}) PRIVATE ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ) + set_property(TARGET f90_ex_${example}-shared APPEND_STRING PROPERTY + LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> + ) + set_property(TARGET f90_ex_${example}-shared APPEND_STRING PROPERTY + LINK_FLAGS $<$:${WIN_LINK_FLAGS}> + ) set_target_properties (f90_ex_${example}-shared PROPERTIES LINKER_LANGUAGE Fortran FOLDER examples/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared - LINK_FLAGS - "$<$:\"-SUBSYSTEM:CONSOLE\"> - $<$:${WIN_LINK_FLAGS}>" ) endif () endforeach () @@ -95,13 +101,16 @@ foreach (example ${F2003_examples}) PRIVATE ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} ) + set_property(TARGET f03_ex_${example} APPEND_STRING PROPERTY + LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> + ) + set_property(TARGET f03_ex_${example} APPEND_STRING PROPERTY + LINK_FLAGS $<$:${WIN_LINK_FLAGS}> + ) set_target_properties (f03_ex_${example} PROPERTIES LINKER_LANGUAGE Fortran FOLDER examples/fortran03 Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static - LINK_FLAGS - "$<$:\"-SUBSYSTEM:CONSOLE\"> - $<$:${WIN_LINK_FLAGS}>" ) if (BUILD_SHARED_LIBS) add_executable (f03_ex_${example}-shared ${HDF5_F90_EXAMPLES_SOURCE_DIR}/${example}.f90) @@ -118,13 +127,16 @@ foreach (example ${F2003_examples}) PRIVATE ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ) + set_property(TARGET f03_ex_${example}-shared APPEND_STRING PROPERTY + LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> + ) + set_property(TARGET f03_ex_${example}-shared APPEND_STRING PROPERTY + LINK_FLAGS $<$:${WIN_LINK_FLAGS}> + ) set_target_properties (f03_ex_${example}-shared PROPERTIES LINKER_LANGUAGE Fortran FOLDER examples/fortran03 Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared - LINK_FLAGS - "$<$:\"-SUBSYSTEM:CONSOLE\"> - $<$:${WIN_LINK_FLAGS}>" ) endif () endforeach () @@ -143,13 +155,16 @@ if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) PRIVATE ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} ) + set_property(TARGET f90_ex_ph5example APPEND_STRING PROPERTY + LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> + ) + set_property(TARGET f90_ex_ph5example APPEND_STRING PROPERTY + LINK_FLAGS $<$:${WIN_LINK_FLAGS}> + ) set_target_properties (f90_ex_ph5example PROPERTIES LINKER_LANGUAGE Fortran FOLDER examples/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static - LINK_FLAGS - "$<$:\"-SUBSYSTEM:CONSOLE\"> - $<$:${WIN_LINK_FLAGS}>" ) if (BUILD_SHARED_LIBS) add_executable (f90_ex_ph5example-shared ${HDF5_F90_EXAMPLES_SOURCE_DIR}/ph5example.f90) @@ -166,13 +181,16 @@ if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) PRIVATE ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ) + set_property(TARGET f90_ex_ph5example-shared APPEND_STRING PROPERTY + LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> + ) + set_property(TARGET f90_ex_ph5example-shared APPEND_STRING PROPERTY + LINK_FLAGS $<$:${WIN_LINK_FLAGS}> + ) set_target_properties (f90_ex_ph5example-shared PROPERTIES LINKER_LANGUAGE Fortran FOLDER examples/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared - LINK_FLAGS - "$<$:\"-SUBSYSTEM:CONSOLE\"> - $<$:${WIN_LINK_FLAGS}>" ) endif () endif () diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index cbc14c3..670e159 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -54,11 +54,12 @@ if (BUILD_SHARED_LIBS) $<$:/MT> ) endif () +set_property(TARGET H5_buildiface APPEND_STRING PROPERTY + LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> +) set_target_properties (H5_buildiface PROPERTIES LINKER_LANGUAGE Fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY} - LINK_FLAGS - "$<$:\"-SUBSYSTEM:CONSOLE\">" ) if (BUILD_SHARED_LIBS) @@ -265,13 +266,16 @@ target_link_libraries (${HDF5_F90_LIB_TARGET} ${LINK_Fortran_LIBS} $<$:${MPI_Fortran_LIBRARIES}> ) +set_property(TARGET ${HDF5_F90_LIB_TARGET} APPEND_STRING PROPERTY + LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> +) +set_property(TARGET ${HDF5_F90_LIB_TARGET} APPEND_STRING PROPERTY + LINK_FLAGS $<$:${WIN_LINK_FLAGS}> +) set_target_properties (${HDF5_F90_LIB_TARGET} PROPERTIES FOLDER libraries/fortran LINKER_LANGUAGE Fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static - LINK_FLAGS - "$<$:\"-SUBSYSTEM:CONSOLE\"> - $<$:${WIN_LINK_FLAGS}>" ) H5_SET_LIB_OPTIONS (${HDF5_F90_LIB_TARGET} ${HDF5_F90_LIB_NAME} STATIC 0) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_F90_LIB_TARGET}") @@ -300,15 +304,22 @@ if (BUILD_SHARED_LIBS) PRIVATE ${LINK_Fortran_LIBS} $<$:${MPI_Fortran_LIBRARIES}> ) + set_property(TARGET ${HDF5_F90_LIBSH_TARGET} APPEND_STRING PROPERTY + LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> + ) + set_property(TARGET ${HDF5_F90_LIBSH_TARGET} APPEND_STRING PROPERTY + LINK_FLAGS $<$:${WIN_LINK_FLAGS}> + ) + set_property(TARGET ${HDF5_F90_LIBSH_TARGET} APPEND_STRING PROPERTY + LINK_FLAGS $<$:"-DLL"> + ) + set_property(TARGET ${HDF5_F90_LIBSH_TARGET} APPEND_STRING PROPERTY + LINK_FLAGS $<$:"-DEF:${HDF5_F90_SRC_BINARY_DIR}/hdf5_fortrandll.def"> + ) set_target_properties (${HDF5_F90_LIBSH_TARGET} PROPERTIES FOLDER libraries/fortran LINKER_LANGUAGE Fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared - LINK_FLAGS - "$<$:\"-SUBSYSTEM:CONSOLE\"> - $<$:${WIN_LINK_FLAGS}> - $<$:\"-DLL\"> - $<$:\"-DEF:${HDF5_F90_SRC_BINARY_DIR}/hdf5_fortrandll.def\">" ) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_F90_LIBSH_TARGET}") H5_SET_LIB_OPTIONS (${HDF5_F90_LIBSH_TARGET} ${HDF5_F90_LIB_NAME} SHARED "F") diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index d1247a1..964d588 100644 --- a/fortran/test/CMakeLists.txt +++ b/fortran/test/CMakeLists.txt @@ -17,11 +17,12 @@ if (BUILD_SHARED_LIBS) $<$:/MT> ) endif () +set_property(TARGET H5_test_buildiface APPEND_STRING PROPERTY + LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> +) set_target_properties (H5_test_buildiface PROPERTIES LINKER_LANGUAGE Fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY} - LINK_FLAGS - "$<$:\"-SUBSYSTEM:CONSOLE\">" ) if (BUILD_SHARED_LIBS) @@ -132,13 +133,16 @@ target_link_libraries (${HDF5_F90_TEST_LIB_TARGET} PUBLIC ${HDF5_F90_C_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} ) +set_property(TARGET ${HDF5_F90_TEST_LIB_TARGET} APPEND_STRING PROPERTY + LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> +) +set_property(TARGET ${HDF5_F90_TEST_LIB_TARGET} APPEND_STRING PROPERTY + LINK_FLAGS $<$:${WIN_LINK_FLAGS}> +) set_target_properties (${HDF5_F90_TEST_LIB_TARGET} PROPERTIES FOLDER libraries/test/fortran LINKER_LANGUAGE Fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static - LINK_FLAGS - "$<$:\"-SUBSYSTEM:CONSOLE\"> - $<$:${WIN_LINK_FLAGS}>" ) H5_SET_LIB_OPTIONS (${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_TEST_LIB_NAME} STATIC 0) add_dependencies(${HDF5_F90_TEST_LIB_TARGET} H5testgen) @@ -163,14 +167,19 @@ if (BUILD_SHARED_LIBS) PUBLIC ${HDF5_F90_C_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ) + set_property(TARGET ${HDF5_F90_TEST_LIBSH_TARGET} APPEND_STRING PROPERTY + LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> + ) + set_property(TARGET ${HDF5_F90_TEST_LIBSH_TARGET} APPEND_STRING PROPERTY + LINK_FLAGS $<$:${WIN_LINK_FLAGS}> + ) + set_property(TARGET ${HDF5_F90_TEST_LIBSH_TARGET} APPEND_STRING PROPERTY + LINK_FLAGS $<$:"-DLL"> + ) set_target_properties (${HDF5_F90_TEST_LIBSH_TARGET} PROPERTIES FOLDER libraries/test/fortran LINKER_LANGUAGE Fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared - LINK_FLAGS - "$<$:\"-SUBSYSTEM:CONSOLE\"> - $<$:${WIN_LINK_FLAGS}> - $<$:\"-DLL\">" ) H5_SET_LIB_OPTIONS (${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_TEST_LIB_NAME} SHARED "F") add_dependencies(${HDF5_F90_TEST_LIBSH_TARGET} H5testgenSH) @@ -200,7 +209,8 @@ add_executable (testhdf5_fortran ) target_include_directories (testhdf5_fortran PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static") + "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_BINARY_DIR}/static" +) target_compile_options(testhdf5_fortran PRIVATE $<$:${WIN_COMPILE_FLAGS}> @@ -209,13 +219,16 @@ target_link_libraries (testhdf5_fortran PRIVATE ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} $<$:ws2_32.lib> ) +set_property(TARGET testhdf5_fortran APPEND_STRING PROPERTY + LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> +) +set_property(TARGET testhdf5_fortran APPEND_STRING PROPERTY + LINK_FLAGS $<$:${WIN_LINK_FLAGS}> +) set_target_properties (testhdf5_fortran PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static - LINK_FLAGS - "$<$:\"-SUBSYSTEM:CONSOLE\"> - $<$:${WIN_LINK_FLAGS}>" ) add_dependencies (testhdf5_fortran ${HDF5_F90_TEST_LIB_TARGET}) @@ -250,13 +263,16 @@ if (BUILD_SHARED_LIBS) PRIVATE ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$:ws2_32.lib> ) + set_property(TARGET testhdf5_fortran-shared APPEND_STRING PROPERTY + LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> + ) + set_property(TARGET testhdf5_fortran-shared APPEND_STRING PROPERTY + LINK_FLAGS $<$:${WIN_LINK_FLAGS}> + ) set_target_properties (testhdf5_fortran-shared PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared - LINK_FLAGS - "$<$:\"-SUBSYSTEM:CONSOLE\"> - $<$:${WIN_LINK_FLAGS}>" ) add_dependencies (testhdf5_fortran-shared ${HDF5_F90_TEST_LIBSH_TARGET}) endif () @@ -282,13 +298,16 @@ target_link_libraries (testhdf5_fortran_1_8 PRIVATE ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} $<$:ws2_32.lib> ) +set_property(TARGET testhdf5_fortran_1_8 APPEND_STRING PROPERTY + LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> +) +set_property(TARGET testhdf5_fortran_1_8 APPEND_STRING PROPERTY + LINK_FLAGS $<$:${WIN_LINK_FLAGS}> +) set_target_properties (testhdf5_fortran_1_8 PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static - LINK_FLAGS - "$<$:\"-SUBSYSTEM:CONSOLE\"> - $<$:${WIN_LINK_FLAGS}>" ) add_dependencies (testhdf5_fortran_1_8 ${HDF5_F90_TEST_LIB_TARGET}) @@ -314,13 +333,16 @@ if (BUILD_SHARED_LIBS) PRIVATE ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$:ws2_32.lib> ) + set_property(TARGET testhdf5_fortran_1_8-shared APPEND_STRING PROPERTY + LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> + ) + set_property(TARGET testhdf5_fortran_1_8-shared APPEND_STRING PROPERTY + LINK_FLAGS $<$:${WIN_LINK_FLAGS}> + ) set_target_properties (testhdf5_fortran_1_8-shared PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared - LINK_FLAGS - "$<$:\"-SUBSYSTEM:CONSOLE\"> - $<$:${WIN_LINK_FLAGS}>" ) add_dependencies (testhdf5_fortran_1_8-shared ${HDF5_F90_TEST_LIBSH_TARGET}) endif () @@ -348,13 +370,16 @@ target_link_libraries (fortranlib_test_F03 PRIVATE ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} $<$:ws2_32.lib> ) +set_property(TARGET fortranlib_test_F03 APPEND_STRING PROPERTY + LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> +) +set_property(TARGET fortranlib_test_F03 APPEND_STRING PROPERTY + LINK_FLAGS $<$:${WIN_LINK_FLAGS}> +) set_target_properties (fortranlib_test_F03 PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static - LINK_FLAGS - "$<$:\"-SUBSYSTEM:CONSOLE\"> - $<$:${WIN_LINK_FLAGS}>" ) add_dependencies (fortranlib_test_F03 ${HDF5_F90_TEST_LIB_TARGET}) @@ -382,13 +407,16 @@ if (BUILD_SHARED_LIBS) PRIVATE ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$:ws2_32.lib> ) + set_property(TARGET fortranlib_test_F03-shared APPEND_STRING PROPERTY + LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> + ) + set_property(TARGET fortranlib_test_F03-shared APPEND_STRING PROPERTY + LINK_FLAGS $<$:${WIN_LINK_FLAGS}> + ) set_target_properties (fortranlib_test_F03-shared PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared - LINK_FLAGS - "$<$:\"-SUBSYSTEM:CONSOLE\"> - $<$:${WIN_LINK_FLAGS}>" ) add_dependencies (fortranlib_test_F03-shared ${HDF5_F90_TEST_LIBSH_TARGET}) endif () @@ -407,13 +435,16 @@ target_link_libraries (fflush1 PRIVATE ${HDF5_F90_LIB_TARGET} ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_LIB_TARGET} $<$:ws2_32.lib> ) +set_property(TARGET fflush1 APPEND_STRING PROPERTY + LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> +) +set_property(TARGET fflush1 APPEND_STRING PROPERTY + LINK_FLAGS $<$:${WIN_LINK_FLAGS}> +) set_target_properties (fflush1 PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static - LINK_FLAGS - "$<$:\"-SUBSYSTEM:CONSOLE\"> - $<$:${WIN_LINK_FLAGS}>" ) add_dependencies (fflush1 ${HDF5_F90_TEST_LIB_TARGET}) @@ -432,13 +463,16 @@ if (BUILD_SHARED_LIBS) PRIVATE ${HDF5_F90_LIBSH_TARGET} ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$:ws2_32.lib> ) + set_property(TARGET fflush1-shared APPEND_STRING PROPERTY + LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> + ) + set_property(TARGET fflush1-shared APPEND_STRING PROPERTY + LINK_FLAGS $<$:${WIN_LINK_FLAGS}> + ) set_target_properties (fflush1-shared PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared - LINK_FLAGS - "$<$:\"-SUBSYSTEM:CONSOLE\"> - $<$:${WIN_LINK_FLAGS}>" ) add_dependencies (fflush1-shared ${HDF5_F90_TEST_LIBSH_TARGET}) endif () @@ -457,13 +491,16 @@ target_link_libraries (fflush2 PRIVATE ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} $<$:ws2_32.lib> ) +set_property(TARGET fflush2 APPEND_STRING PROPERTY + LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> +) +set_property(TARGET fflush2 APPEND_STRING PROPERTY + LINK_FLAGS $<$:${WIN_LINK_FLAGS}> +) set_target_properties (fflush2 PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static - LINK_FLAGS - "$<$:\"-SUBSYSTEM:CONSOLE\"> - $<$:${WIN_LINK_FLAGS}>" ) add_dependencies (fflush2 ${HDF5_F90_TEST_LIB_TARGET}) @@ -482,13 +519,16 @@ if (BUILD_SHARED_LIBS) PRIVATE ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$:ws2_32.lib> ) + set_property(TARGET fflush2-shared APPEND_STRING PROPERTY + LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> + ) + set_property(TARGET fflush2-shared APPEND_STRING PROPERTY + LINK_FLAGS $<$:${WIN_LINK_FLAGS}> + ) set_target_properties (fflush2-shared PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared - LINK_FLAGS - "$<$:\"-SUBSYSTEM:CONSOLE\"> - $<$:${WIN_LINK_FLAGS}>" ) add_dependencies (fflush2-shared ${HDF5_F90_TEST_LIBSH_TARGET}) endif () diff --git a/fortran/testpar/CMakeLists.txt b/fortran/testpar/CMakeLists.txt index 3d89e5e..5ead405 100644 --- a/fortran/testpar/CMakeLists.txt +++ b/fortran/testpar/CMakeLists.txt @@ -29,12 +29,15 @@ target_link_libraries (parallel_test ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} ${LINK_Fortran_LIBS} $<$:"ws2_32.lib"> ) +set_property(TARGET parallel_test APPEND_STRING PROPERTY + LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> +) +set_property(TARGET parallel_test APPEND_STRING PROPERTY + LINK_FLAGS $<$:${WIN_LINK_FLAGS}> +) set_target_properties (parallel_test PROPERTIES FOLDER test/fortran LINKER_LANGUAGE Fortran - LINK_FLAGS - "$<$:\"-SUBSYSTEM:CONSOLE\"> - $<$:${WIN_LINK_FLAGS}>" ) endif () diff --git a/hl/fortran/examples/CMakeLists.txt b/hl/fortran/examples/CMakeLists.txt index 05cfaa4..97ddce8 100644 --- a/hl/fortran/examples/CMakeLists.txt +++ b/hl/fortran/examples/CMakeLists.txt @@ -20,18 +20,18 @@ foreach (example ${examples}) PRIVATE ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} ) + set_property(TARGET hl_f90_ex_${example} APPEND_STRING PROPERTY + LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> + ) + set_property(TARGET hl_f90_ex_${example} APPEND_STRING PROPERTY + LINK_FLAGS $<$:${WIN_LINK_FLAGS}> + ) set_target_properties (hl_f90_ex_${example} PROPERTIES LINKER_LANGUAGE Fortran FOLDER examples/hl/fortran - LINK_FLAGS - "$<$:\"-SUBSYSTEM:CONSOLE\"> - $<$:${WIN_LINK_FLAGS}>" ) - endforeach () if (BUILD_TESTING) - include (CMakeTests.cmake) - endif () diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt index a4cb21d..6aec901 100644 --- a/hl/fortran/src/CMakeLists.txt +++ b/hl/fortran/src/CMakeLists.txt @@ -22,11 +22,12 @@ if (WIN32 AND MSVC) set_target_properties (H5HL_buildiface PROPERTIES COMPILE_FLAGS "/MT") endif () endif () +set_property(TARGET H5HL_buildiface APPEND_STRING PROPERTY + LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> +) set_target_properties (H5HL_buildiface PROPERTIES LINKER_LANGUAGE Fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY} - LINK_FLAGS - "$<$:\"-SUBSYSTEM:CONSOLE\">" ) if (BUILD_SHARED_LIBS) @@ -165,13 +166,16 @@ target_link_libraries (${HDF5_HL_F90_LIB_TARGET} PUBLIC ${HDF5_HL_F90_C_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ) +set_property(TARGET ${HDF5_HL_F90_LIB_TARGET} APPEND_STRING PROPERTY + LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> +) +set_property(TARGET ${HDF5_HL_F90_LIB_TARGET} APPEND_STRING PROPERTY + LINK_FLAGS $<$:${WIN_LINK_FLAGS}> +) set_target_properties (${HDF5_HL_F90_LIB_TARGET} PROPERTIES FOLDER libraries/hl/fortran LINKER_LANGUAGE Fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static - LINK_FLAGS - "$<$:\"-SUBSYSTEM:CONSOLE\"> - $<$:${WIN_LINK_FLAGS}>" ) H5_SET_LIB_OPTIONS (${HDF5_HL_F90_LIB_TARGET} ${HDF5_HL_F90_LIB_NAME} STATIC 0) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_F90_LIB_TARGET}") @@ -200,15 +204,22 @@ if (BUILD_SHARED_LIBS) PRIVATE ${LINK_Fortran_LIBS} ) + set_property(TARGET ${HDF5_HL_F90_LIBSH_TARGET} APPEND_STRING PROPERTY + LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> + ) + set_property(TARGET ${HDF5_HL_F90_LIBSH_TARGET} APPEND_STRING PROPERTY + LINK_FLAGS $<$:${WIN_LINK_FLAGS}> + ) + set_property(TARGET ${HDF5_HL_F90_LIBSH_TARGET} APPEND_STRING PROPERTY + LINK_FLAGS $<$:"-DLL"> + ) + set_property(TARGET ${HDF5_HL_F90_LIBSH_TARGET} APPEND_STRING PROPERTY + LINK_FLAGS $<$:"-DEF:${HDF5_HL_F90_SRC_BINARY_DIR}/hdf5_hl_fortrandll.def"> + ) set_target_properties (${HDF5_HL_F90_LIBSH_TARGET} PROPERTIES FOLDER libraries/hl/fortran LINKER_LANGUAGE Fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared - LINK_FLAGS - "$<$:\"-SUBSYSTEM:CONSOLE\"> - $<$:${WIN_LINK_FLAGS}> - $<$:\"-DLL\"> - $<$:\"-DEF:${HDF5_HL_F90_SRC_BINARY_DIR}/hdf5_hl_fortrandll.def\">" ) H5_SET_LIB_OPTIONS (${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_HL_F90_LIB_NAME} SHARED "HL_F") set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_F90_LIBSH_TARGET}") diff --git a/hl/fortran/test/CMakeLists.txt b/hl/fortran/test/CMakeLists.txt index 40afcd3..d6d1ab0 100644 --- a/hl/fortran/test/CMakeLists.txt +++ b/hl/fortran/test/CMakeLists.txt @@ -4,189 +4,68 @@ project (HDF5_HL_FORTRAN_TESTS C Fortran) #----------------------------------------------------------------------------- # Add Tests #----------------------------------------------------------------------------- - -#-- Adding test for hl_f90_tstds -add_executable (hl_f90_tstds tstds.F90) -target_include_directories (hl_f90_tstds - PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src" -) -target_compile_options(hl_f90_tstds - PRIVATE - $<$:${WIN_COMPILE_FLAGS}> -) -target_link_libraries (hl_f90_tstds - PRIVATE - ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET} +set (H5_TESTS + tstds + tstlite + tstimage + tsttable ) -set_target_properties (hl_f90_tstds PROPERTIES - LINKER_LANGUAGE Fortran - FOLDER test/hl/fortran - LINK_FLAGS - "$<$:\"-SUBSYSTEM:CONSOLE\"> - $<$:${WIN_LINK_FLAGS}>" -) -if (BUILD_SHARED_LIBS) - add_executable (hl_f90_tstds-shared tstds.F90) - target_include_directories (hl_f90_tstds-shared - PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src" - ) - target_compile_options(hl_f90_tstds-shared - PRIVATE - $<$:/dll> - $<$:${WIN_COMPILE_FLAGS}> - ) - target_link_libraries (hl_f90_tstds-shared - PRIVATE - ${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} - ) - set_target_properties (hl_f90_tstds-shared PROPERTIES - LINKER_LANGUAGE Fortran - FOLDER test/hl/fortran - Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared - LINK_FLAGS - "$<$:\"-SUBSYSTEM:CONSOLE\"> - $<$:${WIN_LINK_FLAGS}>" - ) -endif () -#-- Adding test for hl_f90_tstlite -add_executable (hl_f90_tstlite tstlite.F90) -target_include_directories (hl_f90_tstlite - PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src" -) -target_compile_options(hl_f90_tstlite - PRIVATE - $<$:${WIN_COMPILE_FLAGS}> -) -target_link_libraries (hl_f90_tstlite - PRIVATE - ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_F90_TEST_LIB_TARGET} -) -set_target_properties (hl_f90_tstlite PROPERTIES - LINKER_LANGUAGE Fortran - FOLDER test/hl/fortran - LINK_FLAGS - "$<$:\"-SUBSYSTEM:CONSOLE\"> - $<$:${WIN_LINK_FLAGS}>" -) -if (BUILD_SHARED_LIBS) - add_executable (hl_f90_tstlite-shared tstlite.F90) - target_include_directories (hl_f90_tstlite-shared +macro (ADD_H5_FORTRAN_EXE file) + add_executable (hl_f90_${file} ${file}.F90) + target_include_directories (hl_f90_${file} PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src" + "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src" ) - target_compile_options(hl_f90_tstlite-shared + target_compile_options(hl_f90_${file} PRIVATE - $<$:/dll> $<$:${WIN_COMPILE_FLAGS}> ) - target_link_libraries (hl_f90_tstlite-shared + target_link_libraries (hl_f90_${file} PRIVATE - ${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_F90_TEST_LIBSH_TARGET} + ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ) - set_target_properties (hl_f90_tstlite-shared PROPERTIES - LINKER_LANGUAGE Fortran - FOLDER test/hl/fortran - Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared - LINK_FLAGS - "$<$:\"-SUBSYSTEM:CONSOLE\"> - $<$:${WIN_LINK_FLAGS}>" + set_property(TARGET hl_f90_${file} APPEND_STRING PROPERTY + LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> ) -endif () - -#-- Adding test for hl_f90_tstimage -add_executable (hl_f90_tstimage tstimage.F90) -target_include_directories (hl_f90_tstimage - PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src" -) -target_compile_options(hl_f90_tstimage - PRIVATE - $<$:${WIN_COMPILE_FLAGS}> -) -target_link_libraries (hl_f90_tstimage - PRIVATE - ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET} -) -set_target_properties (hl_f90_tstimage PROPERTIES - FOLDER test/hl/fortran - LINKER_LANGUAGE Fortran - LINK_FLAGS - "$<$:\"-SUBSYSTEM:CONSOLE\"> - $<$:${WIN_LINK_FLAGS}>" -) -if (BUILD_SHARED_LIBS) - add_executable (hl_f90_tstimage-shared tstimage.F90) - target_include_directories (hl_f90_tstimage-shared - PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src" - ) - target_compile_options(hl_f90_tstimage-shared - PRIVATE - $<$:/dll> - $<$:${WIN_COMPILE_FLAGS}> + set_property(TARGET hl_f90_${file} APPEND_STRING PROPERTY + LINK_FLAGS $<$:${WIN_LINK_FLAGS}> ) - target_link_libraries (hl_f90_tstimage-shared - PRIVATE - ${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} - ) - set_target_properties (hl_f90_tstimage-shared PROPERTIES + set_target_properties (hl_f90_${file} PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/hl/fortran - Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared - LINK_FLAGS - "$<$:\"-SUBSYSTEM:CONSOLE\"> - $<$:${WIN_LINK_FLAGS}>" ) -endif () + if (BUILD_SHARED_LIBS) + add_executable (hl_f90_${file}-shared ${file}.F90) + target_include_directories (hl_f90_${file}-shared + PRIVATE + "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src" + ) + target_compile_options(hl_f90_${file}-shared + PRIVATE + $<$:/dll> + $<$:${WIN_COMPILE_FLAGS}> + ) + target_link_libraries (hl_f90_${file}-shared + PRIVATE + ${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} + ) + set_property(TARGET hl_f90_${file}-shared APPEND_STRING PROPERTY + LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> + ) + set_property(TARGET hl_f90_${file}-shared APPEND_STRING PROPERTY + LINK_FLAGS $<$:${WIN_LINK_FLAGS}> + ) + set_target_properties (hl_f90_${file}-shared PROPERTIES + LINKER_LANGUAGE Fortran + FOLDER test/hl/fortran + Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared + ) + endif () +endmacro () -#-- Adding test for hl_f90_tsttable -add_executable (hl_f90_tsttable tsttable.F90) -target_include_directories (hl_f90_tsttable - PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src" -) -target_compile_options(hl_f90_tsttable - PRIVATE - $<$:${WIN_COMPILE_FLAGS}> -) -target_link_libraries (hl_f90_tsttable - PRIVATE - ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_F90_TEST_LIB_TARGET} -) -set_target_properties (hl_f90_tsttable PROPERTIES - FOLDER test/hl/fortran - LINKER_LANGUAGE Fortran - LINK_FLAGS - "$<$:\"-SUBSYSTEM:CONSOLE\"> - $<$:${WIN_LINK_FLAGS}>" -) -if (BUILD_SHARED_LIBS) - add_executable (hl_f90_tsttable-shared tsttable.F90) - target_include_directories (hl_f90_tsttable-shared - PRIVATE - "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src" - ) - target_compile_options(hl_f90_tsttable-shared - PRIVATE - $<$:/dll> - $<$:${WIN_COMPILE_FLAGS}> - ) - target_link_libraries (hl_f90_tsttable-shared - PRIVATE - ${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_F90_TEST_LIBSH_TARGET} - ) - set_target_properties (hl_f90_tsttable-shared PROPERTIES - LINKER_LANGUAGE Fortran - FOLDER test/hl/fortran - Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared - LINK_FLAGS - "$<$:\"-SUBSYSTEM:CONSOLE\"> - $<$:${WIN_LINK_FLAGS}>" - ) -endif () +foreach (test ${H5_TESTS}) + ADD_H5_FORTRAN_EXE(${test}) +endforeach () include (CMakeTests.cmake) diff --git a/hl/fortran/test/CMakeTests.cmake b/hl/fortran/test/CMakeTests.cmake index d541377..04a49dc 100644 --- a/hl/fortran/test/CMakeTests.cmake +++ b/hl/fortran/test/CMakeTests.cmake @@ -16,6 +16,41 @@ ############################################################################## ############################################################################## +macro (ADD_H5_FORTRAN_TEST file) + if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME HL_FORTRAN_f90_${file} COMMAND $) + else () + add_test (NAME HL_FORTRAN_f90_${file} COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=hl_f90_${file}.txt" + #-D "TEST_REFERENCE=hl_f90_${file}.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + endif () + set_tests_properties (HL_FORTRAN_f90_${file} PROPERTIES DEPENDS HL_FORTRAN_test-clear-objects) + if (BUILD_SHARED_LIBS) + if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME HL_FORTRAN_f90_${file}-shared COMMAND $) + else () + add_test (NAME HL_FORTRAN_f90_${file}-shared COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_EXPECT=0" + -D "TEST_SKIP_COMPARE=TRUE" + -D "TEST_OUTPUT=hl_f90_${file}-shared.txt" + #-D "TEST_REFERENCE=hl_f90_${file}-shared.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + endif () + set_tests_properties (HL_FORTRAN_f90_${file}-shared PROPERTIES DEPENDS HL_FORTRAN_test-shared-clear-objects) + endif () +endmacro () + # Remove any output file left over from previous test run add_test ( NAME HL_FORTRAN_test-clear-objects @@ -32,70 +67,6 @@ add_test ( tstds.h5 ) -if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME HL_FORTRAN_f90_tstds COMMAND $) -else () - add_test (NAME HL_FORTRAN_f90_tstds COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_OUTPUT=hl_f90_tstds.txt" - #-D "TEST_REFERENCE=hl_f90_tstds.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) -endif () -set_tests_properties (HL_FORTRAN_f90_tstds PROPERTIES DEPENDS HL_FORTRAN_test-clear-objects) - -if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME HL_FORTRAN_f90_tstlite COMMAND $) -else () - add_test (NAME HL_FORTRAN_f90_tstlite COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_OUTPUT=hl_f90_tstlite.txt" - #-D "TEST_REFERENCE=hl_f90_tstlite.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) -endif () -set_tests_properties (HL_FORTRAN_f90_tstlite PROPERTIES DEPENDS HL_FORTRAN_test-clear-objects) - -if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME HL_FORTRAN_f90_tstimage COMMAND $) -else () - add_test (NAME HL_FORTRAN_f90_tstimage COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_OUTPUT=hl_f90_tstimage.txt" - #-D "TEST_REFERENCE=hl_f90_tstimage.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) -endif () -set_tests_properties (HL_FORTRAN_f90_tstimage PROPERTIES DEPENDS HL_FORTRAN_test-clear-objects) - -if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME HL_FORTRAN_f90_tsttable COMMAND $) -else () - add_test (NAME HL_FORTRAN_f90_tsttable COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_OUTPUT=hl_f90_tsttable.txt" - #-D "TEST_REFERENCE=hl_f90_tsttable.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) -endif () -set_tests_properties (HL_FORTRAN_f90_tsttable PROPERTIES DEPENDS HL_FORTRAN_test-clear-objects) - if (BUILD_SHARED_LIBS) add_test ( NAME HL_FORTRAN_test-shared-clear-objects @@ -114,68 +85,8 @@ if (BUILD_SHARED_LIBS) set_tests_properties (HL_FORTRAN_test-shared-clear-objects PROPERTIES DEPENDS "HL_FORTRAN_f90_tsttable;HL_FORTRAN_f90_tstimage;HL_FORTRAN_f90_tstlite;HL_FORTRAN_f90_tstds" ) - - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME HL_FORTRAN_f90_tstds-shared COMMAND $) - else () - add_test (NAME HL_FORTRAN_f90_tstds-shared COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_OUTPUT=hl_f90_tstds-shared.txt" - #-D "TEST_REFERENCE=hl_f90_tstds-shared.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - endif () - set_tests_properties (HL_FORTRAN_f90_tstds-shared PROPERTIES DEPENDS HL_FORTRAN_test-shared-clear-objects) - - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME HL_FORTRAN_f90_tstlite-shared COMMAND $) - else () - add_test (NAME HL_FORTRAN_f90_tstlite-shared COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_OUTPUT=hl_f90_tstlite-shared.txt" - #-D "TEST_REFERENCE=hl_f90_tstlite-shared.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - endif () - set_tests_properties (HL_FORTRAN_f90_tstlite-shared PROPERTIES DEPENDS HL_FORTRAN_test-shared-clear-objects) - - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME HL_FORTRAN_f90_tstimage-shared COMMAND $) - else () - add_test (NAME HL_FORTRAN_f90_tstimage-shared COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_OUTPUT=hl_f90_tstimage-shared.txt" - #-D "TEST_REFERENCE=hl_f90_tstimage-shared.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - endif () - set_tests_properties (HL_FORTRAN_f90_tstimage-shared PROPERTIES DEPENDS HL_FORTRAN_test-shared-clear-objects) - - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME HL_FORTRAN_f90_tsttable-shared COMMAND $) - else () - add_test (NAME HL_FORTRAN_f90_tsttable-shared COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$" - -D "TEST_ARGS:STRING=" - -D "TEST_EXPECT=0" - -D "TEST_SKIP_COMPARE=TRUE" - -D "TEST_OUTPUT=hl_f90_tsttable-shared.txt" - #-D "TEST_REFERENCE=hl_f90_tsttable-shared.out" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - endif () - set_tests_properties (HL_FORTRAN_f90_tsttable-shared PROPERTIES DEPENDS HL_FORTRAN_test-shared-clear-objects) endif () + +foreach (test ${H5_TESTS}) + ADD_H5_FORTRAN_TEST(${test}) +endforeach () -- cgit v0.12 From 1d1333ed6b51ef94862c50fe35fa52bea7756139 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 3 May 2018 11:57:30 -0500 Subject: Revert to old style for LINK_FLAGS gen expr not working --- config/cmake/HDF5Macros.cmake | 2 +- fortran/examples/CMakeLists.txt | 35 ++++--- fortran/src/CMakeLists.txt | 52 ++++++---- fortran/test/CMakeLists.txt | 195 ++++++++++++++++++++++--------------- fortran/testpar/CMakeLists.txt | 15 +-- hl/fortran/examples/CMakeLists.txt | 15 +-- hl/fortran/src/CMakeLists.txt | 51 ++++++---- hl/fortran/test/CMakeLists.txt | 30 +++--- 8 files changed, 234 insertions(+), 161 deletions(-) diff --git a/config/cmake/HDF5Macros.cmake b/config/cmake/HDF5Macros.cmake index 7048db6..2bdf38f 100644 --- a/config/cmake/HDF5Macros.cmake +++ b/config/cmake/HDF5Macros.cmake @@ -33,7 +33,7 @@ macro (H5_SET_LIB_OPTIONS libtarget libname libtype libpackage) if (APPLE) option (HDF5_BUILD_WITH_INSTALL_NAME "Build with library install_name set to the installation path" OFF) if (HDF5_BUILD_WITH_INSTALL_NAME) - set_property(TARGET ${libtarget} APPEND_STRING PROPERTY + set_property(TARGET ${libtarget} APPEND PROPERTY LINK_FLAGS "-current_version ${HDF5_PACKAGE_VERSION} -compatibility_version ${HDF5_PACKAGE_VERSION}" ) set_target_properties (${libtarget} PROPERTIES diff --git a/fortran/examples/CMakeLists.txt b/fortran/examples/CMakeLists.txt index 5329e29..db1880b 100644 --- a/fortran/examples/CMakeLists.txt +++ b/fortran/examples/CMakeLists.txt @@ -47,12 +47,15 @@ foreach (example ${examples}) PRIVATE ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} ) - set_property(TARGET f90_ex_${example} APPEND_STRING PROPERTY - LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> - ) - set_property(TARGET f90_ex_${example} APPEND_STRING PROPERTY - LINK_FLAGS $<$:${WIN_LINK_FLAGS}> - ) +# set_property(TARGET f90_ex_${example} APPEND PROPERTY +# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> +# ) +# set_property(TARGET f90_ex_${example} APPEND PROPERTY +# LINK_FLAGS $<$:> +# ) + if(MSVC) + set_property(TARGET H5_buildiface APPEND PROPERTY LINK_FLAGS "-SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") + endif() set_target_properties (f90_ex_${example} PROPERTIES LINKER_LANGUAGE Fortran FOLDER examples/fortran @@ -73,10 +76,10 @@ foreach (example ${examples}) PRIVATE ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ) - set_property(TARGET f90_ex_${example}-shared APPEND_STRING PROPERTY + set_property(TARGET f90_ex_${example}-shared APPEND PROPERTY LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> ) - set_property(TARGET f90_ex_${example}-shared APPEND_STRING PROPERTY + set_property(TARGET f90_ex_${example}-shared APPEND PROPERTY LINK_FLAGS $<$:${WIN_LINK_FLAGS}> ) set_target_properties (f90_ex_${example}-shared PROPERTIES @@ -101,10 +104,10 @@ foreach (example ${F2003_examples}) PRIVATE ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} ) - set_property(TARGET f03_ex_${example} APPEND_STRING PROPERTY + set_property(TARGET f03_ex_${example} APPEND PROPERTY LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> ) - set_property(TARGET f03_ex_${example} APPEND_STRING PROPERTY + set_property(TARGET f03_ex_${example} APPEND PROPERTY LINK_FLAGS $<$:${WIN_LINK_FLAGS}> ) set_target_properties (f03_ex_${example} PROPERTIES @@ -127,10 +130,10 @@ foreach (example ${F2003_examples}) PRIVATE ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ) - set_property(TARGET f03_ex_${example}-shared APPEND_STRING PROPERTY + set_property(TARGET f03_ex_${example}-shared APPEND PROPERTY LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> ) - set_property(TARGET f03_ex_${example}-shared APPEND_STRING PROPERTY + set_property(TARGET f03_ex_${example}-shared APPEND PROPERTY LINK_FLAGS $<$:${WIN_LINK_FLAGS}> ) set_target_properties (f03_ex_${example}-shared PROPERTIES @@ -155,10 +158,10 @@ if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) PRIVATE ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} ) - set_property(TARGET f90_ex_ph5example APPEND_STRING PROPERTY + set_property(TARGET f90_ex_ph5example APPEND PROPERTY LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> ) - set_property(TARGET f90_ex_ph5example APPEND_STRING PROPERTY + set_property(TARGET f90_ex_ph5example APPEND PROPERTY LINK_FLAGS $<$:${WIN_LINK_FLAGS}> ) set_target_properties (f90_ex_ph5example PROPERTIES @@ -181,10 +184,10 @@ if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) PRIVATE ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ) - set_property(TARGET f90_ex_ph5example-shared APPEND_STRING PROPERTY + set_property(TARGET f90_ex_ph5example-shared APPEND PROPERTY LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> ) - set_property(TARGET f90_ex_ph5example-shared APPEND_STRING PROPERTY + set_property(TARGET f90_ex_ph5example-shared APPEND PROPERTY LINK_FLAGS $<$:${WIN_LINK_FLAGS}> ) set_target_properties (f90_ex_ph5example-shared PROPERTIES diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index 670e159..cafcbce 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -54,9 +54,13 @@ if (BUILD_SHARED_LIBS) $<$:/MT> ) endif () -set_property(TARGET H5_buildiface APPEND_STRING PROPERTY - LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> -) +#set_property(TARGET H5_buildiface APPEND PROPERTY +# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> +#) +if(MSVC) + set_property(TARGET H5_buildiface APPEND PROPERTY LINK_FLAGS "-SUBSYSTEM:CONSOLE") +endif() + set_target_properties (H5_buildiface PROPERTIES LINKER_LANGUAGE Fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY} @@ -266,12 +270,15 @@ target_link_libraries (${HDF5_F90_LIB_TARGET} ${LINK_Fortran_LIBS} $<$:${MPI_Fortran_LIBRARIES}> ) -set_property(TARGET ${HDF5_F90_LIB_TARGET} APPEND_STRING PROPERTY - LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> -) -set_property(TARGET ${HDF5_F90_LIB_TARGET} APPEND_STRING PROPERTY - LINK_FLAGS $<$:${WIN_LINK_FLAGS}> -) +#set_property(TARGET ${HDF5_F90_LIB_TARGET} APPEND PROPERTY +# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> +#) +#set_property(TARGET ${HDF5_F90_LIB_TARGET} APPEND PROPERTY +# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> +#) +if(MSVC) + set_property(TARGET ${HDF5_F90_LIB_TARGET} APPEND PROPERTY LINK_FLAGS "-SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") +endif() set_target_properties (${HDF5_F90_LIB_TARGET} PROPERTIES FOLDER libraries/fortran LINKER_LANGUAGE Fortran @@ -304,18 +311,21 @@ if (BUILD_SHARED_LIBS) PRIVATE ${LINK_Fortran_LIBS} $<$:${MPI_Fortran_LIBRARIES}> ) - set_property(TARGET ${HDF5_F90_LIBSH_TARGET} APPEND_STRING PROPERTY - LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> - ) - set_property(TARGET ${HDF5_F90_LIBSH_TARGET} APPEND_STRING PROPERTY - LINK_FLAGS $<$:${WIN_LINK_FLAGS}> - ) - set_property(TARGET ${HDF5_F90_LIBSH_TARGET} APPEND_STRING PROPERTY - LINK_FLAGS $<$:"-DLL"> - ) - set_property(TARGET ${HDF5_F90_LIBSH_TARGET} APPEND_STRING PROPERTY - LINK_FLAGS $<$:"-DEF:${HDF5_F90_SRC_BINARY_DIR}/hdf5_fortrandll.def"> - ) +# set_property(TARGET ${HDF5_F90_LIBSH_TARGET} APPEND PROPERTY +# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> +# ) +# set_property(TARGET ${HDF5_F90_LIBSH_TARGET} APPEND PROPERTY +# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> +# ) +# set_property(TARGET ${HDF5_F90_LIBSH_TARGET} APPEND PROPERTY +# LINK_FLAGS $<$:"-DLL"> +# ) +# set_property(TARGET ${HDF5_F90_LIBSH_TARGET} APPEND PROPERTY +# LINK_FLAGS $<$:"-DEF:${HDF5_F90_SRC_BINARY_DIR}/hdf5_fortrandll.def"> +# ) + if(MSVC) + set_property(TARGET ${HDF5_F90_LIBSH_TARGET} APPEND PROPERTY LINK_FLAGS "-SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS};-DLL;-DEF:${HDF5_F90_SRC_BINARY_DIR}/hdf5_fortrandll.def") + endif() set_target_properties (${HDF5_F90_LIBSH_TARGET} PROPERTIES FOLDER libraries/fortran LINKER_LANGUAGE Fortran diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index 964d588..f8d10a3 100644 --- a/fortran/test/CMakeLists.txt +++ b/fortran/test/CMakeLists.txt @@ -17,9 +17,12 @@ if (BUILD_SHARED_LIBS) $<$:/MT> ) endif () -set_property(TARGET H5_test_buildiface APPEND_STRING PROPERTY - LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> -) +#set_property(TARGET H5_test_buildiface APPEND PROPERTY +# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> +#) +if(MSVC) + set_property(TARGET H5_test_buildiface APPEND PROPERTY LINK_FLAGS "-SUBSYSTEM:CONSOLE") +endif() set_target_properties (H5_test_buildiface PROPERTIES LINKER_LANGUAGE Fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY} @@ -133,12 +136,15 @@ target_link_libraries (${HDF5_F90_TEST_LIB_TARGET} PUBLIC ${HDF5_F90_C_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} ) -set_property(TARGET ${HDF5_F90_TEST_LIB_TARGET} APPEND_STRING PROPERTY - LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> -) -set_property(TARGET ${HDF5_F90_TEST_LIB_TARGET} APPEND_STRING PROPERTY - LINK_FLAGS $<$:${WIN_LINK_FLAGS}> -) +#set_property(TARGET ${HDF5_F90_TEST_LIB_TARGET} APPEND PROPERTY +# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> +#) +#set_property(TARGET ${HDF5_F90_TEST_LIB_TARGET} APPEND PROPERTY +# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> +#) +if(MSVC) + set_property(TARGET ${HDF5_F90_TEST_LIB_TARGET} APPEND PROPERTY LINK_FLAGS "-SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") +endif() set_target_properties (${HDF5_F90_TEST_LIB_TARGET} PROPERTIES FOLDER libraries/test/fortran LINKER_LANGUAGE Fortran @@ -167,15 +173,18 @@ if (BUILD_SHARED_LIBS) PUBLIC ${HDF5_F90_C_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ) - set_property(TARGET ${HDF5_F90_TEST_LIBSH_TARGET} APPEND_STRING PROPERTY - LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> - ) - set_property(TARGET ${HDF5_F90_TEST_LIBSH_TARGET} APPEND_STRING PROPERTY - LINK_FLAGS $<$:${WIN_LINK_FLAGS}> - ) - set_property(TARGET ${HDF5_F90_TEST_LIBSH_TARGET} APPEND_STRING PROPERTY - LINK_FLAGS $<$:"-DLL"> - ) +# set_property(TARGET ${HDF5_F90_TEST_LIBSH_TARGET} APPEND PROPERTY +# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> +# ) +# set_property(TARGET ${HDF5_F90_TEST_LIBSH_TARGET} APPEND PROPERTY +# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> +# ) +# set_property(TARGET ${HDF5_F90_TEST_LIBSH_TARGET} APPEND PROPERTY +# LINK_FLAGS $<$:"-DLL"> +# ) + if(MSVC) + set_property(TARGET ${HDF5_F90_TEST_LIBSH_TARGET} APPEND PROPERTY LINK_FLAGS "-SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS};-DLL") + endif() set_target_properties (${HDF5_F90_TEST_LIBSH_TARGET} PROPERTIES FOLDER libraries/test/fortran LINKER_LANGUAGE Fortran @@ -219,12 +228,15 @@ target_link_libraries (testhdf5_fortran PRIVATE ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} $<$:ws2_32.lib> ) -set_property(TARGET testhdf5_fortran APPEND_STRING PROPERTY - LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> -) -set_property(TARGET testhdf5_fortran APPEND_STRING PROPERTY - LINK_FLAGS $<$:${WIN_LINK_FLAGS}> -) +#set_property(TARGET testhdf5_fortran APPEND PROPERTY +# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> +#) +#set_property(TARGET testhdf5_fortran APPEND PROPERTY +# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> +#) +if(MSVC) + set_property(TARGET testhdf5_fortran APPEND PROPERTY LINK_FLAGS "-SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") +endif() set_target_properties (testhdf5_fortran PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran @@ -263,12 +275,15 @@ if (BUILD_SHARED_LIBS) PRIVATE ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$:ws2_32.lib> ) - set_property(TARGET testhdf5_fortran-shared APPEND_STRING PROPERTY - LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> - ) - set_property(TARGET testhdf5_fortran-shared APPEND_STRING PROPERTY - LINK_FLAGS $<$:${WIN_LINK_FLAGS}> - ) +# set_property(TARGET testhdf5_fortran-shared APPEND PROPERTY +# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> +# ) +# set_property(TARGET testhdf5_fortran-shared APPEND PROPERTY +# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> +# ) + if(MSVC) + set_property(TARGET testhdf5_fortran-shared APPEND PROPERTY LINK_FLAGS "-SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") + endif() set_target_properties (testhdf5_fortran-shared PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran @@ -298,12 +313,15 @@ target_link_libraries (testhdf5_fortran_1_8 PRIVATE ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} $<$:ws2_32.lib> ) -set_property(TARGET testhdf5_fortran_1_8 APPEND_STRING PROPERTY - LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> -) -set_property(TARGET testhdf5_fortran_1_8 APPEND_STRING PROPERTY - LINK_FLAGS $<$:${WIN_LINK_FLAGS}> -) +#set_property(TARGET testhdf5_fortran_1_8 APPEND PROPERTY +# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> +#) +#set_property(TARGET testhdf5_fortran_1_8 APPEND PROPERTY +# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> +#) +if(MSVC) + set_property(TARGET testhdf5_fortran_1_8 APPEND PROPERTY LINK_FLAGS "-SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") +endif() set_target_properties (testhdf5_fortran_1_8 PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran @@ -333,12 +351,15 @@ if (BUILD_SHARED_LIBS) PRIVATE ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$:ws2_32.lib> ) - set_property(TARGET testhdf5_fortran_1_8-shared APPEND_STRING PROPERTY - LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> - ) - set_property(TARGET testhdf5_fortran_1_8-shared APPEND_STRING PROPERTY - LINK_FLAGS $<$:${WIN_LINK_FLAGS}> - ) +# set_property(TARGET testhdf5_fortran_1_8-shared APPEND PROPERTY +# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> +# ) +# set_property(TARGET testhdf5_fortran_1_8-shared APPEND PROPERTY +# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> +# ) + if(MSVC) + set_property(TARGET testhdf5_fortran_1_8-shared APPEND PROPERTY LINK_FLAGS "-SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") + endif() set_target_properties (testhdf5_fortran_1_8-shared PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran @@ -370,12 +391,15 @@ target_link_libraries (fortranlib_test_F03 PRIVATE ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} $<$:ws2_32.lib> ) -set_property(TARGET fortranlib_test_F03 APPEND_STRING PROPERTY - LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> -) -set_property(TARGET fortranlib_test_F03 APPEND_STRING PROPERTY - LINK_FLAGS $<$:${WIN_LINK_FLAGS}> -) +#set_property(TARGET fortranlib_test_F03 APPEND PROPERTY +# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> +#) +#set_property(TARGET fortranlib_test_F03 APPEND PROPERTY +# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> +#) +if(MSVC) + set_property(TARGET fortranlib_test_F03 APPEND PROPERTY LINK_FLAGS "-SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") +endif() set_target_properties (fortranlib_test_F03 PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran @@ -407,12 +431,15 @@ if (BUILD_SHARED_LIBS) PRIVATE ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$:ws2_32.lib> ) - set_property(TARGET fortranlib_test_F03-shared APPEND_STRING PROPERTY - LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> - ) - set_property(TARGET fortranlib_test_F03-shared APPEND_STRING PROPERTY - LINK_FLAGS $<$:${WIN_LINK_FLAGS}> - ) +# set_property(TARGET fortranlib_test_F03-shared APPEND PROPERTY +# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> +# ) +# set_property(TARGET fortranlib_test_F03-shared APPEND PROPERTY +# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> +# ) + if(MSVC) + set_property(TARGET fortranlib_test_F03-shared APPEND PROPERTY LINK_FLAGS "-SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") + endif() set_target_properties (fortranlib_test_F03-shared PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran @@ -435,12 +462,15 @@ target_link_libraries (fflush1 PRIVATE ${HDF5_F90_LIB_TARGET} ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_LIB_TARGET} $<$:ws2_32.lib> ) -set_property(TARGET fflush1 APPEND_STRING PROPERTY - LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> -) -set_property(TARGET fflush1 APPEND_STRING PROPERTY - LINK_FLAGS $<$:${WIN_LINK_FLAGS}> -) +#set_property(TARGET fflush1 APPEND PROPERTY +# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> +#) +#set_property(TARGET fflush1 APPEND PROPERTY +# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> +#) +if(MSVC) + set_property(TARGET fflush1 APPEND PROPERTY LINK_FLAGS "-SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") +endif() set_target_properties (fflush1 PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran @@ -463,12 +493,15 @@ if (BUILD_SHARED_LIBS) PRIVATE ${HDF5_F90_LIBSH_TARGET} ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$:ws2_32.lib> ) - set_property(TARGET fflush1-shared APPEND_STRING PROPERTY - LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> - ) - set_property(TARGET fflush1-shared APPEND_STRING PROPERTY - LINK_FLAGS $<$:${WIN_LINK_FLAGS}> - ) +# set_property(TARGET fflush1-shared APPEND PROPERTY +# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> +# ) +# set_property(TARGET fflush1-shared APPEND PROPERTY +# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> +# ) + if(MSVC) + set_property(TARGET fflush1-shared APPEND PROPERTY LINK_FLAGS "-SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") + endif() set_target_properties (fflush1-shared PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran @@ -491,12 +524,15 @@ target_link_libraries (fflush2 PRIVATE ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} $<$:ws2_32.lib> ) -set_property(TARGET fflush2 APPEND_STRING PROPERTY - LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> -) -set_property(TARGET fflush2 APPEND_STRING PROPERTY - LINK_FLAGS $<$:${WIN_LINK_FLAGS}> -) +#set_property(TARGET fflush2 APPEND PROPERTY +# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> +#) +#set_property(TARGET fflush2 APPEND PROPERTY +# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> +#) +if(MSVC) + set_property(TARGET fflush2 APPEND PROPERTY LINK_FLAGS "-SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") +endif() set_target_properties (fflush2 PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran @@ -519,12 +555,15 @@ if (BUILD_SHARED_LIBS) PRIVATE ${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} $<$:ws2_32.lib> ) - set_property(TARGET fflush2-shared APPEND_STRING PROPERTY - LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> - ) - set_property(TARGET fflush2-shared APPEND_STRING PROPERTY - LINK_FLAGS $<$:${WIN_LINK_FLAGS}> - ) +# set_property(TARGET fflush2-shared APPEND PROPERTY +# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> +# ) +# set_property(TARGET fflush2-shared APPEND PROPERTY +# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> +# ) + if(MSVC) + set_property(TARGET fflush2-shared APPEND PROPERTY LINK_FLAGS "-SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") + endif() set_target_properties (fflush2-shared PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/fortran diff --git a/fortran/testpar/CMakeLists.txt b/fortran/testpar/CMakeLists.txt index 5ead405..c53f724 100644 --- a/fortran/testpar/CMakeLists.txt +++ b/fortran/testpar/CMakeLists.txt @@ -29,12 +29,15 @@ target_link_libraries (parallel_test ${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} ${LINK_Fortran_LIBS} $<$:"ws2_32.lib"> ) -set_property(TARGET parallel_test APPEND_STRING PROPERTY - LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> -) -set_property(TARGET parallel_test APPEND_STRING PROPERTY - LINK_FLAGS $<$:${WIN_LINK_FLAGS}> -) +#set_property(TARGET parallel_test APPEND PROPERTY +# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> +#) +#set_property(TARGET parallel_test APPEND PROPERTY +# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> +#) +if(MSVC) + set_property(TARGET parallel_test APPEND PROPERTY LINK_FLAGS "-SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") +endif() set_target_properties (parallel_test PROPERTIES FOLDER test/fortran LINKER_LANGUAGE Fortran diff --git a/hl/fortran/examples/CMakeLists.txt b/hl/fortran/examples/CMakeLists.txt index 97ddce8..bd33a19 100644 --- a/hl/fortran/examples/CMakeLists.txt +++ b/hl/fortran/examples/CMakeLists.txt @@ -20,12 +20,15 @@ foreach (example ${examples}) PRIVATE ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} ) - set_property(TARGET hl_f90_ex_${example} APPEND_STRING PROPERTY - LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> - ) - set_property(TARGET hl_f90_ex_${example} APPEND_STRING PROPERTY - LINK_FLAGS $<$:${WIN_LINK_FLAGS}> - ) +# set_property(TARGET hl_f90_ex_${example} APPEND PROPERTY +# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> +# ) +# set_property(TARGET hl_f90_ex_${example} APPEND PROPERTY +# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> +# ) + if(MSVC) + set_property(TARGET hl_f90_ex_${example} APPEND PROPERTY LINK_FLAGS "-SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") + endif() set_target_properties (hl_f90_ex_${example} PROPERTIES LINKER_LANGUAGE Fortran FOLDER examples/hl/fortran diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt index 6aec901..310ed4f 100644 --- a/hl/fortran/src/CMakeLists.txt +++ b/hl/fortran/src/CMakeLists.txt @@ -22,9 +22,12 @@ if (WIN32 AND MSVC) set_target_properties (H5HL_buildiface PROPERTIES COMPILE_FLAGS "/MT") endif () endif () -set_property(TARGET H5HL_buildiface APPEND_STRING PROPERTY - LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> -) +#set_property(TARGET H5HL_buildiface APPEND PROPERTY +# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> +#) +if(MSVC) + set_property(TARGET H5HL_buildiface APPEND PROPERTY LINK_FLAGS "-SUBSYSTEM:CONSOLE") +endif() set_target_properties (H5HL_buildiface PROPERTIES LINKER_LANGUAGE Fortran Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY} @@ -166,12 +169,15 @@ target_link_libraries (${HDF5_HL_F90_LIB_TARGET} PUBLIC ${HDF5_HL_F90_C_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ) -set_property(TARGET ${HDF5_HL_F90_LIB_TARGET} APPEND_STRING PROPERTY - LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> -) -set_property(TARGET ${HDF5_HL_F90_LIB_TARGET} APPEND_STRING PROPERTY - LINK_FLAGS $<$:${WIN_LINK_FLAGS}> -) +#set_property(TARGET ${HDF5_HL_F90_LIB_TARGET} APPEND PROPERTY +# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> +#) +#set_property(TARGET ${HDF5_HL_F90_LIB_TARGET} APPEND PROPERTY +# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> +#) +if(MSVC) + set_property(TARGET ${HDF5_HL_F90_LIB_TARGET} APPEND PROPERTY LINK_FLAGS "-SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") +endif() set_target_properties (${HDF5_HL_F90_LIB_TARGET} PROPERTIES FOLDER libraries/hl/fortran LINKER_LANGUAGE Fortran @@ -204,18 +210,21 @@ if (BUILD_SHARED_LIBS) PRIVATE ${LINK_Fortran_LIBS} ) - set_property(TARGET ${HDF5_HL_F90_LIBSH_TARGET} APPEND_STRING PROPERTY - LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> - ) - set_property(TARGET ${HDF5_HL_F90_LIBSH_TARGET} APPEND_STRING PROPERTY - LINK_FLAGS $<$:${WIN_LINK_FLAGS}> - ) - set_property(TARGET ${HDF5_HL_F90_LIBSH_TARGET} APPEND_STRING PROPERTY - LINK_FLAGS $<$:"-DLL"> - ) - set_property(TARGET ${HDF5_HL_F90_LIBSH_TARGET} APPEND_STRING PROPERTY - LINK_FLAGS $<$:"-DEF:${HDF5_HL_F90_SRC_BINARY_DIR}/hdf5_hl_fortrandll.def"> - ) +# set_property(TARGET ${HDF5_HL_F90_LIBSH_TARGET} APPEND PROPERTY +# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> +# ) +# set_property(TARGET ${HDF5_HL_F90_LIBSH_TARGET} APPEND PROPERTY +# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> +# ) +# set_property(TARGET ${HDF5_HL_F90_LIBSH_TARGET} APPEND PROPERTY +# LINK_FLAGS $<$:"-DLL"> +# ) +# set_property(TARGET ${HDF5_HL_F90_LIBSH_TARGET} APPEND PROPERTY +# LINK_FLAGS $<$:"-DEF:${HDF5_HL_F90_SRC_BINARY_DIR}/hdf5_hl_fortrandll.def"> +# ) + if(MSVC) + set_property(TARGET ${HDF5_HL_F90_LIBSH_TARGET} APPEND PROPERTY LINK_FLAGS "-SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS};-DLL;-DEF:${HDF5_HL_F90_SRC_BINARY_DIR}/hdf5_hl_fortrandll.def") + endif() set_target_properties (${HDF5_HL_F90_LIBSH_TARGET} PROPERTIES FOLDER libraries/hl/fortran LINKER_LANGUAGE Fortran diff --git a/hl/fortran/test/CMakeLists.txt b/hl/fortran/test/CMakeLists.txt index d6d1ab0..496ea0e 100644 --- a/hl/fortran/test/CMakeLists.txt +++ b/hl/fortran/test/CMakeLists.txt @@ -25,12 +25,15 @@ macro (ADD_H5_FORTRAN_EXE file) PRIVATE ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ) - set_property(TARGET hl_f90_${file} APPEND_STRING PROPERTY - LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> - ) - set_property(TARGET hl_f90_${file} APPEND_STRING PROPERTY - LINK_FLAGS $<$:${WIN_LINK_FLAGS}> - ) +# set_property(TARGET hl_f90_${file} APPEND PROPERTY +# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> +# ) +# set_property(TARGET hl_f90_${file} APPEND PROPERTY +# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> +# ) + if(MSVC) + set_property(TARGET hl_f90_${file} APPEND PROPERTY LINK_FLAGS "-SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") + endif() set_target_properties (hl_f90_${file} PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/hl/fortran @@ -50,12 +53,15 @@ macro (ADD_H5_FORTRAN_EXE file) PRIVATE ${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ) - set_property(TARGET hl_f90_${file}-shared APPEND_STRING PROPERTY - LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> - ) - set_property(TARGET hl_f90_${file}-shared APPEND_STRING PROPERTY - LINK_FLAGS $<$:${WIN_LINK_FLAGS}> - ) +# set_property(TARGET hl_f90_${file}-shared APPEND PROPERTY +# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> +# ) +# set_property(TARGET hl_f90_${file}-shared APPEND PROPERTY +# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> +# ) + if(MSVC) + set_property(TARGET hl_f90_${file}-shared APPEND PROPERTY LINK_FLAGS "-SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") + endif() set_target_properties (hl_f90_${file}-shared PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/hl/fortran -- cgit v0.12 From 866337babe20fa3cd003f7c89b5ece7e60f5b0b2 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 3 May 2018 12:03:46 -0500 Subject: Missed a command revert --- fortran/examples/CMakeLists.txt | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/fortran/examples/CMakeLists.txt b/fortran/examples/CMakeLists.txt index db1880b..c073177 100644 --- a/fortran/examples/CMakeLists.txt +++ b/fortran/examples/CMakeLists.txt @@ -76,12 +76,15 @@ foreach (example ${examples}) PRIVATE ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ) - set_property(TARGET f90_ex_${example}-shared APPEND PROPERTY - LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> - ) - set_property(TARGET f90_ex_${example}-shared APPEND PROPERTY - LINK_FLAGS $<$:${WIN_LINK_FLAGS}> - ) +# set_property(TARGET f90_ex_${example}-shared APPEND PROPERTY +# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> +# ) +# set_property(TARGET f90_ex_${example}-shared APPEND PROPERTY +# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> +# ) + if(MSVC) + set_property(TARGET f90_ex_${example}-shared APPEND PROPERTY LINK_FLAGS "-SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") + endif() set_target_properties (f90_ex_${example}-shared PROPERTIES LINKER_LANGUAGE Fortran FOLDER examples/fortran -- cgit v0.12 From ab971fafdd43dbf55e0dc017fb17077a0922e4c4 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 3 May 2018 12:10:13 -0500 Subject: Fix another command revert --- fortran/examples/CMakeLists.txt | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/fortran/examples/CMakeLists.txt b/fortran/examples/CMakeLists.txt index c073177..1b7e4f0 100644 --- a/fortran/examples/CMakeLists.txt +++ b/fortran/examples/CMakeLists.txt @@ -107,12 +107,15 @@ foreach (example ${F2003_examples}) PRIVATE ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} ) - set_property(TARGET f03_ex_${example} APPEND PROPERTY - LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> - ) - set_property(TARGET f03_ex_${example} APPEND PROPERTY - LINK_FLAGS $<$:${WIN_LINK_FLAGS}> - ) +# set_property(TARGET f03_ex_${example} APPEND PROPERTY +# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> +# ) +# set_property(TARGET f03_ex_${example} APPEND PROPERTY +# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> +# ) + if(MSVC) + set_property(TARGET f03_ex_${example} APPEND PROPERTY LINK_FLAGS "-SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") + endif() set_target_properties (f03_ex_${example} PROPERTIES LINKER_LANGUAGE Fortran FOLDER examples/fortran03 @@ -133,12 +136,15 @@ foreach (example ${F2003_examples}) PRIVATE ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ) - set_property(TARGET f03_ex_${example}-shared APPEND PROPERTY - LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> - ) - set_property(TARGET f03_ex_${example}-shared APPEND PROPERTY - LINK_FLAGS $<$:${WIN_LINK_FLAGS}> - ) +# set_property(TARGET f03_ex_${example}-shared APPEND PROPERTY +# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> +# ) +# set_property(TARGET f03_ex_${example}-shared APPEND PROPERTY +# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> +# ) + if(MSVC) + set_property(TARGET f03_ex_${example}-shared APPEND PROPERTY LINK_FLAGS "-SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") + endif() set_target_properties (f03_ex_${example}-shared PROPERTIES LINKER_LANGUAGE Fortran FOLDER examples/fortran03 -- cgit v0.12 From 9d13f3b1e130ca986f085faf84ab1e1515ca9008 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 3 May 2018 12:32:36 -0500 Subject: add missing folder to path --- hl/fortran/src/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt index 310ed4f..a7b760d 100644 --- a/hl/fortran/src/CMakeLists.txt +++ b/hl/fortran/src/CMakeLists.txt @@ -100,14 +100,14 @@ set (HDF5_HL_F90_F_BASE_SOURCES ) add_custom_command ( - OUTPUT ${HDF5_HL_F90_BINARY_DIR}/static/H5LTff_gen.F90 ${HDF5_HL_F90_BINARY_DIR}/H5TBff_gen.F90 + OUTPUT ${HDF5_HL_F90_BINARY_DIR}/static/H5LTff_gen.F90 ${HDF5_HL_F90_BINARY_DIR}/static/H5TBff_gen.F90 COMMAND $ WORKING_DIRECTORY ${HDF5_HL_F90_BINARY_DIR}/static DEPENDS ${HDF5_HL_F90_F_BASE_SOURCES} COMMENT "Generating the H5LTff_gen.F90, H5TBff_gen.F90 files" ) add_custom_target (H5HLgen ALL - DEPENDS ${HDF5_HL_F90_BINARY_DIR}/static/H5LTff_gen.F90 ${HDF5_HL_F90_BINARY_DIR}/H5TBff_gen.F90 + DEPENDS ${HDF5_HL_F90_BINARY_DIR}/static/H5LTff_gen.F90 ${HDF5_HL_F90_BINARY_DIR}/static/H5TBff_gen.F90 ) set_source_files_properties ( ${HDF5_HL_F90_BINARY_DIR}/static/H5LTff_gen.F90 -- cgit v0.12 From 5fefa587e50fc6f9e634a34cdd54946a1c0a3f42 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 3 May 2018 12:36:59 -0500 Subject: Add missing test lib --- hl/fortran/test/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hl/fortran/test/CMakeLists.txt b/hl/fortran/test/CMakeLists.txt index 496ea0e..d5fe892 100644 --- a/hl/fortran/test/CMakeLists.txt +++ b/hl/fortran/test/CMakeLists.txt @@ -23,7 +23,7 @@ macro (ADD_H5_FORTRAN_EXE file) ) target_link_libraries (hl_f90_${file} PRIVATE - ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET} + ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_F90_TEST_LIB_TARGET ) # set_property(TARGET hl_f90_${file} APPEND PROPERTY # LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> @@ -51,7 +51,7 @@ macro (ADD_H5_FORTRAN_EXE file) ) target_link_libraries (hl_f90_${file}-shared PRIVATE - ${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} + ${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_F90_TEST_LIBSH_TARGET} ) # set_property(TARGET hl_f90_${file}-shared APPEND PROPERTY # LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> -- cgit v0.12 From 2316a6c927e422b094cc96e5f6aeb2ac89d84632 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 3 May 2018 12:37:57 -0500 Subject: Fix typo --- hl/fortran/test/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hl/fortran/test/CMakeLists.txt b/hl/fortran/test/CMakeLists.txt index d5fe892..61705e2 100644 --- a/hl/fortran/test/CMakeLists.txt +++ b/hl/fortran/test/CMakeLists.txt @@ -23,7 +23,7 @@ macro (ADD_H5_FORTRAN_EXE file) ) target_link_libraries (hl_f90_${file} PRIVATE - ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_F90_TEST_LIB_TARGET + ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_F90_TEST_LIB_TARGET} ) # set_property(TARGET hl_f90_${file} APPEND PROPERTY # LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> -- cgit v0.12 From 6fcf4c9aeb12edf206e5d548f6f060fb979d4fbb Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 3 May 2018 15:41:50 -0500 Subject: Remove APPEND --- config/cmake/UserMacros/Windows_MT.cmake | 2 +- fortran/examples/CMakeLists.txt | 38 ++++++++++++++++++-------------- fortran/src/CMakeLists.txt | 6 ++--- fortran/test/CMakeLists.txt | 26 +++++++++++----------- fortran/testpar/CMakeLists.txt | 2 +- hl/fortran/examples/CMakeLists.txt | 2 +- hl/fortran/src/CMakeLists.txt | 6 ++--- hl/fortran/test/CMakeLists.txt | 4 ++-- 8 files changed, 46 insertions(+), 40 deletions(-) diff --git a/config/cmake/UserMacros/Windows_MT.cmake b/config/cmake/UserMacros/Windows_MT.cmake index ea95908..b6cc513 100644 --- a/config/cmake/UserMacros/Windows_MT.cmake +++ b/config/cmake/UserMacros/Windows_MT.cmake @@ -40,7 +40,7 @@ macro (TARGET_STATIC_CRT_FLAGS) endif () endforeach () set (WIN_COMPILE_FLAGS "") - set (WIN_LINK_FLAGS "-NODEFAULTLIB:MSVCRT") + set (WIN_LINK_FLAGS "/NODEFAULTLIB:MSVCRT") endif () endmacro () diff --git a/fortran/examples/CMakeLists.txt b/fortran/examples/CMakeLists.txt index 1b7e4f0..8b1ba60 100644 --- a/fortran/examples/CMakeLists.txt +++ b/fortran/examples/CMakeLists.txt @@ -54,7 +54,7 @@ foreach (example ${examples}) # LINK_FLAGS $<$:> # ) if(MSVC) - set_property(TARGET H5_buildiface APPEND PROPERTY LINK_FLAGS "-SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") + set_property(TARGET H5_buildiface PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") endif() set_target_properties (f90_ex_${example} PROPERTIES LINKER_LANGUAGE Fortran @@ -83,7 +83,7 @@ foreach (example ${examples}) # LINK_FLAGS $<$:${WIN_LINK_FLAGS}> # ) if(MSVC) - set_property(TARGET f90_ex_${example}-shared APPEND PROPERTY LINK_FLAGS "-SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") + set_property(TARGET f90_ex_${example}-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") endif() set_target_properties (f90_ex_${example}-shared PROPERTIES LINKER_LANGUAGE Fortran @@ -114,7 +114,7 @@ foreach (example ${F2003_examples}) # LINK_FLAGS $<$:${WIN_LINK_FLAGS}> # ) if(MSVC) - set_property(TARGET f03_ex_${example} APPEND PROPERTY LINK_FLAGS "-SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") + set_property(TARGET f03_ex_${example} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") endif() set_target_properties (f03_ex_${example} PROPERTIES LINKER_LANGUAGE Fortran @@ -143,7 +143,7 @@ foreach (example ${F2003_examples}) # LINK_FLAGS $<$:${WIN_LINK_FLAGS}> # ) if(MSVC) - set_property(TARGET f03_ex_${example}-shared APPEND PROPERTY LINK_FLAGS "-SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") + set_property(TARGET f03_ex_${example}-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") endif() set_target_properties (f03_ex_${example}-shared PROPERTIES LINKER_LANGUAGE Fortran @@ -167,12 +167,15 @@ if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) PRIVATE ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} ) - set_property(TARGET f90_ex_ph5example APPEND PROPERTY - LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> - ) - set_property(TARGET f90_ex_ph5example APPEND PROPERTY - LINK_FLAGS $<$:${WIN_LINK_FLAGS}> - ) +# set_property(TARGET f90_ex_ph5example APPEND PROPERTY +# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> +# ) +# set_property(TARGET f90_ex_ph5example APPEND PROPERTY +# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> +# ) + if(MSVC) + set_property(TARGET f90_ex_ph5example PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") + endif() set_target_properties (f90_ex_ph5example PROPERTIES LINKER_LANGUAGE Fortran FOLDER examples/fortran @@ -193,12 +196,15 @@ if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) PRIVATE ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ) - set_property(TARGET f90_ex_ph5example-shared APPEND PROPERTY - LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> - ) - set_property(TARGET f90_ex_ph5example-shared APPEND PROPERTY - LINK_FLAGS $<$:${WIN_LINK_FLAGS}> - ) +# set_property(TARGET f90_ex_ph5example-shared APPEND PROPERTY +# LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> +# ) +# set_property(TARGET f90_ex_ph5example-shared APPEND PROPERTY +# LINK_FLAGS $<$:${WIN_LINK_FLAGS}> +# ) + if(MSVC) + set_property(TARGET f90_ex_ph5example-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") + endif() set_target_properties (f90_ex_ph5example-shared PROPERTIES LINKER_LANGUAGE Fortran FOLDER examples/fortran diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index cafcbce..e630340 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -58,7 +58,7 @@ endif () # LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> #) if(MSVC) - set_property(TARGET H5_buildiface APPEND PROPERTY LINK_FLAGS "-SUBSYSTEM:CONSOLE") + set_property(TARGET H5_buildiface PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE") endif() set_target_properties (H5_buildiface PROPERTIES @@ -277,7 +277,7 @@ target_link_libraries (${HDF5_F90_LIB_TARGET} # LINK_FLAGS $<$:${WIN_LINK_FLAGS}> #) if(MSVC) - set_property(TARGET ${HDF5_F90_LIB_TARGET} APPEND PROPERTY LINK_FLAGS "-SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") + set_property(TARGET ${HDF5_F90_LIB_TARGET} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") endif() set_target_properties (${HDF5_F90_LIB_TARGET} PROPERTIES FOLDER libraries/fortran @@ -324,7 +324,7 @@ if (BUILD_SHARED_LIBS) # LINK_FLAGS $<$:"-DEF:${HDF5_F90_SRC_BINARY_DIR}/hdf5_fortrandll.def"> # ) if(MSVC) - set_property(TARGET ${HDF5_F90_LIBSH_TARGET} APPEND PROPERTY LINK_FLAGS "-SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS};-DLL;-DEF:${HDF5_F90_SRC_BINARY_DIR}/hdf5_fortrandll.def") + set_property(TARGET ${HDF5_F90_LIBSH_TARGET} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS};/DLL;/DEF:${HDF5_F90_SRC_BINARY_DIR}/hdf5_fortrandll.def") endif() set_target_properties (${HDF5_F90_LIBSH_TARGET} PROPERTIES FOLDER libraries/fortran diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index f8d10a3..60b5427 100644 --- a/fortran/test/CMakeLists.txt +++ b/fortran/test/CMakeLists.txt @@ -21,7 +21,7 @@ endif () # LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> #) if(MSVC) - set_property(TARGET H5_test_buildiface APPEND PROPERTY LINK_FLAGS "-SUBSYSTEM:CONSOLE") + set_property(TARGET H5_test_buildiface PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE") endif() set_target_properties (H5_test_buildiface PROPERTIES LINKER_LANGUAGE Fortran @@ -143,7 +143,7 @@ target_link_libraries (${HDF5_F90_TEST_LIB_TARGET} # LINK_FLAGS $<$:${WIN_LINK_FLAGS}> #) if(MSVC) - set_property(TARGET ${HDF5_F90_TEST_LIB_TARGET} APPEND PROPERTY LINK_FLAGS "-SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") + set_property(TARGET ${HDF5_F90_TEST_LIB_TARGET} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") endif() set_target_properties (${HDF5_F90_TEST_LIB_TARGET} PROPERTIES FOLDER libraries/test/fortran @@ -183,7 +183,7 @@ if (BUILD_SHARED_LIBS) # LINK_FLAGS $<$:"-DLL"> # ) if(MSVC) - set_property(TARGET ${HDF5_F90_TEST_LIBSH_TARGET} APPEND PROPERTY LINK_FLAGS "-SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS};-DLL") + set_property(TARGET ${HDF5_F90_TEST_LIBSH_TARGET} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS};-DLL") endif() set_target_properties (${HDF5_F90_TEST_LIBSH_TARGET} PROPERTIES FOLDER libraries/test/fortran @@ -235,7 +235,7 @@ target_link_libraries (testhdf5_fortran # LINK_FLAGS $<$:${WIN_LINK_FLAGS}> #) if(MSVC) - set_property(TARGET testhdf5_fortran APPEND PROPERTY LINK_FLAGS "-SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") + set_property(TARGET testhdf5_fortran PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") endif() set_target_properties (testhdf5_fortran PROPERTIES LINKER_LANGUAGE Fortran @@ -282,7 +282,7 @@ if (BUILD_SHARED_LIBS) # LINK_FLAGS $<$:${WIN_LINK_FLAGS}> # ) if(MSVC) - set_property(TARGET testhdf5_fortran-shared APPEND PROPERTY LINK_FLAGS "-SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") + set_property(TARGET testhdf5_fortran-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") endif() set_target_properties (testhdf5_fortran-shared PROPERTIES LINKER_LANGUAGE Fortran @@ -320,7 +320,7 @@ target_link_libraries (testhdf5_fortran_1_8 # LINK_FLAGS $<$:${WIN_LINK_FLAGS}> #) if(MSVC) - set_property(TARGET testhdf5_fortran_1_8 APPEND PROPERTY LINK_FLAGS "-SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") + set_property(TARGET testhdf5_fortran_1_8 PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") endif() set_target_properties (testhdf5_fortran_1_8 PROPERTIES LINKER_LANGUAGE Fortran @@ -358,7 +358,7 @@ if (BUILD_SHARED_LIBS) # LINK_FLAGS $<$:${WIN_LINK_FLAGS}> # ) if(MSVC) - set_property(TARGET testhdf5_fortran_1_8-shared APPEND PROPERTY LINK_FLAGS "-SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") + set_property(TARGET testhdf5_fortran_1_8-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") endif() set_target_properties (testhdf5_fortran_1_8-shared PROPERTIES LINKER_LANGUAGE Fortran @@ -398,7 +398,7 @@ target_link_libraries (fortranlib_test_F03 # LINK_FLAGS $<$:${WIN_LINK_FLAGS}> #) if(MSVC) - set_property(TARGET fortranlib_test_F03 APPEND PROPERTY LINK_FLAGS "-SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") + set_property(TARGET fortranlib_test_F03 PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") endif() set_target_properties (fortranlib_test_F03 PROPERTIES LINKER_LANGUAGE Fortran @@ -438,7 +438,7 @@ if (BUILD_SHARED_LIBS) # LINK_FLAGS $<$:${WIN_LINK_FLAGS}> # ) if(MSVC) - set_property(TARGET fortranlib_test_F03-shared APPEND PROPERTY LINK_FLAGS "-SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") + set_property(TARGET fortranlib_test_F03-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") endif() set_target_properties (fortranlib_test_F03-shared PROPERTIES LINKER_LANGUAGE Fortran @@ -469,7 +469,7 @@ target_link_libraries (fflush1 # LINK_FLAGS $<$:${WIN_LINK_FLAGS}> #) if(MSVC) - set_property(TARGET fflush1 APPEND PROPERTY LINK_FLAGS "-SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") + set_property(TARGET fflush1 PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") endif() set_target_properties (fflush1 PROPERTIES LINKER_LANGUAGE Fortran @@ -500,7 +500,7 @@ if (BUILD_SHARED_LIBS) # LINK_FLAGS $<$:${WIN_LINK_FLAGS}> # ) if(MSVC) - set_property(TARGET fflush1-shared APPEND PROPERTY LINK_FLAGS "-SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") + set_property(TARGET fflush1-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") endif() set_target_properties (fflush1-shared PROPERTIES LINKER_LANGUAGE Fortran @@ -531,7 +531,7 @@ target_link_libraries (fflush2 # LINK_FLAGS $<$:${WIN_LINK_FLAGS}> #) if(MSVC) - set_property(TARGET fflush2 APPEND PROPERTY LINK_FLAGS "-SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") + set_property(TARGET fflush2 PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") endif() set_target_properties (fflush2 PROPERTIES LINKER_LANGUAGE Fortran @@ -562,7 +562,7 @@ if (BUILD_SHARED_LIBS) # LINK_FLAGS $<$:${WIN_LINK_FLAGS}> # ) if(MSVC) - set_property(TARGET fflush2-shared APPEND PROPERTY LINK_FLAGS "-SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") + set_property(TARGET fflush2-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") endif() set_target_properties (fflush2-shared PROPERTIES LINKER_LANGUAGE Fortran diff --git a/fortran/testpar/CMakeLists.txt b/fortran/testpar/CMakeLists.txt index c53f724..9b74ec8 100644 --- a/fortran/testpar/CMakeLists.txt +++ b/fortran/testpar/CMakeLists.txt @@ -36,7 +36,7 @@ target_link_libraries (parallel_test # LINK_FLAGS $<$:${WIN_LINK_FLAGS}> #) if(MSVC) - set_property(TARGET parallel_test APPEND PROPERTY LINK_FLAGS "-SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") + set_property(TARGET parallel_test PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") endif() set_target_properties (parallel_test PROPERTIES FOLDER test/fortran diff --git a/hl/fortran/examples/CMakeLists.txt b/hl/fortran/examples/CMakeLists.txt index bd33a19..18f8248 100644 --- a/hl/fortran/examples/CMakeLists.txt +++ b/hl/fortran/examples/CMakeLists.txt @@ -27,7 +27,7 @@ foreach (example ${examples}) # LINK_FLAGS $<$:${WIN_LINK_FLAGS}> # ) if(MSVC) - set_property(TARGET hl_f90_ex_${example} APPEND PROPERTY LINK_FLAGS "-SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") + set_property(TARGET hl_f90_ex_${example} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") endif() set_target_properties (hl_f90_ex_${example} PROPERTIES LINKER_LANGUAGE Fortran diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt index a7b760d..0654194 100644 --- a/hl/fortran/src/CMakeLists.txt +++ b/hl/fortran/src/CMakeLists.txt @@ -26,7 +26,7 @@ endif () # LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> #) if(MSVC) - set_property(TARGET H5HL_buildiface APPEND PROPERTY LINK_FLAGS "-SUBSYSTEM:CONSOLE") + set_property(TARGET H5HL_buildiface PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE") endif() set_target_properties (H5HL_buildiface PROPERTIES LINKER_LANGUAGE Fortran @@ -176,7 +176,7 @@ target_link_libraries (${HDF5_HL_F90_LIB_TARGET} # LINK_FLAGS $<$:${WIN_LINK_FLAGS}> #) if(MSVC) - set_property(TARGET ${HDF5_HL_F90_LIB_TARGET} APPEND PROPERTY LINK_FLAGS "-SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") + set_property(TARGET ${HDF5_HL_F90_LIB_TARGET} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") endif() set_target_properties (${HDF5_HL_F90_LIB_TARGET} PROPERTIES FOLDER libraries/hl/fortran @@ -223,7 +223,7 @@ if (BUILD_SHARED_LIBS) # LINK_FLAGS $<$:"-DEF:${HDF5_HL_F90_SRC_BINARY_DIR}/hdf5_hl_fortrandll.def"> # ) if(MSVC) - set_property(TARGET ${HDF5_HL_F90_LIBSH_TARGET} APPEND PROPERTY LINK_FLAGS "-SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS};-DLL;-DEF:${HDF5_HL_F90_SRC_BINARY_DIR}/hdf5_hl_fortrandll.def") + set_property(TARGET ${HDF5_HL_F90_LIBSH_TARGET} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS};-DLL;-DEF:${HDF5_HL_F90_SRC_BINARY_DIR}/hdf5_hl_fortrandll.def") endif() set_target_properties (${HDF5_HL_F90_LIBSH_TARGET} PROPERTIES FOLDER libraries/hl/fortran diff --git a/hl/fortran/test/CMakeLists.txt b/hl/fortran/test/CMakeLists.txt index 61705e2..ea218da 100644 --- a/hl/fortran/test/CMakeLists.txt +++ b/hl/fortran/test/CMakeLists.txt @@ -32,7 +32,7 @@ macro (ADD_H5_FORTRAN_EXE file) # LINK_FLAGS $<$:${WIN_LINK_FLAGS}> # ) if(MSVC) - set_property(TARGET hl_f90_${file} APPEND PROPERTY LINK_FLAGS "-SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") + set_property(TARGET hl_f90_${file} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") endif() set_target_properties (hl_f90_${file} PROPERTIES LINKER_LANGUAGE Fortran @@ -60,7 +60,7 @@ macro (ADD_H5_FORTRAN_EXE file) # LINK_FLAGS $<$:${WIN_LINK_FLAGS}> # ) if(MSVC) - set_property(TARGET hl_f90_${file}-shared APPEND PROPERTY LINK_FLAGS "-SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") + set_property(TARGET hl_f90_${file}-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") endif() set_target_properties (hl_f90_${file}-shared PROPERTIES LINKER_LANGUAGE Fortran -- cgit v0.12 From 424e2275bc411226bf16741595b782deab6b92d9 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 7 May 2018 16:08:42 -0500 Subject: Correct command usage --- fortran/examples/CMakeLists.txt | 12 ++++++------ fortran/src/CMakeLists.txt | 4 ++-- fortran/test/CMakeLists.txt | 24 ++++++++++++------------ fortran/testpar/CMakeLists.txt | 2 +- hl/fortran/examples/CMakeLists.txt | 2 +- hl/fortran/src/CMakeLists.txt | 4 ++-- hl/fortran/test/CMakeLists.txt | 4 ++-- 7 files changed, 26 insertions(+), 26 deletions(-) diff --git a/fortran/examples/CMakeLists.txt b/fortran/examples/CMakeLists.txt index 8b1ba60..cc14651 100644 --- a/fortran/examples/CMakeLists.txt +++ b/fortran/examples/CMakeLists.txt @@ -54,7 +54,7 @@ foreach (example ${examples}) # LINK_FLAGS $<$:> # ) if(MSVC) - set_property(TARGET H5_buildiface PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") + set_property(TARGET H5_buildiface PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() set_target_properties (f90_ex_${example} PROPERTIES LINKER_LANGUAGE Fortran @@ -83,7 +83,7 @@ foreach (example ${examples}) # LINK_FLAGS $<$:${WIN_LINK_FLAGS}> # ) if(MSVC) - set_property(TARGET f90_ex_${example}-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") + set_property(TARGET f90_ex_${example}-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() set_target_properties (f90_ex_${example}-shared PROPERTIES LINKER_LANGUAGE Fortran @@ -114,7 +114,7 @@ foreach (example ${F2003_examples}) # LINK_FLAGS $<$:${WIN_LINK_FLAGS}> # ) if(MSVC) - set_property(TARGET f03_ex_${example} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") + set_property(TARGET f03_ex_${example} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() set_target_properties (f03_ex_${example} PROPERTIES LINKER_LANGUAGE Fortran @@ -143,7 +143,7 @@ foreach (example ${F2003_examples}) # LINK_FLAGS $<$:${WIN_LINK_FLAGS}> # ) if(MSVC) - set_property(TARGET f03_ex_${example}-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") + set_property(TARGET f03_ex_${example}-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() set_target_properties (f03_ex_${example}-shared PROPERTIES LINKER_LANGUAGE Fortran @@ -174,7 +174,7 @@ if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) # LINK_FLAGS $<$:${WIN_LINK_FLAGS}> # ) if(MSVC) - set_property(TARGET f90_ex_ph5example PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") + set_property(TARGET f90_ex_ph5example PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() set_target_properties (f90_ex_ph5example PROPERTIES LINKER_LANGUAGE Fortran @@ -203,7 +203,7 @@ if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) # LINK_FLAGS $<$:${WIN_LINK_FLAGS}> # ) if(MSVC) - set_property(TARGET f90_ex_ph5example-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") + set_property(TARGET f90_ex_ph5example-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() set_target_properties (f90_ex_ph5example-shared PROPERTIES LINKER_LANGUAGE Fortran diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index e630340..9bcdd29 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -277,7 +277,7 @@ target_link_libraries (${HDF5_F90_LIB_TARGET} # LINK_FLAGS $<$:${WIN_LINK_FLAGS}> #) if(MSVC) - set_property(TARGET ${HDF5_F90_LIB_TARGET} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") + set_property(TARGET ${HDF5_F90_LIB_TARGET} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() set_target_properties (${HDF5_F90_LIB_TARGET} PROPERTIES FOLDER libraries/fortran @@ -324,7 +324,7 @@ if (BUILD_SHARED_LIBS) # LINK_FLAGS $<$:"-DEF:${HDF5_F90_SRC_BINARY_DIR}/hdf5_fortrandll.def"> # ) if(MSVC) - set_property(TARGET ${HDF5_F90_LIBSH_TARGET} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS};/DLL;/DEF:${HDF5_F90_SRC_BINARY_DIR}/hdf5_fortrandll.def") + set_property(TARGET ${HDF5_F90_LIBSH_TARGET} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS} /DLL /DEF:${HDF5_F90_SRC_BINARY_DIR}/hdf5_fortrandll.def") endif() set_target_properties (${HDF5_F90_LIBSH_TARGET} PROPERTIES FOLDER libraries/fortran diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index 60b5427..c311139 100644 --- a/fortran/test/CMakeLists.txt +++ b/fortran/test/CMakeLists.txt @@ -143,7 +143,7 @@ target_link_libraries (${HDF5_F90_TEST_LIB_TARGET} # LINK_FLAGS $<$:${WIN_LINK_FLAGS}> #) if(MSVC) - set_property(TARGET ${HDF5_F90_TEST_LIB_TARGET} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") + set_property(TARGET ${HDF5_F90_TEST_LIB_TARGET} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() set_target_properties (${HDF5_F90_TEST_LIB_TARGET} PROPERTIES FOLDER libraries/test/fortran @@ -183,7 +183,7 @@ if (BUILD_SHARED_LIBS) # LINK_FLAGS $<$:"-DLL"> # ) if(MSVC) - set_property(TARGET ${HDF5_F90_TEST_LIBSH_TARGET} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS};-DLL") + set_property(TARGET ${HDF5_F90_TEST_LIBSH_TARGET} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS} -DLL") endif() set_target_properties (${HDF5_F90_TEST_LIBSH_TARGET} PROPERTIES FOLDER libraries/test/fortran @@ -235,7 +235,7 @@ target_link_libraries (testhdf5_fortran # LINK_FLAGS $<$:${WIN_LINK_FLAGS}> #) if(MSVC) - set_property(TARGET testhdf5_fortran PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") + set_property(TARGET testhdf5_fortran PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() set_target_properties (testhdf5_fortran PROPERTIES LINKER_LANGUAGE Fortran @@ -282,7 +282,7 @@ if (BUILD_SHARED_LIBS) # LINK_FLAGS $<$:${WIN_LINK_FLAGS}> # ) if(MSVC) - set_property(TARGET testhdf5_fortran-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") + set_property(TARGET testhdf5_fortran-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() set_target_properties (testhdf5_fortran-shared PROPERTIES LINKER_LANGUAGE Fortran @@ -320,7 +320,7 @@ target_link_libraries (testhdf5_fortran_1_8 # LINK_FLAGS $<$:${WIN_LINK_FLAGS}> #) if(MSVC) - set_property(TARGET testhdf5_fortran_1_8 PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") + set_property(TARGET testhdf5_fortran_1_8 PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() set_target_properties (testhdf5_fortran_1_8 PROPERTIES LINKER_LANGUAGE Fortran @@ -358,7 +358,7 @@ if (BUILD_SHARED_LIBS) # LINK_FLAGS $<$:${WIN_LINK_FLAGS}> # ) if(MSVC) - set_property(TARGET testhdf5_fortran_1_8-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") + set_property(TARGET testhdf5_fortran_1_8-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() set_target_properties (testhdf5_fortran_1_8-shared PROPERTIES LINKER_LANGUAGE Fortran @@ -398,7 +398,7 @@ target_link_libraries (fortranlib_test_F03 # LINK_FLAGS $<$:${WIN_LINK_FLAGS}> #) if(MSVC) - set_property(TARGET fortranlib_test_F03 PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") + set_property(TARGET fortranlib_test_F03 PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() set_target_properties (fortranlib_test_F03 PROPERTIES LINKER_LANGUAGE Fortran @@ -438,7 +438,7 @@ if (BUILD_SHARED_LIBS) # LINK_FLAGS $<$:${WIN_LINK_FLAGS}> # ) if(MSVC) - set_property(TARGET fortranlib_test_F03-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") + set_property(TARGET fortranlib_test_F03-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() set_target_properties (fortranlib_test_F03-shared PROPERTIES LINKER_LANGUAGE Fortran @@ -469,7 +469,7 @@ target_link_libraries (fflush1 # LINK_FLAGS $<$:${WIN_LINK_FLAGS}> #) if(MSVC) - set_property(TARGET fflush1 PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") + set_property(TARGET fflush1 PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() set_target_properties (fflush1 PROPERTIES LINKER_LANGUAGE Fortran @@ -500,7 +500,7 @@ if (BUILD_SHARED_LIBS) # LINK_FLAGS $<$:${WIN_LINK_FLAGS}> # ) if(MSVC) - set_property(TARGET fflush1-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") + set_property(TARGET fflush1-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() set_target_properties (fflush1-shared PROPERTIES LINKER_LANGUAGE Fortran @@ -531,7 +531,7 @@ target_link_libraries (fflush2 # LINK_FLAGS $<$:${WIN_LINK_FLAGS}> #) if(MSVC) - set_property(TARGET fflush2 PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") + set_property(TARGET fflush2 PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() set_target_properties (fflush2 PROPERTIES LINKER_LANGUAGE Fortran @@ -562,7 +562,7 @@ if (BUILD_SHARED_LIBS) # LINK_FLAGS $<$:${WIN_LINK_FLAGS}> # ) if(MSVC) - set_property(TARGET fflush2-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") + set_property(TARGET fflush2-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() set_target_properties (fflush2-shared PROPERTIES LINKER_LANGUAGE Fortran diff --git a/fortran/testpar/CMakeLists.txt b/fortran/testpar/CMakeLists.txt index 9b74ec8..bfb2495 100644 --- a/fortran/testpar/CMakeLists.txt +++ b/fortran/testpar/CMakeLists.txt @@ -36,7 +36,7 @@ target_link_libraries (parallel_test # LINK_FLAGS $<$:${WIN_LINK_FLAGS}> #) if(MSVC) - set_property(TARGET parallel_test PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") + set_property(TARGET parallel_test PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() set_target_properties (parallel_test PROPERTIES FOLDER test/fortran diff --git a/hl/fortran/examples/CMakeLists.txt b/hl/fortran/examples/CMakeLists.txt index 18f8248..cc671f0 100644 --- a/hl/fortran/examples/CMakeLists.txt +++ b/hl/fortran/examples/CMakeLists.txt @@ -27,7 +27,7 @@ foreach (example ${examples}) # LINK_FLAGS $<$:${WIN_LINK_FLAGS}> # ) if(MSVC) - set_property(TARGET hl_f90_ex_${example} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") + set_property(TARGET hl_f90_ex_${example} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() set_target_properties (hl_f90_ex_${example} PROPERTIES LINKER_LANGUAGE Fortran diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt index 0654194..902b8dc 100644 --- a/hl/fortran/src/CMakeLists.txt +++ b/hl/fortran/src/CMakeLists.txt @@ -176,7 +176,7 @@ target_link_libraries (${HDF5_HL_F90_LIB_TARGET} # LINK_FLAGS $<$:${WIN_LINK_FLAGS}> #) if(MSVC) - set_property(TARGET ${HDF5_HL_F90_LIB_TARGET} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") + set_property(TARGET ${HDF5_HL_F90_LIB_TARGET} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() set_target_properties (${HDF5_HL_F90_LIB_TARGET} PROPERTIES FOLDER libraries/hl/fortran @@ -223,7 +223,7 @@ if (BUILD_SHARED_LIBS) # LINK_FLAGS $<$:"-DEF:${HDF5_HL_F90_SRC_BINARY_DIR}/hdf5_hl_fortrandll.def"> # ) if(MSVC) - set_property(TARGET ${HDF5_HL_F90_LIBSH_TARGET} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS};-DLL;-DEF:${HDF5_HL_F90_SRC_BINARY_DIR}/hdf5_hl_fortrandll.def") + set_property(TARGET ${HDF5_HL_F90_LIBSH_TARGET} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS} -DLL -DEF:${HDF5_HL_F90_SRC_BINARY_DIR}/hdf5_hl_fortrandll.def") endif() set_target_properties (${HDF5_HL_F90_LIBSH_TARGET} PROPERTIES FOLDER libraries/hl/fortran diff --git a/hl/fortran/test/CMakeLists.txt b/hl/fortran/test/CMakeLists.txt index ea218da..0ee8d5b 100644 --- a/hl/fortran/test/CMakeLists.txt +++ b/hl/fortran/test/CMakeLists.txt @@ -32,7 +32,7 @@ macro (ADD_H5_FORTRAN_EXE file) # LINK_FLAGS $<$:${WIN_LINK_FLAGS}> # ) if(MSVC) - set_property(TARGET hl_f90_${file} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") + set_property(TARGET hl_f90_${file} PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() set_target_properties (hl_f90_${file} PROPERTIES LINKER_LANGUAGE Fortran @@ -60,7 +60,7 @@ macro (ADD_H5_FORTRAN_EXE file) # LINK_FLAGS $<$:${WIN_LINK_FLAGS}> # ) if(MSVC) - set_property(TARGET hl_f90_${file}-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE;${WIN_LINK_FLAGS}") + set_property(TARGET hl_f90_${file}-shared PROPERTY LINK_FLAGS "/SUBSYSTEM:CONSOLE ${WIN_LINK_FLAGS}") endif() set_target_properties (hl_f90_${file}-shared PROPERTIES LINKER_LANGUAGE Fortran -- cgit v0.12 From 4c4042121c4a8ca7092c23b41ba1e35001606ed3 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 7 May 2018 17:23:25 -0500 Subject: Use set_property for MT flag --- fortran/src/CMakeLists.txt | 15 +++++++++------ fortran/test/CMakeLists.txt | 15 +++++++++------ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index 9bcdd29..a29fb86 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -48,12 +48,15 @@ target_include_directories(H5_buildiface PRIVATE "${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR}" ) -if (BUILD_SHARED_LIBS) - target_compile_definitions(H5_buildiface - PRIVATE - $<$:/MT> - ) -endif () +#if (BUILD_SHARED_LIBS) +# target_compile_definitions(H5_buildiface +# PRIVATE +# $<$:/MT> +# ) +#endif () +if(MSVC) + set_property(TARGET H5_buildiface PROPERTY COMPILE_FLAGS "/MT") +endif() #set_property(TARGET H5_buildiface APPEND PROPERTY # LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> #) diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index c311139..b45154e 100644 --- a/fortran/test/CMakeLists.txt +++ b/fortran/test/CMakeLists.txt @@ -11,12 +11,15 @@ target_include_directories(H5_test_buildiface PRIVATE ${HDF5_BINARY_DIR} ${HDF5_F90_BINARY_DIR} ) -if (BUILD_SHARED_LIBS) - target_compile_definitions(H5_test_buildiface - PRIVATE - $<$:/MT> - ) -endif () +#if (BUILD_SHARED_LIBS) +# target_compile_definitions(H5_test_buildiface +# PRIVATE +# $<$:/MT> +# ) +#endif () +if(MSVC) + set_property(TARGET H5_test_buildiface PROPERTY COMPILE_FLAGS "/MT") +endif() #set_property(TARGET H5_test_buildiface APPEND PROPERTY # LINK_FLAGS $<$:"-SUBSYSTEM:CONSOLE"> #) -- cgit v0.12 From ce61ff09542b5cf4a5b773dc3e5fa3ed7b3825a3 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 8 May 2018 15:17:43 -0500 Subject: Add release note. --- release_docs/RELEASE.txt | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index d90aad4..d8a23b1 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -46,16 +46,16 @@ New Features Configuration: ------------- - - + - Library: -------- - - + - Parallel Library: ----------------- - - + - Fortran Library: ---------------- @@ -121,7 +121,19 @@ Bug Fixes since HDF5-1.10.2 release Configuration ------------- - - + - Converted CMake global commands ADD_DEFINITIONS and INCLUDE_DIRECTORIES + to use target_* type commands. This change modernizes the CMake usage + in the HDF5 library. + + In addition, there is the intention to convert to generator expressions, + where possible. The exception is Fortran FLAGS on Windows Visual Studio. + The HDF macros; TARGET_C_PROPERTIES and TARGET_FORTRAN_PROPERTIES have + been removed with this change in usage. + + The additional language (C++ and Fortran) checks have also been localized + to only be checked when that language is enabled. + + (ADB 2018/05/08) Performance ------------- -- cgit v0.12 From 71ce885eece48c71ad8b9894ab8af0d70caa22b9 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 8 May 2018 15:23:41 -0500 Subject: Correct sentence punctuation. --- release_docs/RELEASE.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index d8a23b1..43d631b 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -127,7 +127,7 @@ Bug Fixes since HDF5-1.10.2 release In addition, there is the intention to convert to generator expressions, where possible. The exception is Fortran FLAGS on Windows Visual Studio. - The HDF macros; TARGET_C_PROPERTIES and TARGET_FORTRAN_PROPERTIES have + The HDF macros TARGET_C_PROPERTIES and TARGET_FORTRAN_PROPERTIES have been removed with this change in usage. The additional language (C++ and Fortran) checks have also been localized -- cgit v0.12 From 0344785872020c4ef1de90cf57f286f1cf4ad2fc Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 8 May 2018 15:51:39 -0500 Subject: Text cleanup --- tools/src/h5jam/h5jam.c | 43 +++++++++++++++---------------------------- tools/src/h5jam/h5unjam.c | 17 +++-------------- 2 files changed, 18 insertions(+), 42 deletions(-) diff --git a/tools/src/h5jam/h5jam.c b/tools/src/h5jam/h5jam.c index cc5fcdc..01ba4af 100644 --- a/tools/src/h5jam/h5jam.c +++ b/tools/src/h5jam/h5jam.c @@ -56,11 +56,6 @@ static struct long_options l_opts[] = { * Purpose: Print the usage message * * Return: void - * - * Programmer: - * - * Modifications: - * *------------------------------------------------------------------------- */ static void @@ -120,7 +115,6 @@ usage (const char *prog) * Purpose: Shutdown and call exit() * * Return: Does not return - * *------------------------------------------------------------------------- */ static void @@ -144,13 +138,7 @@ leave(int ret) * Purpose: Parse the command line for the h5dumper. * * Return: Success: - * * Failure: Exits program with EXIT_FAILURE value. - * - * Programmer: - * - * Modifications: - * *------------------------------------------------------------------------- */ @@ -199,7 +187,6 @@ parse_command_line (int argc, const char *argv[]) * * Return: Success: 0 * Failure: 1 - * *------------------------------------------------------------------------- */ int @@ -238,7 +225,7 @@ main (int argc, const char *argv[]) if (ub_file == NULL) { /* no user block */ - error_msg("missing arguemnt for -u .\n"); + error_msg("missing argument for -u .\n"); help_ref_msg(stderr); leave (EXIT_FAILURE); } @@ -252,7 +239,7 @@ main (int argc, const char *argv[]) } if (input_file == NULL) { - error_msg("missing arguemnt for -i .\n"); + error_msg("missing argument for -i .\n"); help_ref_msg(stderr); leave (EXIT_FAILURE); } @@ -419,7 +406,6 @@ main (int argc, const char *argv[]) * * Return: Success: last byte written in the output. * Failure: Exits program with EXIT_FAILURE value. - * *------------------------------------------------------------------------- */ hsize_t @@ -451,7 +437,8 @@ copy_some_to_file(int infid, int outfid, hsize_t startin, hsize_t startout, } /* end if */ howmuch = (ssize_t)sbuf.st_size; - } else { + } + else { howmuch = limit; } /* end if */ @@ -464,7 +451,8 @@ copy_some_to_file(int infid, int outfid, hsize_t startin, hsize_t startout, if (howmuch > 512) { to = toend - 512; from = fromend - 512; - } else { + } + else { to = toend - howmuch; from = fromend - howmuch; } /* end if */ @@ -475,7 +463,8 @@ copy_some_to_file(int infid, int outfid, hsize_t startin, hsize_t startout, if (howmuch > 512) { nchars = HDread(infid, buf, (unsigned) 512); - } else { + } + else { nchars = HDread(infid, buf, (unsigned)howmuch); } /* end if */ @@ -494,7 +483,8 @@ copy_some_to_file(int infid, int outfid, hsize_t startin, hsize_t startout, if(howmuch > 512) { to -= nchars; from -= nchars; - } else { + } + else { to -= howmuch; from -= howmuch; } /* end if */ @@ -508,15 +498,11 @@ copy_some_to_file(int infid, int outfid, hsize_t startin, hsize_t startout, * Function: compute_user_block_size * * Purpose: Find the offset of the HDF5 header after the user block: - * align at 0, 512, 1024, etc. - * ublock_size: the size of the user block (bytes). + * align at 0, 512, 1024, etc. + * ublock_size: the size of the user block (bytes). * - * Return: Success: the location of the header == the size of the - * padded user block. + * Return: Success: the location of the header == the size of the padded user block. * Failure: none - * - * Return: Success: last byte written in the output. - * Failure: Exits program with EXIT_FAILURE value. *------------------------------------------------------------------------- */ H5_ATTR_CONST hsize_t @@ -533,11 +519,12 @@ compute_user_block_size(hsize_t ublock_size) return where; } /* end compute_user_block_size() */ -/* +/*------------------------------------------------------------------------- * Write zeroes to fill the file from 'where' to 512, 1024, etc. bytes. * * Sets new_where to the size of the padded file and * returns SUCCEED/FAIL. + *------------------------------------------------------------------------- */ herr_t write_pad(int ofile, hsize_t old_where, hsize_t *new_where) diff --git a/tools/src/h5jam/h5unjam.c b/tools/src/h5jam/h5unjam.c index 4e9798e..ffe2aca 100644 --- a/tools/src/h5jam/h5unjam.c +++ b/tools/src/h5jam/h5unjam.c @@ -56,11 +56,6 @@ static struct long_options l_opts[] = { * Purpose: Print the usage message * * Return: void - * - * Programmer: - * - * Modifications: - * *------------------------------------------------------------------------- */ static void @@ -124,9 +119,7 @@ usage(const char *prog) * Purpose: Parse the command line for the h5dumper. * * Return: Success: EXIT_SUCCESS; - * * Failure: Exits function with EXIT_FAILURE value. - * *------------------------------------------------------------------------- */ static int @@ -199,11 +192,6 @@ done: * * Return: Success: 0 * Failure: 1 - * - * Programmer: - * - * Modifications: - * *------------------------------------------------------------------------- */ int @@ -235,7 +223,7 @@ main(int argc, const char *argv[]) if (input_file == NULL) { /* no user block */ - error_msg("missing arguemnt for HDF5 file input.\n"); + error_msg("missing argument for HDF5 file input.\n"); help_ref_msg(stderr); h5tools_setstatus(EXIT_FAILURE); goto done; @@ -336,11 +324,12 @@ done: return h5tools_getstatus(); } -/* +/*------------------------------------------------------------------------- * Copy 'how_much' bytes from the input file to the output file, * starting at byte 'where' in the input file. * * Returns 0 on success, -1 on failure. + *------------------------------------------------------------------------- */ herr_t copy_to_file( FILE *infid, FILE *ofid, ssize_t _where, ssize_t show_much ) -- cgit v0.12 From 4069936ee48296216758a69cd5baccc04401c7b9 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 9 May 2018 08:44:45 -0500 Subject: Add missing module_dir property --- fortran/testpar/CMakeLists.txt | 1 + hl/fortran/examples/CMakeLists.txt | 1 + hl/fortran/test/CMakeLists.txt | 1 + 3 files changed, 3 insertions(+) diff --git a/fortran/testpar/CMakeLists.txt b/fortran/testpar/CMakeLists.txt index bfb2495..0fe641f 100644 --- a/fortran/testpar/CMakeLists.txt +++ b/fortran/testpar/CMakeLists.txt @@ -41,6 +41,7 @@ endif() set_target_properties (parallel_test PROPERTIES FOLDER test/fortran LINKER_LANGUAGE Fortran + Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static ) endif () diff --git a/hl/fortran/examples/CMakeLists.txt b/hl/fortran/examples/CMakeLists.txt index cc671f0..27971b2 100644 --- a/hl/fortran/examples/CMakeLists.txt +++ b/hl/fortran/examples/CMakeLists.txt @@ -32,6 +32,7 @@ foreach (example ${examples}) set_target_properties (hl_f90_ex_${example} PROPERTIES LINKER_LANGUAGE Fortran FOLDER examples/hl/fortran + Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static ) endforeach () diff --git a/hl/fortran/test/CMakeLists.txt b/hl/fortran/test/CMakeLists.txt index 0ee8d5b..6ee362d 100644 --- a/hl/fortran/test/CMakeLists.txt +++ b/hl/fortran/test/CMakeLists.txt @@ -37,6 +37,7 @@ macro (ADD_H5_FORTRAN_EXE file) set_target_properties (hl_f90_${file} PROPERTIES LINKER_LANGUAGE Fortran FOLDER test/hl/fortran + Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static ) if (BUILD_SHARED_LIBS) add_executable (hl_f90_${file}-shared ${file}.F90) -- cgit v0.12 From f1a668a3b5c8e35979f78e419ba76bee3cce78a9 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 9 May 2018 08:53:25 -0500 Subject: Correct COMPILE defs usage --- c++/src/CMakeLists.txt | 4 ++-- c++/test/CMakeLists.txt | 2 +- src/CMakeLists.txt | 10 +++++----- test/CMakeLists.txt | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/c++/src/CMakeLists.txt b/c++/src/CMakeLists.txt index 8226d16..cf7a8a5 100644 --- a/c++/src/CMakeLists.txt +++ b/c++/src/CMakeLists.txt @@ -88,7 +88,7 @@ target_include_directories(${HDF5_CPP_LIB_TARGET} INTERFACE "$/include>" ) target_compile_definitions(${HDF5_CPP_LIB_TARGET} - PRIVATE $<$:"-DMPICH_SKIP_MPICXX;-DMPICH_IGNORE_CXX_SEEK"># Parallel/MPI, prevent spurious cpp/cxx warnings + PRIVATE $<$:MPICH_SKIP_MPICXX;MPICH_IGNORE_CXX_SEEK># Parallel/MPI, prevent spurious cpp/cxx warnings ) TARGET_C_PROPERTIES (${HDF5_CPP_LIB_TARGET} STATIC) target_link_libraries (${HDF5_CPP_LIB_TARGET} PUBLIC ${HDF5_LIB_TARGET}) @@ -105,7 +105,7 @@ if (BUILD_SHARED_LIBS) ) target_compile_definitions(${HDF5_CPP_LIBSH_TARGET} PUBLIC "H5_BUILT_AS_DYNAMIC_LIB" - PRIVATE $<$:"-DMPICH_SKIP_MPICXX;-DMPICH_IGNORE_CXX_SEEK"># Parallel/MPI, prevent spurious cpp/cxx warnings + PRIVATE $<$:MPICH_SKIP_MPICXX;MPICH_IGNORE_CXX_SEEK># Parallel/MPI, prevent spurious cpp/cxx warnings ) TARGET_C_PROPERTIES (${HDF5_CPP_LIBSH_TARGET} SHARED) target_link_libraries (${HDF5_CPP_LIBSH_TARGET} PUBLIC ${HDF5_LIBSH_TARGET}) diff --git a/c++/test/CMakeLists.txt b/c++/test/CMakeLists.txt index 0815aa8..33849a9 100644 --- a/c++/test/CMakeLists.txt +++ b/c++/test/CMakeLists.txt @@ -40,7 +40,7 @@ configure_file (${HDF5_CPP_TEST_SOURCE_DIR}/H5srcdir_str.h.in H5srcdir_str.h @O add_executable (cpp_testhdf5 ${CPP_TEST_SOURCES} ) target_include_directories(cpp_testhdf5 PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR}") target_compile_definitions(cpp_testhdf5 - PRIVATE $<$:"-DMPICH_SKIP_MPICXX;-DMPICH_IGNORE_CXX_SEEK"># Parallel/MPI, prevent spurious cpp/cxx warnings + PRIVATE $<$:MPICH_SKIP_MPICXX;MPICH_IGNORE_CXX_SEEK># Parallel/MPI, prevent spurious cpp/cxx warnings ) TARGET_C_PROPERTIES (cpp_testhdf5 STATIC) target_link_libraries (cpp_testhdf5 PRIVATE diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 70e18a2..9ff70f9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -905,8 +905,8 @@ target_compile_definitions(${HDF5_LIB_TARGET} ${HDF_EXTRA_FLAGS} $,DEBUG,NDEBUG> PRIVATE - $<$:"H5_DEBUG_API"> # Enable tracing of the API - $<$:"H5Z_DEBUG;H5T_DEBUG;H5ST_DEBUG;H5S_DEBUG;H5O_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5F_DEBUG;H5D_DEBUG;H5B2_DEBUG;H5AC_DEBUG"> + $<$:H5_DEBUG_API> # Enable tracing of the API + $<$:H5Z_DEBUG;H5T_DEBUG;H5ST_DEBUG;H5S_DEBUG;H5O_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5F_DEBUG;H5D_DEBUG;H5B2_DEBUG;H5AC_DEBUG> ) TARGET_C_PROPERTIES (${HDF5_LIB_TARGET} STATIC) target_link_libraries (${HDF5_LIB_TARGET} @@ -948,9 +948,9 @@ if (BUILD_SHARED_LIBS) ${HDF_EXTRA_FLAGS} $,DEBUG,NDEBUG> PRIVATE - $<$:"H5_HAVE_THREADSAFE"> - $<$:"H5_DEBUG_API"> # Enable tracing of the API - $<$:"H5Z_DEBUG;H5T_DEBUG;H5ST_DEBUG;H5S_DEBUG;H5O_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5F_DEBUG;H5D_DEBUG;H5B2_DEBUG;H5AC_DEBUG"> + $<$:H5_HAVE_THREADSAFE> + $<$:H5_DEBUG_API> # Enable tracing of the API + $<$:H5Z_DEBUG;H5T_DEBUG;H5ST_DEBUG;H5S_DEBUG;H5O_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5F_DEBUG;H5D_DEBUG;H5B2_DEBUG;H5AC_DEBUG> ) TARGET_C_PROPERTIES (${HDF5_LIBSH_TARGET} SHARED) target_link_libraries (${HDF5_LIBSH_TARGET} diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 166fd99..8badf3c 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -45,7 +45,7 @@ if (BUILD_SHARED_LIBS) INTERFACE "$/include>" ) target_compile_definitions(${HDF5_TEST_LIBSH_TARGET} - PUBLIC "H5_BUILT_AS_DYNAMIC_LIB" $<$:"H5_HAVE_THREADSAFE"> + PUBLIC "H5_BUILT_AS_DYNAMIC_LIB" $<$:H5_HAVE_THREADSAFE> ) TARGET_C_PROPERTIES (${HDF5_TEST_LIBSH_TARGET} SHARED) target_link_libraries (${HDF5_TEST_LIBSH_TARGET} -- cgit v0.12 From d6ea76ac002cd8483ba8a6aaf55bbce5ed552937 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 9 May 2018 12:21:32 -0500 Subject: GGC requires attribute before function --- src/H5detect.c | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/H5detect.c b/src/H5detect.c index ff163cf..1c5554e 100644 --- a/src/H5detect.c +++ b/src/H5detect.c @@ -1360,8 +1360,8 @@ bit.\n"; * *------------------------------------------------------------------------- */ -static void -detect_C89_integers(void) HDF_NO_UBSAN +static void HDF_NO_UBSAN +detect_C89_integers(void) { DETECT_BYTE(signed char, SCHAR, d_g[nd_g]); nd_g++; DETECT_BYTE(unsigned char, UCHAR, d_g[nd_g]); nd_g++; @@ -1388,8 +1388,8 @@ detect_C89_integers(void) HDF_NO_UBSAN * *------------------------------------------------------------------------- */ -static void -detect_C89_floats(void) HDF_NO_UBSAN +static void HDF_NO_UBSAN +detect_C89_floats(void) { DETECT_F(float, FLOAT, d_g[nd_g]); nd_g++; DETECT_F(double, DOUBLE, d_g[nd_g]); nd_g++; @@ -1410,8 +1410,8 @@ detect_C89_floats(void) HDF_NO_UBSAN * *------------------------------------------------------------------------- */ -static void -detect_C99_integers8(void) HDF_NO_UBSAN +static void HDF_NO_UBSAN +detect_C99_integers8(void) { #if H5_SIZEOF_INT8_T>0 #if H5_SIZEOF_INT8_T==1 @@ -1472,8 +1472,8 @@ detect_C99_integers8(void) HDF_NO_UBSAN * *------------------------------------------------------------------------- */ -static void -detect_C99_integers16(void) HDF_NO_UBSAN +static void HDF_NO_UBSAN +detect_C99_integers16(void) { #if H5_SIZEOF_INT16_T>0 DETECT_I(int16_t, INT16, d_g[nd_g]); nd_g++; @@ -1510,8 +1510,8 @@ detect_C99_integers16(void) HDF_NO_UBSAN * *------------------------------------------------------------------------- */ -static void -detect_C99_integers32(void) HDF_NO_UBSAN +static void HDF_NO_UBSAN +detect_C99_integers32(void) { #if H5_SIZEOF_INT32_T>0 DETECT_I(int32_t, INT32, d_g[nd_g]); nd_g++; @@ -1548,8 +1548,8 @@ detect_C99_integers32(void) HDF_NO_UBSAN * *------------------------------------------------------------------------- */ -static void -detect_C99_integers64(void) HDF_NO_UBSAN +static void HDF_NO_UBSAN +detect_C99_integers64(void) { #if H5_SIZEOF_INT64_T>0 DETECT_I(int64_t, INT64, d_g[nd_g]); nd_g++; @@ -1599,8 +1599,8 @@ detect_C99_integers64(void) HDF_NO_UBSAN * *------------------------------------------------------------------------- */ -static void -detect_C99_integers(void) HDF_NO_UBSAN +static void HDF_NO_UBSAN +detect_C99_integers(void) { /* break it down to more subroutines so that each module subroutine */ /* is smaller and takes less time to compile with optimization on. */ @@ -1625,8 +1625,8 @@ detect_C99_integers(void) HDF_NO_UBSAN * *------------------------------------------------------------------------- */ -static void -detect_C99_floats(void) HDF_NO_UBSAN +static void HDF_NO_UBSAN +detect_C99_floats(void) { #if H5_SIZEOF_DOUBLE == H5_SIZEOF_LONG_DOUBLE /* @@ -1656,8 +1656,8 @@ detect_C99_floats(void) HDF_NO_UBSAN * *------------------------------------------------------------------------- */ -static void -detect_alignments(void) HDF_NO_UBSAN +static void HDF_NO_UBSAN +detect_alignments(void) { /* Detect structure alignment for pointers, hvl_t, hobj_ref_t, hdset_reg_ref_t */ DETECT_M(void *, POINTER, m_g[na_g]); na_g++; @@ -1744,8 +1744,8 @@ static int verify_signal_handlers(int signum, void (*handler)(int)) * *------------------------------------------------------------------------- */ -int -main(void) HDF_NO_UBSAN +int HDF_NO_UBSAN +main(void) { #if defined(H5_HAVE_SETSYSINFO) && defined(SSI_NVPAIRS) -- cgit v0.12