我在配备Intel 11.0编译器的Linux机器上使用CMake 2.8.7。我想第一次使用CMake,因为我想在Windows和Linux机器上构建这个项目。在ifort编译器中使用CMake
我先用一个简单的方法,但并使用标准的Hello World示例: 我的src/HelloWorld.f90:
!Test helloworld in Fortran using Cmake
program hello
print *, "Hello World!"
end program hello
我主要的CMakeLists.txt:
# States that CMake required version must be greater than 2.8.7
cmake_minimum_required(VERSION 2.8.7)
enable_language (Fortran)
project(helloworld Fortran)
add_subdirectory(src)
SET_TARGET_PROPERTIES(helloworld PROPERTIES LINKER_LANGUAGE FORTRAN)
我SRC /CMakeLists.txt:
cmake_minimum_required(VERSION 2.8.7)
# Include the directory itself as a path to include directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# For a large number of source files you can create it in a simpler way
# using file() function:
file(GLOB helloworld_SOURCES *.f90)
我仍然收到一个错误,说CMAKE_FOR缺少TRAN_LINK_EXECUTABLE变量。我看了Abinader's CMake tutorial#1,但到目前为止还没有成功。
有什么建议?提前致谢 !
嗨!你找到了答案吗?我也有一些与ifort有关的问题,但是使用不同的上下文:Windows。 ;-)看来,CMake对英特尔Fortran编译器的支持并不是那么好... :-( – 2012-07-22 19:56:14