Brad King dc78838737 Fix FortranCInterface_VERIFY for non-C++ case
The verification program entry point (main) is defined in a C source
file, so the C compiler should be used to link when only Fortran and C
are involved.  The C++ compiler should still be used when the CXX option
is enabled.
2009-09-01 13:03:12 -04:00

22 lines
623 B
CMake

cmake_minimum_required(VERSION 2.7)
project(VerifyFortranC C Fortran)
option(VERIFY_CXX "Whether to verify C++ and Fortran" OFF)
if(VERIFY_CXX)
enable_language(CXX)
set(VerifyCXX VerifyCXX.cxx)
add_definitions(-DVERIFY_CXX)
endif()
include(FortranCInterface)
FortranCInterface_HEADER(VerifyFortran.h SYMBOLS VerifyFortran)
include_directories(${VerifyFortranC_BINARY_DIR})
add_executable(VerifyFortranC main.c VerifyC.c VerifyFortran.f ${VerifyCXX})
if(NOT VERIFY_CXX)
# The entry point (main) is defined in C; link with the C compiler.
set_property(TARGET VerifyFortranC PROPERTY LINKER_LANGUAGE C)
endif()