我正在尝试使用cmake-gui创建一个makefile来将fortran和python链接在一起。在配置和生成makefile时,Everthing工作正常。但是在我获得了库并尝试在python中使用它之后。原来问题是:
Traceback (most recent call last):
File "startDEMO.py", line 2, in <module>
import libdemo
ImportError: libifport.so.5: cannot open shared object file: No such file or directory
我是cmake的新手,请带上我的cmakelist。我想创建fortran作为子例程并使用python来执行操作。
cmake_minimum_required(VERSION 2.8.6)
PROJECT(Demo)
include(CMakeForceCompiler)
IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
CMAKE_FORCE_CXX_COMPILER(icpc "Intel Cxx Compiler")
CMAKE_FORCE_C_COMPILER(icc "Intel C Compiler")
CMAKE_FORCE_Fortran_COMPILER(ifort "Intel Fortran Compiler")
ELSE()
CMAKE_FORCE_CXX_COMPILER(icl.exe "Intel Cxx Compiler")
CMAKE_FORCE_C_COMPILER(icl.exe "Intel C Compiler")
CMAKE_FORCE_Fortran_COMPILER(ifort.exe "Intel Fortran Compiler")
ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
message(STATUS ${CMAKE_Fortran_COMPILER})
message(STATUS ${CMAKE_CXX_COMPILER})
message(STATUS ${CMAKE_C_COMPILER})
enable_language( Fortran )
SET(EXECUTABLE_OUTPUT_PATH ".")
SET(LIBRARY_OUTPUT_PATH ".")
SET(SRC_COMP_LIB
hello.f90
md.f90
startDEMO.py
)
ADD_LIBRARY(demo SHARED ${SRC_COMP_LIB} )
SET_TARGET_PROPERTIES(demo PROPERTIES LINKER_LANGUAGE Fortran)
任何人都可以帮我用cmakelist做点什么吗?
答案 0 :(得分:1)
你做过
source /opt/intel/bin/compilervars.sh intel64
(或ia32)
在使用英特尔编译器时应该总是这样做吗?