> Very little.  The whole point is to test that the compiler works the way 
> CMake will invoke it in the generated build system.

But the user does have tons of control over the generated build system so why 
can't he have same control have test program compilation?  I think in this case 
someone forcing cmake/ld to link in /usr/lib would solve the issue.  Or is it 
the case that user has pretty much same hooks for test program but only via 
command line since CMakeFiles.txt are not used (e.g. -DCMAKE_EXE_LINKER_FLAGS 
like you suggest below)?


 >cmake . -DCMAKE_EXE_LINKER_FLAGS="-v"
>to get more verbose output from the link step.

The command below does not turn cf77 verbose on during test program 
compilation...any other suggestions for this?
cmake . -DCMAKE_EXE_LINKER_FLAGS="-v" -G "Unix Makefiles"


> It shouldn't matter if /usr/lib is in your PATH.  The linker does not pay 
> attention to PATH.  Linkers normally look in /usr/lib by default.

So the linker determines where to look for libs for test program and cmake 
plays no part in this?  Seems surprising given that it works outside of cmake.


> So the question is: why does this work when invoked by hand but not when 
> CMake invokes it?

IDK this is bizarre.


> Then run that command line by hand.  You can add -v to it too.

Results are shown below.  Looks identical to the hello world.f outside of cmake 
so it's a mystery why -lrt can't be found.  Presumably the linker is not 
looking in /usr/lib when invoked by cmake, no?

rts1-4:/home/bzpl46/test2/CMakeFiles/CMakeTmp> /usr/ccs/bin/cf77 
CMakeFiles/cmTryCompileExec3453195864.dir/testFortranCompiler.f.o -o 
cmTryCompileExec3453195864 -rdynamic
/usr/ccs/release/7.3/lib_ia32/ld: cannot find -lrt
rts1-4:/home/bzpl46/test2/CMakeFiles/CMakeTmp> /usr/ccs/bin/cf77 -v 
CMakeFiles/cmTryCompileExec3453195864.dir/testFortranCompiler.f.o -o 
cmTryCompileExec3453195864 -rdynamic
environment: PDE_RELEASE = 7.3
environment: PDE_LINUX_RELEASE = i386-redhat-linux
environment: PDE_GCC_VERSION = 4.1.2
environment: PDE_CPU = pentium4
Linking executable: /usr/ccs/release/7.3/lib_ia32/ld -t -melf_i386 -u MAIN__ 
-dynamic-linker /lib/ld-linux.so.2 --allow-multiple-definition /usr/lib/crt1.o 
/usr/lib/crti.o /usr/lib/gcc/i386-redhat-linux/4.1.2/crtbeginT.o -v 
CMakeFiles/cmTryCompileExec3453195864.dir/testFortranCompiler.f.o -r 
-L/usr/ccs/release/7.3/lib_ia32 -L/usr/lib/gcc/i386-redhat-linux/4.1.2 -lhU77 
-lhF77 -lhI77 -lrt -lm -lgcc -lgcc_eh -lc -lgcc -lgcc_eh -o 
cmTryCompileExec3453195864 /usr/lib/gcc/i386-redhat-linux/4.1.2/crtend.o 
/usr/lib/crtn.o
GNU ld version 2.17.50.0.6-5.el5 20061020
/usr/ccs/release/7.3/lib_ia32/ld: mode elf_i386
/usr/lib/crt1.o
/usr/lib/crti.o
/usr/lib/gcc/i386-redhat-linux/4.1.2/crtbeginT.o
CMakeFiles/cmTryCompileExec3453195864.dir/testFortranCompiler.f.o
(/usr/ccs/release/7.3/lib_ia32/libhF77.a)main.o
(/usr/ccs/release/7.3/lib_ia32/libhF77.a)main2.o
(/usr/ccs/release/7.3/lib_ia32/libhF77.a)no_lg.o
(/usr/ccs/release/7.3/lib_ia32/libhF77.a)xarg.o
(/usr/ccs/release/7.3/lib_ia32/libhF77.a)fperoundset.o
(/usr/ccs/release/7.3/lib_ia32/libhF77.a)fpetrapset.o
(/usr/ccs/release/7.3/lib_ia32/libhI77.a)close.o
(/usr/ccs/release/7.3/lib_ia32/libhI77.a)err.o
(/usr/ccs/release/7.3/lib_ia32/libhI77.a)f_errlist.o
(/usr/ccs/release/7.3/lib_ia32/libhI77.a)hf77_io.o
(/usr/ccs/release/7.3/lib_ia32/libhI77.a)lwrite.o
(/usr/ccs/release/7.3/lib_ia32/libhI77.a)open.o
(/usr/ccs/release/7.3/lib_ia32/libhI77.a)util.o
(/usr/ccs/release/7.3/lib_ia32/libhI77.a)wrtfmt.o
(/usr/ccs/release/7.3/lib_ia32/libhI77.a)dofio.o
(/usr/ccs/release/7.3/lib_ia32/libhI77.a)dolio.o
(/usr/ccs/release/7.3/lib_ia32/libhI77.a)douio.o
(/usr/ccs/release/7.3/lib_ia32/libhI77.a)fmt.o
(/usr/ccs/release/7.3/lib_ia32/libhI77.a)fmtlib.o
(/usr/ccs/release/7.3/lib_ia32/libhI77.a)sue.o
/usr/ccs/release/7.3/lib_ia32/ld: cannot find -lrt

This e-mail (including attachments) contains contents owned by Rolls-Royce plc 
and its subsidiaries, affiliated companies or customers and covered by the laws 
of England and Wales, Brazil, US, or Canada (federal, state or provincial). The 
information contained in this email is intended to be confidential, may be 
legally privileged and subject to export controls which may restrict the access 
to and transfer of the information. If you are not the intended recipient, you 
are hereby notified that any retention, dissemination, distribution, 
interception or copying of this communication is strictly prohibited and may 
subject you to further legal action. Reply to the sender if you received this 
email by accident, and then delete the email and any attachments.
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to