Linking with cmake

Post here if you have a question about linking your program with LAPACK or ScaLAPACK library

Linking with cmake

Postby martinv » Mon May 30, 2011 5:58 pm

Dear LAPACK developers,

I compiled LAPACK 3.3.1 (on linux with gcc) and installed it in /home/martin/local/lapack. I would like to link a little test code against this library, but my cmake file always finds the lapack library which is installed in /usr/lib. The contents of my CMakeLists.txt is this:

Code: Select all
cmake_minimum_required(VERSION 2.8)
project(LapackTest)

set(CMAKE_PREFIX_PATH "/home/martin/local/lapack/lib/cmake")

find_package(LAPACK REQUIRED)

if(LAPACK_FOUND)
  message("Found Lapack")
  add_executable(test lapack_test1.cpp)
  target_link_libraries(test ${LAPACK_LIBRARIES})
  message("Lapack link library is ${LAPACK_LIBRARIES}")
endif()


When I run cmake, the output is always the same:

Lapack link library is /usr/lib/liblapack.so;/usr/lib/libblas.so

Could you please tell me what am I doing wrong? In case you don't use find_package(LAPACK), could you tell me what's the proper way to detect LAPACK compiled with cmake?

Thank you very much.

Best regards,

Martin Vymazal
martinv
 
Posts: 4
Joined: Mon May 30, 2011 5:42 pm

Re: Linking with cmake

Postby admin » Tue May 31, 2011 2:25 am

If you use the CMAKE interface, before the generate, change the value of LAPACK_LIBRARIES
or set it directly on your command line.
admin
Site Admin
 
Posts: 468
Joined: Wed Dec 08, 2004 7:07 pm


Return to Linking Problem

Who is online

Users browsing this forum: No registered users and 1 guest