summaryrefslogtreecommitdiffstats
path: root/fortran
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2015-03-30 17:32:55 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2015-03-30 17:32:55 (GMT)
commitc923afdf50173d8fd80d252375eb01f3eb8fdf8e (patch)
treeed93d0ead945d4f5c5115e76134639ba7ba11865 /fortran
parent6a664ffa5aba85eb2d35526fa9d41a5b69f7f21d (diff)
downloadhdf5-c923afdf50173d8fd80d252375eb01f3eb8fdf8e.zip
hdf5-c923afdf50173d8fd80d252375eb01f3eb8fdf8e.tar.gz
hdf5-c923afdf50173d8fd80d252375eb01f3eb8fdf8e.tar.bz2
[svn-r26654] Bring trunk CMake changes to branch.
Tested: local linux
Diffstat (limited to 'fortran')
-rw-r--r--fortran/examples/CMakeLists.txt8
-rw-r--r--fortran/src/CMakeLists.txt139
-rw-r--r--fortran/test/CMakeLists.txt44
-rw-r--r--fortran/testpar/CMakeLists.txt3
4 files changed, 86 insertions, 108 deletions
diff --git a/fortran/examples/CMakeLists.txt b/fortran/examples/CMakeLists.txt
index de384ee..81dff6e 100644
--- a/fortran/examples/CMakeLists.txt
+++ b/fortran/examples/CMakeLists.txt
@@ -90,8 +90,12 @@ if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND)
${HDF5_LIB_TARGET}
${MPI_Fortran_LIBRARIES}
)
- set_target_properties (f90_ex_ph5example PROPERTIES LINKER_LANGUAGE Fortran)
- set_target_properties (f90_ex_ph5example PROPERTIES FOLDER examples/fortran)
+ target_include_directories (f90_ex_ph5example PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/static)
+ set_target_properties (f90_ex_ph5example PROPERTIES
+ LINKER_LANGUAGE Fortran
+ FOLDER examples/fortran
+ Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}
+ )
endif (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND)
if (BUILD_TESTING)
diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt
index 8d186c3..c015072 100644
--- a/fortran/src/CMakeLists.txt
+++ b/fortran/src/CMakeLists.txt
@@ -54,7 +54,10 @@ if (WIN32 AND MSVC)
LINK_FLAGS "/SUBSYSTEM:CONSOLE"
)
endif (WIN32 AND MSVC)
-set_target_properties (H5test_FortranHavekind PROPERTIES LINKER_LANGUAGE Fortran)
+set_target_properties (H5test_FortranHavekind PROPERTIES
+ LINKER_LANGUAGE Fortran
+ Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}
+)
set (CMD $<TARGET_FILE:H5test_FortranHavekind>)
add_custom_command (
@@ -248,7 +251,6 @@ if (WIN32)
)
endif (WIN32)
TARGET_FORTRAN_PROPERTIES (${HDF5_F90_LIB_TARGET} ${LIB_TYPE} " " ${SHARED_LINK_FLAGS})
-set_target_properties (${HDF5_F90_LIB_TARGET} PROPERTIES LINKER_LANGUAGE Fortran)
target_link_libraries (${HDF5_F90_LIB_TARGET} ${HDF5_F90_C_LIB_TARGET} ${HDF5_LIB_TARGET})
if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND)
target_link_libraries (${HDF5_F90_LIB_TARGET} ${MPI_Fortran_LIBRARIES})
@@ -259,6 +261,7 @@ set_target_properties (${HDF5_F90_LIB_TARGET} PROPERTIES
FOLDER libraries/fortran
LINKER_LANGUAGE Fortran
INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
+ Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}
)
#-----------------------------------------------------------------------------
@@ -278,100 +281,50 @@ install (
)
if (WIN32)
- install (
- FILES
- ${CMAKE_Fortran_MODULE_DIRECTORY}/\${BUILD_TYPE}/h5fortran_types.mod
- ${CMAKE_Fortran_MODULE_DIRECTORY}/\${BUILD_TYPE}/hdf5.mod
- ${CMAKE_Fortran_MODULE_DIRECTORY}/\${BUILD_TYPE}/h5global.mod
- ${CMAKE_Fortran_MODULE_DIRECTORY}/\${BUILD_TYPE}/h5a.mod
- ${CMAKE_Fortran_MODULE_DIRECTORY}/\${BUILD_TYPE}/h5d.mod
- ${CMAKE_Fortran_MODULE_DIRECTORY}/\${BUILD_TYPE}/h5e.mod
- ${CMAKE_Fortran_MODULE_DIRECTORY}/\${BUILD_TYPE}/h5f.mod
- ${CMAKE_Fortran_MODULE_DIRECTORY}/\${BUILD_TYPE}/h5g.mod
- ${CMAKE_Fortran_MODULE_DIRECTORY}/\${BUILD_TYPE}/h5i.mod
- ${CMAKE_Fortran_MODULE_DIRECTORY}/\${BUILD_TYPE}/h5l.mod
- ${CMAKE_Fortran_MODULE_DIRECTORY}/\${BUILD_TYPE}/h5lib.mod
- ${CMAKE_Fortran_MODULE_DIRECTORY}/\${BUILD_TYPE}/h5o.mod
- ${CMAKE_Fortran_MODULE_DIRECTORY}/\${BUILD_TYPE}/h5p.mod
- ${CMAKE_Fortran_MODULE_DIRECTORY}/\${BUILD_TYPE}/h5r.mod
- ${CMAKE_Fortran_MODULE_DIRECTORY}/\${BUILD_TYPE}/h5s.mod
- ${CMAKE_Fortran_MODULE_DIRECTORY}/\${BUILD_TYPE}/h5t.mod
- ${CMAKE_Fortran_MODULE_DIRECTORY}/\${BUILD_TYPE}/h5z.mod
- ${CMAKE_Fortran_MODULE_DIRECTORY}/\${BUILD_TYPE}/h5a_provisional.mod
- ${CMAKE_Fortran_MODULE_DIRECTORY}/\${BUILD_TYPE}/h5d_provisional.mod
- ${CMAKE_Fortran_MODULE_DIRECTORY}/\${BUILD_TYPE}/h5e_provisional.mod
- ${CMAKE_Fortran_MODULE_DIRECTORY}/\${BUILD_TYPE}/h5f_provisional.mod
- ${CMAKE_Fortran_MODULE_DIRECTORY}/\${BUILD_TYPE}/h5l_provisional.mod
- ${CMAKE_Fortran_MODULE_DIRECTORY}/\${BUILD_TYPE}/h5lib_provisional.mod
- ${CMAKE_Fortran_MODULE_DIRECTORY}/\${BUILD_TYPE}/h5o_provisional.mod
- ${CMAKE_Fortran_MODULE_DIRECTORY}/\${BUILD_TYPE}/h5p_provisional.mod
- ${CMAKE_Fortran_MODULE_DIRECTORY}/\${BUILD_TYPE}/h5r_provisional.mod
- ${CMAKE_Fortran_MODULE_DIRECTORY}/\${BUILD_TYPE}/h5t_provisional.mod
- ${CMAKE_Fortran_MODULE_DIRECTORY}/\${BUILD_TYPE}/h5_dble_interface.mod
- DESTINATION
- ${HDF5_INSTALL_INCLUDE_DIR}
- COMPONENT
- fortheaders
- )
- if (H5_TEST_KIND_NAME)
- install (
- FILES
- ${CMAKE_Fortran_MODULE_DIRECTORY}/\${BUILD_TYPE}/${H5_TEST_KIND_NAME}.mod
- DESTINATION
- ${HDF5_INSTALL_INCLUDE_DIR}
- COMPONENT
- fortheaders
- )
- endif (H5_TEST_KIND_NAME)
+ set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/\${BUILD_TYPE})
else (WIN32)
- install (
- FILES
- ${CMAKE_Fortran_MODULE_DIRECTORY}/h5fortran_types.mod
- ${CMAKE_Fortran_MODULE_DIRECTORY}/hdf5.mod
- ${CMAKE_Fortran_MODULE_DIRECTORY}/h5global.mod
- ${CMAKE_Fortran_MODULE_DIRECTORY}/h5f.mod
- ${CMAKE_Fortran_MODULE_DIRECTORY}/h5a.mod
- ${CMAKE_Fortran_MODULE_DIRECTORY}/h5d.mod
- ${CMAKE_Fortran_MODULE_DIRECTORY}/h5e.mod
- ${CMAKE_Fortran_MODULE_DIRECTORY}/h5f.mod
- ${CMAKE_Fortran_MODULE_DIRECTORY}/h5g.mod
- ${CMAKE_Fortran_MODULE_DIRECTORY}/h5i.mod
- ${CMAKE_Fortran_MODULE_DIRECTORY}/h5l.mod
- ${CMAKE_Fortran_MODULE_DIRECTORY}/h5lib.mod
- ${CMAKE_Fortran_MODULE_DIRECTORY}/h5o.mod
- ${CMAKE_Fortran_MODULE_DIRECTORY}/h5p.mod
- ${CMAKE_Fortran_MODULE_DIRECTORY}/h5r.mod
- ${CMAKE_Fortran_MODULE_DIRECTORY}/h5s.mod
- ${CMAKE_Fortran_MODULE_DIRECTORY}/h5t.mod
- ${CMAKE_Fortran_MODULE_DIRECTORY}/h5z.mod
- ${CMAKE_Fortran_MODULE_DIRECTORY}/h5a_provisional.mod
- ${CMAKE_Fortran_MODULE_DIRECTORY}/h5d_provisional.mod
- ${CMAKE_Fortran_MODULE_DIRECTORY}/h5e_provisional.mod
- ${CMAKE_Fortran_MODULE_DIRECTORY}/h5f_provisional.mod
- ${CMAKE_Fortran_MODULE_DIRECTORY}/h5l_provisional.mod
- ${CMAKE_Fortran_MODULE_DIRECTORY}/h5lib_provisional.mod
- ${CMAKE_Fortran_MODULE_DIRECTORY}/h5o_provisional.mod
- ${CMAKE_Fortran_MODULE_DIRECTORY}/h5p_provisional.mod
- ${CMAKE_Fortran_MODULE_DIRECTORY}/h5r_provisional.mod
- ${CMAKE_Fortran_MODULE_DIRECTORY}/h5t_provisional.mod
- ${CMAKE_Fortran_MODULE_DIRECTORY}/h5_dble_interface.mod
- DESTINATION
- ${HDF5_INSTALL_INCLUDE_DIR}
- COMPONENT
- fortheaders
- )
- if (H5_TEST_KIND_NAME)
- install (
- FILES
- ${CMAKE_Fortran_MODULE_DIRECTORY}/${H5_TEST_KIND_NAME}.mod
- DESTINATION
- ${HDF5_INSTALL_INCLUDE_DIR}
- COMPONENT
- fortheaders
- )
- endif (H5_TEST_KIND_NAME)
+ set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY})
endif (WIN32)
+set (mod_files
+ ${MOD_BUILD_DIR}/h5fortran_types.mod
+ ${MOD_BUILD_DIR}/hdf5.mod
+ ${MOD_BUILD_DIR}/h5global.mod
+ ${MOD_BUILD_DIR}/h5a.mod
+ ${MOD_BUILD_DIR}/h5d.mod
+ ${MOD_BUILD_DIR}/h5e.mod
+ ${MOD_BUILD_DIR}/h5f.mod
+ ${MOD_BUILD_DIR}/h5g.mod
+ ${MOD_BUILD_DIR}/h5i.mod
+ ${MOD_BUILD_DIR}/h5l.mod
+ ${MOD_BUILD_DIR}/h5lib.mod
+ ${MOD_BUILD_DIR}/h5o.mod
+ ${MOD_BUILD_DIR}/h5p.mod
+ ${MOD_BUILD_DIR}/h5r.mod
+ ${MOD_BUILD_DIR}/h5s.mod
+ ${MOD_BUILD_DIR}/h5t.mod
+ ${MOD_BUILD_DIR}/h5z.mod
+ ${MOD_BUILD_DIR}/h5a_provisional.mod
+ ${MOD_BUILD_DIR}/h5d_provisional.mod
+ ${MOD_BUILD_DIR}/h5e_provisional.mod
+ ${MOD_BUILD_DIR}/h5f_provisional.mod
+ ${MOD_BUILD_DIR}/h5l_provisional.mod
+ ${MOD_BUILD_DIR}/h5lib_provisional.mod
+ ${MOD_BUILD_DIR}/h5o_provisional.mod
+ ${MOD_BUILD_DIR}/h5p_provisional.mod
+ ${MOD_BUILD_DIR}/h5r_provisional.mod
+ ${MOD_BUILD_DIR}/h5t_provisional.mod
+ ${MOD_BUILD_DIR}/h5_dble_interface.mod
+)
+install (
+ FILES
+ ${mod_files}
+ DESTINATION
+ ${HDF5_INSTALL_INCLUDE_DIR}
+ COMPONENT
+ fortheaders
+)
+
#-----------------------------------------------------------------------------
# Add Target(s) to CMake Install for import into other projects
#-----------------------------------------------------------------------------
diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt
index c24041b..2893156 100644
--- a/fortran/test/CMakeLists.txt
+++ b/fortran/test/CMakeLists.txt
@@ -4,7 +4,7 @@ PROJECT (HDF5_FORTRAN_TESTS C CXX Fortran)
#-----------------------------------------------------------------------------
# Setup include Directories
#-----------------------------------------------------------------------------
-INCLUDE_DIRECTORIES (${CMAKE_Fortran_MODULE_DIRECTORY} ${HDF5_F90_BINARY_DIR} ${HDF5_F90_SRC_DIR}/src)
+INCLUDE_DIRECTORIES (${HDF5_F90_BINARY_DIR} ${HDF5_F90_SRC_DIR}/src)
#-----------------------------------------------------------------------------
# Add Test Lib
@@ -47,7 +47,6 @@ if (WIN32)
set_property (TARGET ${HDF5_F90_TEST_LIB_TARGET} APPEND PROPERTY COMPILE_DEFINITIONS HDF5F90_WINDOWS)
endif (WIN32)
TARGET_FORTRAN_PROPERTIES (${HDF5_F90_TEST_LIB_TARGET} ${LIB_TYPE} " " ${SHARED_LINK_FLAGS})
-set_target_properties (${HDF5_F90_TEST_LIB_TARGET} PROPERTIES LINKER_LANGUAGE Fortran)
target_link_libraries (${HDF5_F90_TEST_LIB_TARGET}
${HDF5_F90_C_TEST_LIB_TARGET}
${HDF5_F90_LIB_TARGET}
@@ -58,6 +57,7 @@ set_target_properties (${HDF5_F90_TEST_LIB_TARGET} PROPERTIES
FOLDER libraries/test/fortran
LINKER_LANGUAGE Fortran
INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
+ Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}
)
#-----------------------------------------------------------------------------
@@ -92,8 +92,12 @@ target_link_libraries (testhdf5_fortran
if (WIN32 AND MSVC)
target_link_libraries (testhdf5_fortran "ws2_32.lib")
endif (WIN32 AND MSVC)
-set_target_properties (testhdf5_fortran PROPERTIES LINKER_LANGUAGE Fortran)
-set_target_properties (testhdf5_fortran PROPERTIES FOLDER test/fortran)
+target_include_directories (testhdf5_fortran PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/static)
+set_target_properties (testhdf5_fortran PROPERTIES
+ LINKER_LANGUAGE Fortran
+ FOLDER test/fortran
+ Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}
+)
#-- Adding test for testhdf5_fortran_1_8
add_executable (testhdf5_fortran_1_8
@@ -114,8 +118,12 @@ target_link_libraries (testhdf5_fortran_1_8
if (WIN32 AND MSVC)
target_link_libraries (testhdf5_fortran_1_8 "ws2_32.lib")
endif (WIN32 AND MSVC)
-set_target_properties (testhdf5_fortran_1_8 PROPERTIES LINKER_LANGUAGE Fortran)
-set_target_properties (testhdf5_fortran_1_8 PROPERTIES FOLDER test/fortran)
+target_include_directories (testhdf5_fortran_1_8 PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/static)
+set_target_properties (testhdf5_fortran_1_8 PROPERTIES
+ LINKER_LANGUAGE Fortran
+ FOLDER test/fortran
+ Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}
+)
#-- Adding test for fortranlib_test_F03
if (HDF5_ENABLE_F2003)
@@ -139,8 +147,12 @@ if (HDF5_ENABLE_F2003)
if (WIN32 AND MSVC)
target_link_libraries (fortranlib_test_F03 "ws2_32.lib")
endif (WIN32 AND MSVC)
- set_target_properties (fortranlib_test_F03 PROPERTIES LINKER_LANGUAGE Fortran)
- set_target_properties (fortranlib_test_F03 PROPERTIES FOLDER test/fortran)
+ target_include_directories (fortranlib_test_F03 PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/static)
+ set_target_properties (fortranlib_test_F03 PROPERTIES
+ LINKER_LANGUAGE Fortran
+ FOLDER test/fortran
+ Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}
+ )
endif (HDF5_ENABLE_F2003)
#-- Adding test for fflush1
@@ -155,8 +167,12 @@ target_link_libraries (fflush1
if (WIN32 AND MSVC)
target_link_libraries (fflush1 "ws2_32.lib")
endif (WIN32 AND MSVC)
-set_target_properties (fflush1 PROPERTIES LINKER_LANGUAGE Fortran)
-set_target_properties (fflush1 PROPERTIES FOLDER test/fortran)
+target_include_directories (fflush1 PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/static)
+set_target_properties (fflush1 PROPERTIES
+ LINKER_LANGUAGE Fortran
+ FOLDER test/fortran
+ Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}
+)
#-- Adding test for fflush2
add_executable (fflush2 fflush2.f90)
@@ -170,7 +186,11 @@ target_link_libraries (fflush2
if (WIN32 AND MSVC)
target_link_libraries (fflush2 "ws2_32.lib")
endif (WIN32 AND MSVC)
-set_target_properties (fflush2 PROPERTIES LINKER_LANGUAGE Fortran)
-set_target_properties (fflush2 PROPERTIES FOLDER test/fortran)
+target_include_directories (fflush2 PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/static)
+set_target_properties (fflush2 PROPERTIES
+ LINKER_LANGUAGE Fortran
+ FOLDER test/fortran
+ Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}
+)
include (CMakeTests.cmake)
diff --git a/fortran/testpar/CMakeLists.txt b/fortran/testpar/CMakeLists.txt
index d24ef23..98ef6c8 100644
--- a/fortran/testpar/CMakeLists.txt
+++ b/fortran/testpar/CMakeLists.txt
@@ -4,7 +4,7 @@ PROJECT (HDF5_FORTRAN_TESTPAR C CXX Fortran)
#-----------------------------------------------------------------------------
# Setup include Directories
#-----------------------------------------------------------------------------
-INCLUDE_DIRECTORIES (${CMAKE_Fortran_MODULE_DIRECTORY} ${HDF5_F90_BINARY_DIR} ${HDF5_F90_SRC_DIR}/src)
+INCLUDE_DIRECTORIES (${HDF5_F90_BINARY_DIR} ${HDF5_F90_SRC_DIR}/src)
#-----------------------------------------------------------------------------
# Add Tests
@@ -27,6 +27,7 @@ target_link_libraries (parallel_test
if (WIN32 AND MSVC)
target_link_libraries (parallel_test "ws2_32.lib")
endif (WIN32 AND MSVC)
+target_include_directories (parallel_test PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY})
set_target_properties (parallel_test PROPERTIES LINKER_LANGUAGE Fortran)
set_target_properties (parallel_test PROPERTIES FOLDER test/fortran)