如何使用CMake使用VTK,Boost和SQLite3库构建MPI程序?

时间:2016-05-03 14:59:22

标签: cmake mpi

我想使用thisMPIVTKBoost库构建SQLite3程序。首先,我使用CMake文件构建了一个简单的MPI程序而没有其他库,如下所示:

CMakeLists.cmake

我使用cmake_minimum_required(VERSION 2.6) PROJECT(testMPI) FIND_PATH(MPI_INTEL_C mpicc $ENV{PATH}) FIND_PATH(MPI_INTEL_CXX mpicxx $ENV{PATH}) IF(MPI_INTEL_C AND MPI_INTEL_CXX) MESSAGE(STATUS "Intel MPI compiler is used.") SET(CMAKE_CXX_COMPILER mpicxx) SET(CMAKE_C_COMPILER mpicc) ENDIF(MPI_INTEL_C AND MPI_INTEL_CXX) SET(EXECUTABLE_OUTPUT_PATH ${testMPI_SOURCE_DIR}/bin) SET(SRC_LIST testMPI.cpp) ADD_EXECUTABLE(testMPI ${SRC_LIST}) FIND_PATH(MPI_H_INCLUDE mpi.h $ENV{PATH}) IF(NOT MPI_H_INCLUDE) MESSAGE(FATAL_ERROR "mpi.h not found") ENDIF(NOT MPI_H_INCLUDE) INCLUDE_DIRECTORIES(${MPI_H_INCLUDE}) IF(MPI_INTEL_C AND MPI_INTEL_CXX) SET_TARGET_PROPERTIES(testMPI PROPERTIES LINK_FLAGS -i-dynamic) ELSE(MPI_INTEL_C AND MPI_INTEL_CXX) FIND_LIBRARY(MPI_CXX_LIB mpichcxx $ENV{PATH}) IF(NOT MPI_CXX_LIB) MESSAGE(FATAL_ERROR "mpich2 library not found") ENDIF(NOT MPI_CXX_LIB) TARGET_LINK_LIBRARIES(testMPI ${MPI_CXX_LIB}) FIND_LIBRARY(MPI_LIB mpich $ENV{PATH}) IF(NOT MPI_LIB) MESSAGE(FATAL_ERROR "mpich2 library not found") ENDIF(NOT MPI_LIB) TARGET_LINK_LIBRARIES(testMPI ${MPI_LIB}) ENDIF(MPI_INTEL_C AND MPI_INTEL_CXX) 成功运行程序,返回的mpirun -np 8 -nolocal -machinefile ./machinefile ./testMPI是正确的(= 8)。

然后,我只是将number of processesVTKBoost库的一些标题放入这个简单的程序(.cpp)中,并使用以下CMakeLists.cmake来查找,包含并链接这些库。该程序已成功构建,我也使用SQLite3来运行此程序,但返回的mpirun -np 8 -nolocal -machinefile ./machinefile ./testMPI错误(= 1)。那么如何使用CMake与其他库构建MPI程序?提前谢谢!

number of processes

0 个答案:

没有答案