diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2019-06-18 12:46:25 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2019-06-18 12:46:25 (GMT) |
commit | e7f16c6f2c7b031d7e9b4ba22a9fcdad4d258360 (patch) | |
tree | 18f277bcdb333d7091c598c39b70e4a2e3b50cd0 /hl/fortran/examples | |
parent | f73a190d2c2e2bfe80508599e0d76d62c358ae68 (diff) | |
download | hdf5-e7f16c6f2c7b031d7e9b4ba22a9fcdad4d258360.zip hdf5-e7f16c6f2c7b031d7e9b4ba22a9fcdad4d258360.tar.gz hdf5-e7f16c6f2c7b031d7e9b4ba22a9fcdad4d258360.tar.bz2 |
HDFFV-10805 Add option to only build shared targets
HDFFV-10805 Add ONLY_SHARED_LIBS option and prefer shared over static
HDFFV-10803 Update FindSZIP.cmake find module
Remove unneeded modules and update java modules
Diffstat (limited to 'hl/fortran/examples')
-rw-r--r-- | hl/fortran/examples/CMakeLists.txt | 42 |
1 files changed, 29 insertions, 13 deletions
diff --git a/hl/fortran/examples/CMakeLists.txt b/hl/fortran/examples/CMakeLists.txt index 27971b2..e41b8fe 100644 --- a/hl/fortran/examples/CMakeLists.txt +++ b/hl/fortran/examples/CMakeLists.txt @@ -8,18 +8,10 @@ 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_compile_options(hl_f90_ex_${example} PRIVATE $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:${WIN_COMPILE_FLAGS}> ) - target_link_libraries (hl_f90_ex_${example} - PRIVATE - ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET} ${HDF5_LIB_TARGET} - ) # set_property(TARGET hl_f90_ex_${example} APPEND PROPERTY # LINK_FLAGS $<$<STREQUAL:"x${CMAKE_Fortran_SIMULATE_ID}","xMSVC">:"-SUBSYSTEM:CONSOLE"> # ) @@ -29,11 +21,35 @@ foreach (example ${examples}) if(MSVC) 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 - FOLDER examples/hl/fortran - Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static - ) + if (NOT BUILD_SHARED_LIBS) + target_include_directories (hl_f90_ex_${example} + PRIVATE + "${CMAKE_Fortran_MODULE_DIRECTORY}/static;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src" + ) + 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 + Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/static + ) + else () + target_include_directories (hl_f90_ex_${example} + PRIVATE + "${CMAKE_Fortran_MODULE_DIRECTORY}/shared;${HDF5_F90_BINARY_DIR};${HDF5_F90_SRC_DIR}/src" + ) + target_link_libraries (hl_f90_ex_${example} + PRIVATE + ${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} + ) + set_target_properties (hl_f90_ex_${example} PROPERTIES + LINKER_LANGUAGE Fortran + FOLDER examples/hl/fortran + Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/shared + ) + endif () endforeach () if (BUILD_TESTING) |