Reputation: 271
I'm struggling with adding the ARPACK in myCMakeLists (see below) file of which i construct my Qt-project under Mac-OSX. Note that i installed the Armadillo library via 'Macport' and it's recognized automatically by Qt without adding it in the CMakeList file. But since i'm using the Sparse-Decomposition function of Armadillo, Qt asks me to link the ARPACK library to the project. I installed the ARPACK library but i didn't find how to add in my CMakeList file. How could i add it please ?
Upvotes: 3
Views: 648
Reputation: 271
I fixed this problems by adding thses lines to my 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})
Upvotes: 3