diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2014-03-26 15:00:35 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2014-03-26 15:00:35 (GMT) |
commit | d9020f2e35342605b26b6260e05cc4a2cef2327b (patch) | |
tree | 344bb1fde0fd8def1e2228abadc7e64b605e11dc /hl/fortran | |
parent | 3944dcb308de2d380822d2d56cf0d3bd96db5c8f (diff) | |
download | hdf5-d9020f2e35342605b26b6260e05cc4a2cef2327b.zip hdf5-d9020f2e35342605b26b6260e05cc4a2cef2327b.tar.gz hdf5-d9020f2e35342605b26b6260e05cc4a2cef2327b.tar.bz2 |
[svn-r24906] Merge latest CMake changes from trunk.
Tested: local linux
Diffstat (limited to 'hl/fortran')
-rw-r--r-- | hl/fortran/CMakeLists.txt | 16 | ||||
-rw-r--r-- | hl/fortran/examples/CMakeLists.txt | 22 | ||||
-rw-r--r-- | hl/fortran/examples/CMakeTests.cmake | 6 | ||||
-rw-r--r-- | hl/fortran/src/CMakeLists.txt | 94 | ||||
-rw-r--r-- | hl/fortran/test/CMakeLists.txt | 36 | ||||
-rw-r--r-- | hl/fortran/test/CMakeTests.cmake | 10 |
6 files changed, 98 insertions, 86 deletions
diff --git a/hl/fortran/CMakeLists.txt b/hl/fortran/CMakeLists.txt index 0da0825..c26d94c 100644 --- a/hl/fortran/CMakeLists.txt +++ b/hl/fortran/CMakeLists.txt @@ -1,21 +1,21 @@ -cmake_minimum_required (VERSION 2.8.10) +cmake_minimum_required (VERSION 2.8.11) PROJECT (HDF5_HL_F90 C CXX Fortran) #----------------------------------------------------------------------------- # List Source files #----------------------------------------------------------------------------- -ADD_SUBDIRECTORY (${HDF5_HL_F90_SOURCE_DIR}/src ${HDF5_HL_F90_BINARY_DIR}/src) +add_subdirectory (${HDF5_HL_F90_SOURCE_DIR}/src ${HDF5_HL_F90_BINARY_DIR}/src) #----------------------------------------------------------------------------- # Build the HL Fortran Examples #----------------------------------------------------------------------------- -IF (HDF5_BUILD_FORTRAN_EXAMPLES) - ADD_SUBDIRECTORY (${HDF5_HL_F90_SOURCE_DIR}/examples ${HDF5_HL_F90_BINARY_DIR}/examples) -ENDIF (HDF5_BUILD_FORTRAN_EXAMPLES) +if (HDF5_BUILD_FORTRAN_EXAMPLES) + add_subdirectory (${HDF5_HL_F90_SOURCE_DIR}/examples ${HDF5_HL_F90_BINARY_DIR}/examples) +endif (HDF5_BUILD_FORTRAN_EXAMPLES) #----------------------------------------------------------------------------- # Testing #----------------------------------------------------------------------------- -IF (BUILD_TESTING) - ADD_SUBDIRECTORY (${HDF5_HL_F90_SOURCE_DIR}/test ${HDF5_HL_F90_BINARY_DIR}/test) -ENDIF (BUILD_TESTING) +if (BUILD_TESTING) + add_subdirectory (${HDF5_HL_F90_SOURCE_DIR}/test ${HDF5_HL_F90_BINARY_DIR}/test) +endif (BUILD_TESTING) diff --git a/hl/fortran/examples/CMakeLists.txt b/hl/fortran/examples/CMakeLists.txt index 0f663c7..12467b8 100644 --- a/hl/fortran/examples/CMakeLists.txt +++ b/hl/fortran/examples/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.10) +cmake_minimum_required (VERSION 2.8.11) PROJECT (HDF5_HL_F90_EXAMPLES C CXX Fortran) #----------------------------------------------------------------------------- @@ -10,27 +10,27 @@ INCLUDE_DIRECTORIES ( ${HDF5_F90_SRC_DIR}/src ) -SET (examples +set (examples exlite ex_ds1 ) -FOREACH (example ${examples}) - ADD_EXECUTABLE (hl_f90_ex_${example} ${HDF5_HL_F90_EXAMPLES_SOURCE_DIR}/${example}.f90) +foreach (example ${examples}) + add_executable (hl_f90_ex_${example} ${HDF5_HL_F90_EXAMPLES_SOURCE_DIR}/${example}.f90) TARGET_NAMING (hl_f90_ex_${example} ${LIB_TYPE}) TARGET_FORTRAN_PROPERTIES (hl_f90_ex_${example} " " " ") - TARGET_LINK_LIBRARIES (hl_f90_ex_${example} + target_link_libraries (hl_f90_ex_${example} ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} ) - SET_TARGET_PROPERTIES (hl_f90_ex_${example} PROPERTIES LINKER_LANGUAGE Fortran) - SET_TARGET_PROPERTIES (hl_f90_ex_${example} PROPERTIES FOLDER examples/hl/fortran) + set_target_properties (hl_f90_ex_${example} PROPERTIES LINKER_LANGUAGE Fortran) + set_target_properties (hl_f90_ex_${example} PROPERTIES FOLDER examples/hl/fortran) -ENDFOREACH (example ${examples}) +endforeach (example ${examples}) -IF (BUILD_TESTING) +if (BUILD_TESTING) - INCLUDE (CMakeTests.cmake) + include (CMakeTests.cmake) -ENDIF (BUILD_TESTING) +endif (BUILD_TESTING) diff --git a/hl/fortran/examples/CMakeTests.cmake b/hl/fortran/examples/CMakeTests.cmake index 7e6c348..1784041 100644 --- a/hl/fortran/examples/CMakeTests.cmake +++ b/hl/fortran/examples/CMakeTests.cmake @@ -5,6 +5,6 @@ ############################################################################## ############################################################################## -FOREACH (example ${examples}) - ADD_TEST (NAME hl_f90_ex_${example} COMMAND $<TARGET_FILE:hl_f90_ex_${example}>) -ENDFOREACH (example ${examples}) +foreach (example ${examples}) + add_test (NAME hl_f90_ex_${example} COMMAND $<TARGET_FILE:hl_f90_ex_${example}>) +endforeach (example ${examples}) diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt index 0a8bd35..a95873b 100644 --- a/hl/fortran/src/CMakeLists.txt +++ b/hl/fortran/src/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.10) +cmake_minimum_required (VERSION 2.8.11) PROJECT(HDF5_HL_F90_SRC C CXX Fortran) #----------------------------------------------------------------------------- @@ -14,94 +14,106 @@ INCLUDE_DIRECTORIES ( #----------------------------------------------------------------------------- # hl_f90CStub lib #----------------------------------------------------------------------------- -SET (HDF5_HL_F90_C_SRCS +set (HDF5_HL_F90_C_SRCS ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5DSfc.c ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5LTfc.c ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5IMfc.c ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5IMcc.c ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5TBfc.c ) -SET_SOURCE_FILES_PROPERTIES (${HDF5_HL_F90_C_SRCS} PROPERTIES LANGUAGE C) +set_source_files_properties (${HDF5_HL_F90_C_SRCS} PROPERTIES LANGUAGE C) -SET (HDF5_HL_F90_HEADERS ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5LTf90proto.h) +set (HDF5_HL_F90_HEADERS ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5LTf90proto.h) -ADD_LIBRARY (${HDF5_HL_F90_C_LIB_TARGET} ${LIB_TYPE} ${HDF5_HL_F90_C_SRCS} ${HDF5_HL_F90_HEADERS}) +add_library (${HDF5_HL_F90_C_LIB_TARGET} ${LIB_TYPE} ${HDF5_HL_F90_C_SRCS} ${HDF5_HL_F90_HEADERS}) TARGET_C_PROPERTIES (${HDF5_HL_F90_C_LIB_TARGET} " " " ") -TARGET_LINK_LIBRARIES (${HDF5_HL_F90_C_LIB_TARGET} ${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}") +target_link_libraries (${HDF5_HL_F90_C_LIB_TARGET} ${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} ${LIB_TYPE}) -SET_TARGET_PROPERTIES (${HDF5_HL_F90_C_LIB_TARGET} PROPERTIES FOLDER libraries/hl/fortran) -SET_TARGET_PROPERTIES (${HDF5_HL_F90_C_LIB_TARGET} PROPERTIES LINKER_LANGUAGE C) +set_target_properties (${HDF5_HL_F90_C_LIB_TARGET} PROPERTIES + FOLDER libraries/hl/fortran + LINKER_LANGUAGE C + INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" +) #----------------------------------------------------------------------------- # Fortran Modules #----------------------------------------------------------------------------- -SET (HDF5_HL_F90_F_SRCS +set (HDF5_HL_F90_F_SRCS ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5DSff.f90 ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5TBff.f90 ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5LTff.f90 ${HDF5_HL_F90_SRC_SOURCE_DIR}/H5IMff.f90 ) -ADD_LIBRARY (${HDF5_HL_F90_LIB_TARGET} ${LIB_TYPE} ${HDF5_HL_F90_F_SRCS}) -SET (SHARED_LINK_FLAGS " ") -IF (BUILD_SHARED_LIBS) - IF (WIN32 AND NOT CYGWIN) - SET_PROPERTY (TARGET ${HDF5_HL_F90_LIB_TARGET} +add_library (${HDF5_HL_F90_LIB_TARGET} ${LIB_TYPE} ${HDF5_HL_F90_F_SRCS}) +set (SHARED_LINK_FLAGS " ") +if (BUILD_SHARED_LIBS) + if (WIN32 AND NOT CYGWIN) + set_property (TARGET ${HDF5_HL_F90_LIB_TARGET} APPEND PROPERTY COMPILE_DEFINITIONS BUILD_HDF5_DLL ) - IF (MSVC) - SET (SHARED_LINK_FLAGS "/DLL") - ENDIF (MSVC) - ENDIF (WIN32 AND NOT CYGWIN) -ENDIF (BUILD_SHARED_LIBS) -IF (WIN32 AND NOT CYGWIN) - SET_PROPERTY (TARGET ${HDF5_HL_F90_LIB_TARGET} + if (MSVC) + set (SHARED_LINK_FLAGS "/DLL") + endif (MSVC) + endif (WIN32 AND NOT CYGWIN) +endif (BUILD_SHARED_LIBS) +if (WIN32 AND NOT CYGWIN) + set_property (TARGET ${HDF5_HL_F90_LIB_TARGET} APPEND PROPERTY COMPILE_DEFINITIONS HDF5F90_WINDOWS ) -ENDIF (WIN32 AND NOT CYGWIN) +endif (WIN32 AND NOT CYGWIN) TARGET_FORTRAN_PROPERTIES (${HDF5_HL_F90_LIB_TARGET} " " ${SHARED_LINK_FLAGS}) -SET_TARGET_PROPERTIES (${HDF5_HL_F90_LIB_TARGET} PROPERTIES LINKER_LANGUAGE Fortran) -TARGET_LINK_LIBRARIES (${HDF5_HL_F90_LIB_TARGET} ${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}") +set_target_properties (${HDF5_HL_F90_LIB_TARGET} PROPERTIES LINKER_LANGUAGE Fortran) +target_link_libraries (${HDF5_HL_F90_LIB_TARGET} ${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} ${LIB_TYPE}) -SET_TARGET_PROPERTIES (${HDF5_HL_F90_LIB_TARGET} PROPERTIES FOLDER libraries/hl/fortran) +set_target_properties (${HDF5_HL_F90_LIB_TARGET} PROPERTIES + FOLDER libraries/hl/fortran + INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>" +) #----------------------------------------------------------------------------- # Add file(s) to CMake Install #----------------------------------------------------------------------------- -IF (WIN32 AND NOT CYGWIN) - INSTALL ( - DIRECTORY - ${CMAKE_Fortran_MODULE_DIRECTORY}/\${BUILD_TYPE}/ +if (WIN32 AND NOT CYGWIN) + install ( + FILES + ${CMAKE_Fortran_MODULE_DIRECTORY}/\${BUILD_TYPE}/h5ds.mod + ${CMAKE_Fortran_MODULE_DIRECTORY}/\${BUILD_TYPE}/h5tb.mod + ${CMAKE_Fortran_MODULE_DIRECTORY}/\${BUILD_TYPE}/h5lt.mod + ${CMAKE_Fortran_MODULE_DIRECTORY}/\${BUILD_TYPE}/h5im.mod DESTINATION ${HDF5_INSTALL_INCLUDE_DIR} COMPONENT fortheaders ) -ELSE (WIN32 AND NOT CYGWIN) - INSTALL ( - DIRECTORY - ${CMAKE_Fortran_MODULE_DIRECTORY}/ +else (WIN32 AND NOT CYGWIN) + install ( + FILES + ${CMAKE_Fortran_MODULE_DIRECTORY}/h5ds.mod + ${CMAKE_Fortran_MODULE_DIRECTORY}/h5tb.mod + ${CMAKE_Fortran_MODULE_DIRECTORY}/h5lt.mod + ${CMAKE_Fortran_MODULE_DIRECTORY}/h5im.mod DESTINATION ${HDF5_INSTALL_INCLUDE_DIR} COMPONENT fortheaders ) -ENDIF (WIN32 AND NOT CYGWIN) +endif (WIN32 AND NOT CYGWIN) #----------------------------------------------------------------------------- # Add Target(s) to CMake Install for import into other projects #----------------------------------------------------------------------------- -IF (HDF5_EXPORTED_TARGETS) - IF (BUILD_SHARED_LIBS) +if (HDF5_EXPORTED_TARGETS) + if (BUILD_SHARED_LIBS) INSTALL_TARGET_PDB (${HDF5_HL_F90_C_LIB_TARGET} ${HDF5_INSTALL_LIB_DIR} hlfortlibraries) #INSTALL_TARGET_PDB (${HDF5_HL_F90_LIB_TARGET} ${HDF5_INSTALL_LIB_DIR} hlfortlibraries) - ENDIF (BUILD_SHARED_LIBS) + endif (BUILD_SHARED_LIBS) - INSTALL ( + install ( TARGETS ${HDF5_HL_F90_C_LIB_TARGET} ${HDF5_HL_F90_LIB_TARGET} @@ -111,4 +123,4 @@ IF (HDF5_EXPORTED_TARGETS) ARCHIVE DESTINATION ${HDF5_INSTALL_LIB_DIR} COMPONENT hlfortlibraries RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT hlfortlibraries ) -ENDIF (HDF5_EXPORTED_TARGETS) +endif (HDF5_EXPORTED_TARGETS) diff --git a/hl/fortran/test/CMakeLists.txt b/hl/fortran/test/CMakeLists.txt index 2084162..120d6a5 100644 --- a/hl/fortran/test/CMakeLists.txt +++ b/hl/fortran/test/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.10) +cmake_minimum_required (VERSION 2.8.11) PROJECT (HDF5_HL_FORTRAN_TESTS C CXX Fortran) #----------------------------------------------------------------------------- @@ -7,35 +7,35 @@ PROJECT (HDF5_HL_FORTRAN_TESTS C CXX Fortran) INCLUDE_DIRECTORIES (${CMAKE_Fortran_MODULE_DIRECTORY} ${HDF5_F90_BINARY_DIR} ${HDF5_F90_SRC_DIR}/src) #-- Adding test for hl_f90_tstds -ADD_EXECUTABLE (hl_f90_tstds tstds.f90) +add_executable (hl_f90_tstds tstds.f90) TARGET_NAMING (hl_f90_tstds ${LIB_TYPE}) TARGET_FORTRAN_PROPERTIES (hl_f90_tstds " " " ") -TARGET_LINK_LIBRARIES (hl_f90_tstds ${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_link_libraries (hl_f90_tstds ${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) #-- Adding test for hl_f90_tstlite -ADD_EXECUTABLE (hl_f90_tstlite tstlite.f90) +add_executable (hl_f90_tstlite tstlite.f90) TARGET_NAMING (hl_f90_tstlite ${LIB_TYPE}) TARGET_FORTRAN_PROPERTIES (hl_f90_tstlite " " " ") -TARGET_LINK_LIBRARIES (hl_f90_tstlite ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET}) -SET_TARGET_PROPERTIES (hl_f90_tstlite PROPERTIES LINKER_LANGUAGE Fortran) -SET_TARGET_PROPERTIES (hl_f90_tstlite PROPERTIES FOLDER test/hl/fortran) +target_link_libraries (hl_f90_tstlite ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET}) +set_target_properties (hl_f90_tstlite PROPERTIES LINKER_LANGUAGE Fortran) +set_target_properties (hl_f90_tstlite PROPERTIES FOLDER test/hl/fortran) #-- Adding test for hl_f90_tstimage -ADD_EXECUTABLE (hl_f90_tstimage tstimage.f90) +add_executable (hl_f90_tstimage tstimage.f90) TARGET_NAMING (hl_f90_tstimage ${LIB_TYPE}) TARGET_FORTRAN_PROPERTIES (hl_f90_tstimage " " " ") -TARGET_LINK_LIBRARIES (hl_f90_tstimage ${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_link_libraries (hl_f90_tstimage ${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) #-- Adding test for hl_f90_tsttable -ADD_EXECUTABLE (hl_f90_tsttable tsttable.f90) +add_executable (hl_f90_tsttable tsttable.f90) TARGET_NAMING (hl_f90_tsttable ${LIB_TYPE}) TARGET_FORTRAN_PROPERTIES (hl_f90_tsttable " " " ") -TARGET_LINK_LIBRARIES (hl_f90_tsttable ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET}) -SET_TARGET_PROPERTIES (hl_f90_tsttable PROPERTIES LINKER_LANGUAGE Fortran) -SET_TARGET_PROPERTIES (hl_f90_tsttable PROPERTIES FOLDER test/hl/fortran) +target_link_libraries (hl_f90_tsttable ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET}) +set_target_properties (hl_f90_tsttable PROPERTIES LINKER_LANGUAGE Fortran) +set_target_properties (hl_f90_tsttable PROPERTIES FOLDER test/hl/fortran) -INCLUDE (CMakeTests.cmake) +include (CMakeTests.cmake) diff --git a/hl/fortran/test/CMakeTests.cmake b/hl/fortran/test/CMakeTests.cmake index 81253bd..94bb385 100644 --- a/hl/fortran/test/CMakeTests.cmake +++ b/hl/fortran/test/CMakeTests.cmake @@ -6,7 +6,7 @@ ############################################################################## # Remove any output file left over from previous test run -ADD_TEST ( +add_test ( NAME hl_fortran_test-clear-objects COMMAND ${CMAKE_COMMAND} -E remove @@ -20,10 +20,10 @@ ADD_TEST ( tstds.h5 ) -ADD_TEST (NAME hl_f90_tstds COMMAND $<TARGET_FILE:hl_f90_tstds>) +add_test (NAME hl_f90_tstds COMMAND $<TARGET_FILE:hl_f90_tstds>) -ADD_TEST (NAME hl_f90_tstlite COMMAND $<TARGET_FILE:hl_f90_tstlite>) +add_test (NAME hl_f90_tstlite COMMAND $<TARGET_FILE:hl_f90_tstlite>) -ADD_TEST (NAME hl_f90_tstimage COMMAND $<TARGET_FILE:hl_f90_tstimage>) +add_test (NAME hl_f90_tstimage COMMAND $<TARGET_FILE:hl_f90_tstimage>) -ADD_TEST (NAME hl_f90_tsttable COMMAND $<TARGET_FILE:hl_f90_tsttable>) +add_test (NAME hl_f90_tsttable COMMAND $<TARGET_FILE:hl_f90_tsttable>) |