On 06/16/2015 01:21 AM, Ette, Anthony (CDS) wrote: > what control does the user have over the compilation of the test program?
Very little. The whole point is to test that the compiler works the way CMake will invoke it in the generated build system. > I.e. can I tell cmake to add -L (where to look for libraries) > or -v (cf77 compiler verbose flag) when compiling the test program to > avoid having to go to a full toolchain file and forcing the compiler? If you use CMake 3.2 or higher then you can try a test project like this: cmake_minimum_required(VERSION 3.2) project(cf77test Fortran) and run CMake as cmake . -DCMAKE_EXE_LINKER_FLAGS="-v" to get more verbose output from the link step. > I have found the -lrt is coming from /usr/lib/librt.so [snip] > If /usr/lib is in my path 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. > rts1-4:/home/bzpl46/test2> cf77 -v -g test.f > Linking executable: /usr/ccs/release/7.3/lib_ia32/ld ... -lrt ... One can see that cf77 indeed adds -lrt to the link line itself. So the question is: why does this work when invoked by hand but not when CMake invokes it? In the test project you sent in a sibling message, try this: $ cd CMakeFiles/CMakeTmp $ cat CMakeFiles/cmTryCompileExec4035725976.dir/link.txt /usr/ccs/bin/cf77 CMakeFiles/cmTryCompileExec4035725976.dir/testFortranCompiler.f.o -o cmTryCompileExec4035725976 -rdynamic Then run that command line by hand. You can add -v to it too. Note that the "4035725976" number will be different each time so adapt to your local build tree accordingly. -Brad -- 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