diff --git a/cmake/hdf5.cmake b/cmake/hdf5.cmake index 527f0ddb..c9c59902 100644 --- a/cmake/hdf5.cmake +++ b/cmake/hdf5.cmake @@ -82,6 +82,8 @@ message(STATUS "HDF5 library: ${HDF5_LIBRARIES}") set(CMAKE_REQUIRED_INCLUDES ${HDF5_INCLUDE_DIRS}) set(CMAKE_REQUIRED_LIBRARIES ${HDF5_LIBRARIES}) +set(ENV{BINDIR} ${CMAKE_CURRENT_BINARY_DIR}) + include(CheckFortranSourceCompiles) file(READ ${CMAKE_CURRENT_SOURCE_DIR}/src/tests/test_minimal.f90 _code) check_fortran_source_compiles(${_code} HDF5_compiles_ok SRC_EXT f90) diff --git a/src/tests/test_minimal.f90 b/src/tests/test_minimal.f90 index a4d2bf85..5beb754d 100644 --- a/src/tests/test_minimal.f90 +++ b/src/tests/test_minimal.f90 @@ -12,7 +12,9 @@ program test_minimal integer :: i,l call get_command_argument(1, argv, length=l, status=i) -if (i /= 0 .or. l == 0) error stop 'specify path' +if (i /= 0 .or. l == 0) call get_environment_variable("BINDIR", argv, length=l, status=i) +if (i /= 0 .or. l == 0) argv = '.' + filename = trim(argv) // '/junk_minimal.h5' print *, 'test path: ', filename