I have been sitting on this for a while now and really do not understand what is going on. I have the following problem with cmake and armadillo/lapack/blas:
I try to download armadillo with cmake, compile it and then link it to my program.
However, while I can download, compile it etc. I have troubles linking it to my program.
I get the following error when linking to an executable:
undefined reference to `dgemv_'
So I know that this is a lapack/blas thing, but I cannot figure out what is wrong.
The relevant parts in my CMakeLists.txt are below. I would be very happy if someone could help me. I am close to eating my keyboard out of frustration.
ExternalProject_Add(ArmadilloDownload
PREFIX ${LIBRARY_OUTPUT_PATH}/armadillo-7.100.3
DOWNLOAD_COMMAND wget http://sourceforge.net/projects/arma/files/armadillo-7.100.3.tar.xz
CONFIGURE_COMMAND tar -xf ../armadillo-7.100.3.tar.xz -C ../ArmadilloDownload --strip-components=1
BUILD_IN_SOURCE 1
BUILD_COMMAND cmake .
INSTALL_COMMAND make
UPDATE_COMMAND ""
)
set(Armadillo_DIR ${LIBRARY_OUTPUT_PATH}/armadillo-7.100.3/src/ArmadilloDownload)
set(ARMADILLO_LIBRARY ${Armadillo_DIR}/libarmadillo.so)
set(ARMADILLO_INCLUDE_DIR ${Armadillo_DIR}/include/)
include_directories(${ARMADILLO_INCLUDE_DIR})
set(GCC_ARMADILLO_LINK_FLAG "-O1 -llapack -lblas")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${GCC_ARMADILLO_LINK_FLAG}")
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${GCC_ARMADILLO_LINK_FLAG}")