[CMake-Promote] Does cmake support fortran lang with F extension?

谢歆 xiexinyls at gmail.com
Sat Jan 3 09:55:54 EST 2009


hi,

I decide to use cmake for an old FORTAN program what consists a lot of
F extension source code and wrote a simple CMakelists.txt.
Hoever, the default setting did not seem to support F extension.

My cmakelists.txt is as follows:

cmake_minimum_required(VERSION 2.6)
project(testukmo)

include_directories(ukmorad/headers)
link_directories(ukmorad)

enable_language(Fortran)
#target_link_libraries(testukmo ukmoradlib)
add_executable(testukmo
  main.F
)

#enable_language(Fortran)
add_library(ukmoradlib STATIC ${ukmorad_SRCS})

set(ukmorad_SRCS
  ${ukmorad_ses_setup_SRCS}
  ${ukmorad_common_SRCS}
  ${ukmorad_ses_flux_calc_SRCS}
)

set(ukmorad_ses_setup_SRCS
  ses_setup/ses_t_level.F
  ses_setup/ses_inter_pt.F
  ses_setup/ses_qsat_gill.F
  ses_setup/ses_calc_density.F
  ses_setup/ses_cld_point.F
  ses_setup/ses_volc_interp.F
  ses_setup/ses_ovlap_mix_max.F
...
... more fortran code with F extension.
...
)

---------------------------------------------------------------------------------------------

And when I cmake, I got this error information:

-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- The Fortran compiler identification is Intel
-- Check for working Fortran compiler: /opt/intel/fc/10.1.018/bin/ifort
-- Check for working Fortran compiler: /opt/intel/fc/10.1.018/bin/ifort -- works
-- Checking whether /opt/intel/fc/10.1.018/bin/ifort supports Fortran 90
-- Checking whether /opt/intel/fc/10.1.018/bin/ifort supports Fortran 90 -- yes
You have called ADD_LIBRARY for library ukmoradlib without any source
files. This typically indicates a problem with your CMakeLists.txt
file
-- Configuring done
CMake Error in CMakeLists.txt:
  Cannot find source file "main.F".  Tried extensions .c .C .c++ .cc .cpp
  .cxx .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx


CMake Error: Cannot determine link language for target "testukmo".
CMake Error: Cannot determine link language for target "ukmoradlib".
-- Generating done
-- Build files have been written to: /home/xiexin/modeltest/testukmo


I have both Intel and PGI compilers in my computer. Cmake did find
intel compiler. But my question is how I can change the
cmake setting so that I can use PGI compiler?

Can anyone give a solution? Thank you very much!


Xie Xin


More information about the CMake-Promote mailing list