【发布时间】:2012-05-06 12:46:33
【问题描述】:
我在带有 Intel 11.0 编译器的 Linux 机器上使用 CMake 2.8.7。我第一次尝试使用 CMake,因为我想在 Windows 和 Linux 机器上构建这个项目。
我首先使用了一个简单的方法,并使用了一个标准的 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_FORTRAN_LINK_EXECUTABLE 变量。我查看了Abinader's CMake tutorial#1,但到目前为止还没有成功。
有什么建议吗??提前致谢!
【问题讨论】:
-
嗨!你找到答案了吗?我对 ifort 也有一些问题,但上下文不同:Windows。 ;-) 看来,CMake 对 Intel 的 Fortran 编译器的支持不是很好... :-(
标签: cmake fortran intel-fortran