[CMake] find_library

Vania Joloboff vania.joloboff at inria.fr
Thu Jan 14 04:28:40 EST 2016


I am running cmake 3.2.2 on Linux 64 bits

I run cmake with

  cmake -G "Unix Makefiles" -DSYSTEMC_PATH=$HOME/systemc-2.3.1/

In my CMakeLists.txt,

If I put

  find_library(SYSC_LIB systemc PATHS "${SYSTEMC_PATH}"
               PATH_SUFFIXES lib-linux64 lib64-linux lib64-linux64)

it works.

If I put
  find_library(SYSC_LIB systemc PATHS ENV SYSTEMC_PATH
               PATH_SUFFIXES lib-linux64 lib64-linux lib64-linux64)

which I think should be identical, I get error
CMake Error at CMakeLists.txt:28 (message):
   ERROR: SYSC_LIB-NOTFOUND

Can anyone explain the difference and why the second does not work ?

btw

find_library(SYSC_LIB NAMES systemc foobar PATHS "${SYSTEMC_PATH}"
                PATH_SUFFIXES lib-linux64 lib64-linux lib64-linux64)

  also works
and
     find_library(SYSC_LIB systemc PATHS ENV SYSTEMC_PATH
       PATH_SUFFIXES lib-linux64 lib64-linux lib64-linux64
       NO_DEFAULT_PATH)
also fails

At least it is consistent :-(

Thanx



More information about the CMake mailing list