[CMake] fortran compiler failed to compile simple test program

Brad King brad.king at kitware.com
Mon Jun 15 15:19:14 EDT 2015


On 06/15/2015 03:08 PM, Ette, Anthony (CDS) wrote:
>> Okay.  If -lrt is the default for the compiler why might "rt" not be found?
> say if one of my CMakeFiles.txt had "SET(CMAKE_CXX_LINK_FLAGS "-lrt")")
> or are my CMakeFiles.txt not considered as part of building a simple
> test program?

Some information is considered but not all.  Try a minimal CMakeLists.txt:

 cmake_minimum_required(VERSION ...)
 project(TestProject Fortran)

Does this enable Fortran correctly with cf77?  If so then you can start
stripping down your project to debug this.

> So, in order of appropriateness, is it:
>  1) fix simple test case

Yes.

> 2) use toolchain file, then
> 3) force compiler using CMakeForceCompiler?

Those go together.  CMakeForceCompiler must be used in a toolchain file.

>> Does building a simple test program by hand work?
> Yes this works no problem.
> I need to figure out how to turn on verbose to see if -lrt is being
> thrown or not (I suspect not)...

Okay.  One can see from the build log in the error message that CMake
is not adding -lrt itself so the compiler front-end must be choosing
to do it somehow.  What did you mean by "default for the compiler"
if it is not adding -lrt by default?

Thanks,
-Brad



More information about the CMake mailing list