[CMake] FortranCInterface not working with 3.9.0 with Intel 2015

JR Cary cary at txcorp.com
Sat Dec 2 04:17:04 EST 2017


> Does it work with 3.10?
 
It works with no version from  3.9.0 - 3.10.0.

> Also, look in the CMakeFiles/CMakeError.log file to find out why this 
> happened: - Detecting Fortran/C Interface - Failed to compile.

Compiling the Fortran compiler identification source file "CMakeFortranCompilerId.F" failed.
Compiler: C:/Program Files (x86)/Intel/Composer XE 2015/bin/intel64/ifort.exe
Build flags:
Id flags: -v

The output was:
0
Intel(R) Visual Fortran Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 15.0.6.285 Build 20151119
Copyright (C) 1985-2015 Intel Corporation.  All rights reserved.
ifort: command line warning #10006: ignoring unknown option '/v'

CMakeFortranCompilerId.F(2): warning #5117: Bad # preprocessor line
#if 0
...

Looks from https://stackoverflow.com/questions/36557120/usual-causes-for-bad-preprocessor-warning
that the preprocessor is not being run.  It requires -fpp to be added to the Fortran compiler
flags.  I do not see how to do that for CMakeFortranCompilerId.F.  Tried 

  set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fpp")

but that did not help. 



On 11/26/17 4:29 PM, JR Cary wrote:
> Works with 3.8.2.
>
> Compilers specified by
>
> -DCMAKE_C_COMPILER:FILEPATH='C:/Program Files (x86)/Intel/Composer XE
> 2015/bin/intel64/icl.exe' -DCMAKE_CXX_COMPILER:FILEPATH='C:/Program
> Files (x86)/Intel/Composer XE 2015/bin/intel64/icl.exe'
> -DCMAKE_Fortran_COMPILER:FILEPATH='C:/Program Files (x86)/Intel/Composer
> XE 2015/bin/intel64/ifort.exe'
>
> The cmake code is
>
> include(FortranCInterface)
> FortranCInterface_HEADER(
>   ${CMAKE_BINARY_DIR}/FCMangle.h
>   MACRO_NAMESPACE "FC_"
>   SYMBOL_NAMESPACE "FC_"
>   SYMBOLS mysub mymod:my_sub
> )
>
> The relevant output is
>
> -- Detecting Fortran/C Interface
> -- Detecting Fortran/C Interface - Failed to compile
> CMake Warning (dev) at
> C:/winsame/cary/usim/contrib-icl15/cmake-3.9.0-ser/share/
> cmake-3.9/Modules/FortranCInterface.cmake:309 (message):
>   No FortranCInterface mangling known for mysub
> Call Stack (most recent call first):
>   scimake/SciFortranChecks.cmake:269 (FortranCInterface_HEADER)
>   scimake/SciInit.cmake:232 (include)
>   CMakeLists.txt:28 (include)
> This warning is for project developers.  Use -Wno-dev to suppress it.
>
> CMake Warning (dev) at
> C:/winsame/cary/usim/contrib-icl15/cmake-3.9.0-ser/share/
> cmake-3.9/Modules/FortranCInterface.cmake:295 (message):
>   No FortranCInterface mangling known for mymod:my_sub
> Call Stack (most recent call first):
>   scimake/SciFortranChecks.cmake:269 (FortranCInterface_HEADER)
>   scimake/SciInit.cmake:232 (include)
>   CMakeLists.txt:28 (include)
> This warning is for project developers.  Use -Wno-dev to suppress it.
>
> The resulting file is
>
> $ cat FCMangle.h
> #ifndef FC_HEADER_INCLUDED
> #define FC_HEADER_INCLUDED
>
> /*--------------------------------------------------------------------------*/
> /* Mangle some symbols
> automatically.                                       */
>
> #endif
>
> Any help appreciated..........John Cary
>
>
>
>



More information about the CMake mailing list