[CMake] Spurious test failure in CMakeTestFortranCompiler

Brad King brad.king at kitware.com
Mon Jul 1 11:20:01 EDT 2013


On 6/30/2013 11:10 PM, Neil Carlson wrote:
> Why is that module using CMake_Fortran_FLAGS at all?  Shouldn't it be
> invoking the bare compiler when it runs its tests?  Or am I misusing
> CMake_Fortran_FLAGS?  Should I be defining its value at a later stage in
> the cmake files?

The test for a working compiler is building a tiny project
using all the settings that will be used in the main project.
This checks up front that things are configured correctly for
the build you're trying to do rather than waiting for a build
failure much later.

CMAKE_Fortran_FLAGS could have flags affecting the target
architecture and such, so we need to use them for the test.

You can work around this by waiting until after the project()
or enable_language() command that loads Fortran support to
add the -u flag.  However, if we can modify the test code that
CMake uses to verify the toolchain so that it works with that
flag then we should do so.  How might the tiny project source
have to be modified to work?  Will it still be compatible with
F77 compilers?

-Brad


More information about the CMake mailing list