[CMake] Forcing CMake to find static library
Matthias Redies
m.redies at fz-juelich.de
Fri Jun 9 13:39:59 EDT 2017
Hello,
I am trying to force CMAKE to include a specific static lapack library,
set through the environment variable $LAPACK_LIB:
> ls $LAPACK_LIB
libblas_extra.a libcblas.a liblapack.a liblapacke.a libtmglib.a
> echo $LAPACK_LIB
/bgsys/local/lapack/3.7.0/lib
This is how I am trying to do it in CMake:
cmake_minimum_required(VERSION 2.5)
project(TEST)
file(GLOB_RECURSE sources src/*.f90)
add_executable(cmake.x ${sources})
find_library(MY_LAPACK liblapack.a HINTS $ENV{LAPACK_LIB}
NO_CMAKE_LIBRARY_PATH)
MESSAGE(STATUS "Lapack location: ${MY_LAPACK}")
target_link_libraries(cmake.x ${MY_LAPACK} ${MY_ESSL})
enable_language(Fortran)
If I run CMake this results in:
> cmake .
-- Lapack location: /usr/lib64/liblapack.so
-- Configuring done
-- Generating done
-- Build files have been written to: /work/jias12/jias1217/lapack_test
How can I force CMake to find the correct library file and not some
random one laying around on the system?
Kind regards
Matthias
------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------
Forschungszentrum Juelich GmbH
52425 Juelich
Sitz der Gesellschaft: Juelich
Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498
Vorsitzender des Aufsichtsrats: MinDir Dr. Karl Eugen Huthmacher
Geschaeftsfuehrung: Prof. Dr.-Ing. Wolfgang Marquardt (Vorsitzender),
Karsten Beneke (stellv. Vorsitzender), Prof. Dr.-Ing. Harald Bolt,
Prof. Dr. Sebastian M. Schmidt
------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------
More information about the CMake
mailing list