Dear cmake users, For some Fortran compiler we need to remove flags we added to CMAKE_Fortran_FLAGS_RELEASE to be able to link (options not recognized at link).
Do you have any idea of how to do so ? A practical case is the xlf90 -cpp flag. I have several .f90 files that need preprocessing so I require -cpp -qsuffix=cpp=f90 at compile time but it is not supported at link time. If I use : FFLAGS="-g -cpp -qxlf2003=POLYmorphic -qsuffix=cpp=f90 -qextname -qdirective='IBM*' -qport=typlssarg" I get an error when CMake tries to build a fortran file with XLF : -- Check for working Fortran compiler: /opt/ibm/xlf/15.1.5/bin/xlf90_r -- Check for working Fortran compiler: /opt/ibm/xlf/15.1.5/bin/xlf90_r -- broken CMake Error at /usr/share/cmake/Modules/CMakeTestFortranCompiler.cmake:54 (message): The Fortran compiler "/opt/ibm/xlf/15.1.5/bin/xlf90_r" is not able to compile a simple test program. It fails with the following output: Change Dir: /home/lacoste/sabl/build/ppc64le_LinuxRH7.3_xlfCommunity_spectrummpi10.1.0/CMakeFiles/CMakeTmp Run Build Command:/usr/bin/gmake "cmTryCompileExec3078717336/fast" gmake[1]: Entering directory `/home/lacoste/sabl/build/ppc64le_LinuxRH7.3_xlfCommunity_spectrummpi10.1.0/CMakeFiles/CMakeTmp' /usr/bin/gmake -f CMakeFiles/cmTryCompileExec3078717336.dir/build.make CMakeFiles/cmTryCompileExec3078717336.dir/build gmake[2]: Entering directory `/home/lacoste/sabl/build/ppc64le_LinuxRH7.3_xlfCommunity_spectrummpi10.1.0/CMakeFiles/CMakeTmp' /usr/bin/cmake -E cmake_progress_report /home/lacoste/sabl/build/ppc64le_LinuxRH7.3_xlfCommunity_spectrummpi10.1.0/CMakeFiles/CMakeTmp/CMakeFiles 1 Building Fortran object CMakeFiles/cmTryCompileExec3078717336.dir/testFortranCompiler.f.o /opt/ibm/xlf/15.1.5/bin/xlf90_r -g -cpp -qxlf2003=POLYmorphic -qsuffix=cpp=f90 -qextname -qdirective='IBM*' -qport=typlssarg -c /home/lacoste/sabl/build/ppc64le_LinuxRH7.3_xlfCommunity_spectrummpi10.1.0/CMakeFiles/CMakeTmp/testFortranCompiler.f -o CMakeFiles/cmTryCompileExec3078717336.dir/testFortranCompiler.f.o ** testfortran === End of Compilation 1 === 1501-510 Compilation successful for file testFortranCompiler.f. Linking Fortran executable cmTryCompileExec3078717336 /usr/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec3078717336.dir/link.txt --verbose=1 /opt/ibm/xlf/15.1.5/bin/xlf90_r -g -cpp -qxlf2003=POLYmorphic -qsuffix=cpp=f90 -qextname -qdirective='IBM*' -qport=typlssarg CMakeFiles/cmTryCompileExec3078717336.dir/testFortranCompiler.f.o -o cmTryCompileExec3078717336 /opt/ibm/xlf/15.1.5/bin/.orig/xlf90_r: 1501-294 (S) No input file specified. Please use -qhelp for more information. gmake[2]: *** [cmTryCompileExec3078717336] Error 249 gmake[2]: Leaving directory `/home/lacoste/sabl/build/ppc64le_LinuxRH7.3_xlfCommunity_spectrummpi10.1.0/CMakeFiles/CMakeTmp' gmake[1]: *** [cmTryCompileExec3078717336/fast] Error 2 gmake[1]: Leaving directory `/home/lacoste/sabl/build/ppc64le_LinuxRH7.3_xlfCommunity_spectrummpi10.1.0/CMakeFiles/CMakeTmp' This is due to the preprocessing flags given at link time. I could solve it by renaming all my .f90 into .F90 files but, with cray compiler, I have an other issue that also need to separate link and compile flags. Regards, Xavier LACOSTE
-- 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