summaryrefslogtreecommitdiffstats
path: root/fortran/src
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2018-04-26 21:41:04 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2018-04-26 21:41:04 (GMT)
commit2347bffaa2d48b62a22575fbc93b1f5c2716d8d4 (patch)
tree963395e7cd4bd66761194c8cee840906b16abb3a /fortran/src
parentbc9a773b994cde788e97e5e998eb5fcd21ec8a39 (diff)
downloadhdf5-2347bffaa2d48b62a22575fbc93b1f5c2716d8d4.zip
hdf5-2347bffaa2d48b62a22575fbc93b1f5c2716d8d4.tar.gz
hdf5-2347bffaa2d48b62a22575fbc93b1f5c2716d8d4.tar.bz2
TRILABS-19 remove add_defintions and use generator expressions
Diffstat (limited to 'fortran/src')
-rw-r--r--fortran/src/CMakeLists.txt89
1 files changed, 41 insertions, 48 deletions
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 "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/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 "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/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 "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/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 "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/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};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_Fortran_INCLUDE_DIRS}>"
+ INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
+)
+target_compile_definitions(${HDF5_F90_LIB_TARGET}
+ PRIVATE $<$<STREQUAL:"xx","MSVC">:"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} $<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${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 "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/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};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_Fortran_INCLUDE_DIRS}>"
+ INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
+ )
+ target_compile_definitions(${HDF5_F90_LIBSH_TARGET}
+ PUBLIC "H5_BUILT_AS_DYNAMIC_LIB"
+ PRIVATE $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"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} $<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_Fortran_LIBRARIES}>
+ INTERFACE $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"/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 "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/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 ()