[CMake] Problems finding dependence library

Reza Housseini reza.housseini at gmx.ch
Thu Sep 20 11:25:35 EDT 2012


Hello list

I have a problem finding a dependent library of my own libsieve.so:

set(CPPLIB_DIR "${CMAKE_SOURCE_DIR}/../core/build")
find_library(CPPLIB_SIEVE_LIBRARY NAMES libsieve PATHS CPPLIB_DIR)

I have the following folder structure:

core
  build
    libsieve.so
project
  CMakeLists.txt

It fails to find the file, what am I doing wrong? I also tried to
write my own FindLibSieve.cmake:

include(LibFindMacros)

# Use pkg-config to get hints about paths
libfind_pkg_check_modules(LIBSIEVE_PKGCONF libsieve.so)

# Include dir
find_path(LIBSIEVE_INCLUDE_DIR
  NAMES Sieve.h
  PATHS ${LIBSIEVE_PKGCONF_INCLUDE_DIRS}
)

# Finally the library itself
find_library(LIBSIEVE_LIBRARY
  NAMES libsieve Sieve libsieve.dll.a
  PATHS ${LIBSIEVE_PKGCONF_LIBRARY_DIRS}
)

# Set the include dir variables and the libraries and let
libfind_process do the rest.
# NOTE: Singular variables for this library, plural for libraries this
this lib depends on.
set(LIBSIEVE_PROCESS_INCLUDES LIBSIEVE_INCLUDE_DIR)
set(LIBSIEVE_PROCESS_LIBS LIBSIEVE_LIBRARY)
libfind_process(LIBSIEVE)

Als no success.
Thanks for any input!
Reza


More information about the CMake mailing list