From a1f1e501434560d092fc897825e213273e448648 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Mon, 3 Nov 2008 12:15:59 -0500 Subject: [PATCH] ENH: only allow matching fortran a c compilers to be used --- Tests/Fortran/CMakeLists.txt | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Tests/Fortran/CMakeLists.txt b/Tests/Fortran/CMakeLists.txt index e70b2f10a..7169ce604 100644 --- a/Tests/Fortran/CMakeLists.txt +++ b/Tests/Fortran/CMakeLists.txt @@ -1,5 +1,6 @@ cmake_minimum_required (VERSION 2.6) PROJECT(testf C Fortran) +message("CTEST_FULL_OUTPUT ") SET(CMAKE_VERBOSE_MAKEFILE 1) MESSAGE("ENV_FLAGS = $ENV{FFLAGS}") MESSAGE("CMAKE_Fortran_COMPILER_INIT = ${CMAKE_Fortran_COMPILER_INIT}") @@ -29,9 +30,17 @@ set(FORTRAN_FUNCTIONS ${FORTRAN_FUNCTIONS} my_sub mysub ) set(srcs ${srcs} mysub.f foo.c) create_fortran_c_interface("F_" FORTRAN_FUNCTIONS "${testf_BINARY_DIR}/foo.h") include_directories("${testf_BINARY_DIR}") -add_executable(foo ${srcs}) + +if("${CMAKE_Fortran_COMPILER_ID}" MATCHES "${CMAKE_C_COMPILER_ID}" ) + message("Fortran = ${CMAKE_Fortran_COMPILER_ID}") + message("C = ${CMAKE_C_COMPILER_ID}") + add_executable(foo ${srcs}) +else() + message("Fortran does not match c compiler") + message("Fortran = ${CMAKE_Fortran_COMPILER_ID}") + message("C = ${CMAKE_C_COMPILER_ID}") +endif() # print out some stuff to help debug on machines via cdash -message("CTEST_FULL_OUTPUT ") file(READ "${testf_BINARY_DIR}/foo.h" fooh) message("foo.h contents:\n${fooh}")