From 17f5ee36247d6a73f8b92318c9fa0a03381ea1e7 Mon Sep 17 00:00:00 2001 From: Scot Breitenfeld Date: Tue, 1 Sep 2015 09:00:14 -0500 Subject: [svn-r27647] Added compiler check for PGI and CMake version. CMake must be > v3.3 to compile with PGI due to CMake bug in earlier versions. --- CMakeLists.txt | 13 +++++++++++++ fortran/test/fortranlib_test.F90 | 2 ++ 2 files changed, 15 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index cd3e1c9..0c1556e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,19 @@ cmake_minimum_required (VERSION 3.1.0) PROJECT (HDF5 C CXX) +if (HDF5_BUILD_FORTRAN) + include (${CMAKE_ROOT}/Modules/CMakeDetermineFortranCompiler.cmake) + if (${CMAKE_Fortran_COMPILER_ID}) + enable_language(Fortran) + endif () + +# Building with PGI requires CMake 3.3 or greater because previous versions +# of CMake add the wrong compiler flag for the PGI Fortran compiler. + if ("${CMAKE_Fortran_COMPILER_ID}" MATCHES "PGI" AND "${CMAKE_VERSION}" VERSION_LESS "3.3") + message (FATAL_ERROR " **** PGI FORTRAN REQUIRES CMAKE VERSION 3.3 OR GREATER **** ") + endif () +endif () + #----------------------------------------------------------------------------- # Instructions for use : Normal Build # diff --git a/fortran/test/fortranlib_test.F90 b/fortran/test/fortranlib_test.F90 index c3e995b..2f88c45 100644 --- a/fortran/test/fortranlib_test.F90 +++ b/fortran/test/fortranlib_test.F90 @@ -24,6 +24,8 @@ ! !***** +!#include + PROGRAM fortranlibtest USE HDF5 -- cgit v0.12