I am trying to configure a Fortran 2008 project to use CMake; the files in the project have the ".f08" extension. However, I cannot get CMake to work even with a "hello world" example. Here are the relevant parts of my CMakeLists.txt file:
cmake_minimum_required(VERSION 2.8)
project (hello)
enable_language (Fortran)
set (CMAKE_Fortran_SOURCE_FILE_EXTENSIONS ${CMAKE_Fortran_SOURCE_FILE_EXTENSIONS} "f08;F08")
add_executable ("hello-world" "hello-world.f08")
set_target_properties (hello-world PROPERTIES LINKER_LANGUAGE Fortran)
Three notes:
- The Makefile generated does not compile "hello-world.f08" into an object file.
- The "set_target_properties" is needed. Otherwise, CMake reports that it "can not determine linker language for target:hello-world".
- Renaming the file to "hello-world.f95" along with the corresponding change in CMakeLists.txt makes things work. Even the "set_target_properties" command is no longer needed.