ENH: only allow matching fortran a c compilers to be used
This commit is contained in:
parent
093e5157a9
commit
a1f1e50143
|
@ -1,5 +1,6 @@
|
||||||
cmake_minimum_required (VERSION 2.6)
|
cmake_minimum_required (VERSION 2.6)
|
||||||
PROJECT(testf C Fortran)
|
PROJECT(testf C Fortran)
|
||||||
|
message("CTEST_FULL_OUTPUT ")
|
||||||
SET(CMAKE_VERBOSE_MAKEFILE 1)
|
SET(CMAKE_VERBOSE_MAKEFILE 1)
|
||||||
MESSAGE("ENV_FLAGS = $ENV{FFLAGS}")
|
MESSAGE("ENV_FLAGS = $ENV{FFLAGS}")
|
||||||
MESSAGE("CMAKE_Fortran_COMPILER_INIT = ${CMAKE_Fortran_COMPILER_INIT}")
|
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)
|
set(srcs ${srcs} mysub.f foo.c)
|
||||||
create_fortran_c_interface("F_" FORTRAN_FUNCTIONS "${testf_BINARY_DIR}/foo.h")
|
create_fortran_c_interface("F_" FORTRAN_FUNCTIONS "${testf_BINARY_DIR}/foo.h")
|
||||||
include_directories("${testf_BINARY_DIR}")
|
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
|
# print out some stuff to help debug on machines via cdash
|
||||||
message("CTEST_FULL_OUTPUT ")
|
|
||||||
file(READ "${testf_BINARY_DIR}/foo.h" fooh)
|
file(READ "${testf_BINARY_DIR}/foo.h" fooh)
|
||||||
message("foo.h contents:\n${fooh}")
|
message("foo.h contents:\n${fooh}")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue