我正在努力将ARPACK添加到myCMakeLists (见下文)文件中,我在Mac-OSX下构造了我的Qt-project。请注意,我通过'Macport‘安装了Armadillo库,Qt可以自动识别它,而无需将其添加到CMakeList文件中。但由于我使用的是Armadillo的稀疏分解函数,Qt要求我将ARPACK库链接到该项目。我安装了ARPACK库,但是我不知道如何在我的CMakeList文件中添加。我该怎么添加呢?
发布于 2016-03-22 18:52:08
我通过将以下行添加到我的CMakeList中修复了这个问题:
SET(ARMADILLO_INCLUDE_DIR "/Users/Anass/Downloads/armadillo-
6.600.4/include/")
SET(ARMADILLO_LIBRARIES "/Users/Anass/Downloads/armadillo-
6.600.4/libarmadillo.6.60.4.dylib")
SET(ARPACK_LIBRARIES "/opt/local/lib/libarpack.dylib")
...
IF(LAPACK_FOUND)
SET(LINK_LIBRARIES
${LAPACK_LIBRARIES} ${BLAS_LIBRARIES}
${ARMADILLO_LIBRARIES} ${ARPACK_LIBRARIES})
ELSE()
SET(LINK_LIBRARIES ${ARMADILLO_LIBRARIES} ${ARPACK_LIBRARIES})
ENDIF()
MESSAGE("")
MESSAGE("STEP 3 : GENERATE COMPILATION PROCESS")
MESSAGE("")
include_directories(
${ARMADILLO_INCLUDE_DIR}
)
if(CMAKE_COMPILER_IS_GNUCXX)
message("adding c++11 support")
list(APPEND CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}")
endif(CMAKE_COMPILER_IS_GNUCXX)
########################################################
SET(EXECUTABLE_OUTPUT_PATH ./bin)
MESSAGE("Add test cmake")
SET(test_cmake_SRCS
${CMAKE_SOURCE_DIR}/src/test_cmake.cpp
)
add_executable(test_cmake ${test_cmake_SRCS})
target_link_libraries(test_cmake ${LINK_LIBRARIES})https://stackoverflow.com/questions/35829372
复制相似问题