我正在尝试使用 cmake-gui 制作一个 makefile 来将 fortran 和 python 链接在一起。当我配置和生成 makefile 时,一切正常。但是在我得到库并尝试在 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 做点什么吗?