summaryrefslogtreecommitdiffstats
path: root/fortran
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2018-04-17 20:57:51 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2018-04-17 20:57:58 (GMT)
commit46f2a2a432c4077d94c4a3f2126ee0694fd9f0af (patch)
tree9538508039dd7f4aaa488c8bf81f8d3ae2c28727 /fortran
parent61a2456995e17ca542bbbc67fb07f8d44a38da93 (diff)
downloadhdf5-46f2a2a432c4077d94c4a3f2126ee0694fd9f0af.zip
hdf5-46f2a2a432c4077d94c4a3f2126ee0694fd9f0af.tar.gz
hdf5-46f2a2a432c4077d94c4a3f2126ee0694fd9f0af.tar.bz2
TRILABS-19 Initial conversion of include_directories to targets
Diffstat (limited to 'fortran')
-rw-r--r--fortran/examples/CMakeLists.txt3
-rw-r--r--fortran/src/CMakeLists.txt15
-rw-r--r--fortran/test/CMakeLists.txt19
3 files changed, 20 insertions, 17 deletions
diff --git a/fortran/examples/CMakeLists.txt b/fortran/examples/CMakeLists.txt
index 8b7333a..fd98944 100644
--- a/fortran/examples/CMakeLists.txt
+++ b/fortran/examples/CMakeLists.txt
@@ -8,7 +8,8 @@ PROJECT (HDF5_F90_EXAMPLES C CXX Fortran)
#-----------------------------------------------------------------------------
# Setup include Directories
#-----------------------------------------------------------------------------
-INCLUDE_DIRECTORIES (${HDF5_F90_BINARY_DIR} ${HDF5_F90_SRC_DIR}/src)
+
+set_directory_properties(PROPERTIES INCLUDE_DIRECTORIES "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_F90_BINARY_DIR} ${HDF5_F90_SRC_DIR}/src")
#-----------------------------------------------------------------------------
# Define Sources
diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt
index 03c12ac..4efd5fb 100644
--- a/fortran/src/CMakeLists.txt
+++ b/fortran/src/CMakeLists.txt
@@ -32,7 +32,7 @@ if (HAVE_FLOAT128)
set (CMAKE_H5_HAVE_FLOAT128 1)
endif ()
-configure_file (${HDF5_F90_SRC_SOURCE_DIR}/H5config_f.inc.cmake ${CMAKE_BINARY_DIR}/H5config_f.inc @ONLY)
+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)
set (Fortran_COMPILER_ID CMAKE_Fortran_COMPILER_ID)
@@ -46,7 +46,7 @@ set (Fortran_COMPILER_ID CMAKE_Fortran_COMPILER_ID)
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 (WIN32 AND MSVC)
if (BUILD_SHARED_LIBS)
set_target_properties (H5_buildiface
@@ -71,13 +71,12 @@ endif ()
file (MAKE_DIRECTORY "${HDF5_F90_BINARY_DIR}/static")
set (MOD_BUILD_DIR ${CMAKE_Fortran_MODULE_DIRECTORY}/static/${HDF_CFG_BUILD_TYPE})
-INCLUDE_DIRECTORIES (${HDF5_F90_SOURCE_DIR} ${HDF5_F90_BINARY_DIR} ${CMAKE_Fortran_MODULE_DIRECTORY})
-
#-----------------------------------------------------------------------------
add_executable (H5match_types
${HDF5_F90_BINARY_DIR}/H5fort_type_defines.h
${HDF5_F90_SRC_SOURCE_DIR}/H5match_types.c
)
+target_include_directories(H5match_types PRIVATE "${HDF5_BINARY_DIR};${HDF5_SRC_DIR};${HDF5_F90_BINARY_DIR}")
add_custom_command (
OUTPUT ${HDF5_F90_BINARY_DIR}/static/H5f90i_gen.h
${HDF5_F90_BINARY_DIR}/static/H5fortran_types.F90
@@ -132,7 +131,7 @@ set (f90CStub_C_SHHDRS
)
add_library (${HDF5_F90_C_LIB_TARGET} STATIC ${f90CStub_C_SOURCES} ${f90CStub_C_HDRS})
-target_include_directories(${HDF5_F90_C_LIB_TARGET} PUBLIC ${HDF5_F90_BINARY_DIR}/static)
+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_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}")
@@ -146,7 +145,7 @@ 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})
- target_include_directories(${HDF5_F90_C_LIBSH_TARGET} PUBLIC ${HDF5_F90_BINARY_DIR}/shared)
+ 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_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}")
@@ -250,7 +249,7 @@ 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 ${CMAKE_Fortran_MODULE_DIRECTORY}/static)
+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 ()
@@ -279,7 +278,7 @@ if (BUILD_SHARED_LIBS)
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 ${CMAKE_Fortran_MODULE_DIRECTORY}/shared)
+ 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 ()
diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt
index a5f5464..345f642 100644
--- a/fortran/test/CMakeLists.txt
+++ b/fortran/test/CMakeLists.txt
@@ -2,11 +2,6 @@ cmake_minimum_required (VERSION 3.10)
PROJECT (HDF5_FORTRAN_TESTS C CXX Fortran)
#-----------------------------------------------------------------------------
-# Setup include Directories
-#-----------------------------------------------------------------------------
-INCLUDE_DIRECTORIES (${CMAKE_Fortran_MODULE_DIRECTORY} ${HDF5_FORTRAN_TESTS_SOURCE_DIR} ${HDF5_F90_BINARY_DIR} ${HDF5_F90_SRC_DIR}/src)
-
-#-----------------------------------------------------------------------------
# Setup the Fortran auto-detection utilities
# H5_test_buildiface.F90 used to generate various KIND test interfaces
#-----------------------------------------------------------------------------
@@ -14,7 +9,7 @@ INCLUDE_DIRECTORIES (${CMAKE_Fortran_MODULE_DIRECTORY} ${HDF5_FORTRAN_TESTS_SOUR
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
@@ -44,7 +39,7 @@ 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)
-target_include_directories(${HDF5_F90_C_TEST_LIB_TARGET} PUBLIC ${HDF5_F90_BINARY_DIR}/static)
+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}
${HDF5_F90_C_LIB_TARGET}
@@ -58,7 +53,7 @@ set_target_properties (${HDF5_F90_C_TEST_LIB_TARGET} PROPERTIES
)
if (BUILD_SHARED_LIBS)
add_library (${HDF5_F90_C_TEST_LIBSH_TARGET} SHARED t.c)
- target_include_directories(${HDF5_F90_C_TEST_LIBSH_TARGET} PUBLIC ${HDF5_F90_BINARY_DIR}/shared)
+ 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}
${HDF5_F90_C_LIBSH_TARGET}
@@ -128,6 +123,7 @@ target_link_libraries (${HDF5_F90_TEST_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
@@ -155,6 +151,7 @@ if (BUILD_SHARED_LIBS)
)
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
@@ -203,6 +200,7 @@ 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
@@ -238,6 +236,7 @@ if (BUILD_SHARED_LIBS)
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
@@ -265,6 +264,7 @@ 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
@@ -291,6 +291,7 @@ if (BUILD_SHARED_LIBS)
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
@@ -320,6 +321,7 @@ 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
@@ -349,6 +351,7 @@ if (BUILD_SHARED_LIBS)
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