Re: [sigc] How to test for libsigc++ with CMake?
- From: cheshirekow <cheshirekow gmail com>
- To: Jens Bäckman <jens titv se>
- Cc: libsigc-list gnome org
- Subject: Re: [sigc] How to test for libsigc++ with CMake?
- Date: Thu, 23 Feb 2012 08:38:19 -0500
Below is my find script for sigc++. It's my understanding this approach
is generally preferred because it will attempt to use pkg-config if it
can, but will still search for the required things if it cannot.
# - Try to find SigC++-2.0
# Once done, this will define
#
# SigC++_FOUND - system has SigC++
# SigC++_INCLUDE_DIRS - the SigC++ include directories
# SigC++_LIBRARIES - link these to use SigC++
include(LibFindMacros)
# Use pkg-config to get hints about paths
libfind_pkg_check_modules(SigC++_PKGCONF sigc++-2.0)
# Main include dir
find_path(SigC++_INCLUDE_DIR
NAMES sigc++/sigc++.h
PATHS ${SigC++_PKGCONF_INCLUDE_DIRS}
PATH_SUFFIXES sigc++-2.0
)
# Glib-related libraries also use a separate config header, which is in
lib dir
find_path(SigC++Config_INCLUDE_DIR
NAMES sigc++config.h
PATHS ${SigC++_PKGCONF_INCLUDE_DIRS} /usr
PATH_SUFFIXES lib/sigc++-2.0/include
)
libfind_library(SigC++ sigc 2.0)
# 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(SigC++_PROCESS_INCLUDES SigC++_INCLUDE_DIR SigC++Config_INCLUDE_DIR)
set(SigC++_PROCESS_LIBS SigC++_LIBRARY)
libfind_process(SigC++)
On Thu, 2012-02-09 at 15:52 +0100, Jens Bäckman wrote:
> 9 feb 2012 kl. 15:44 skrev Rui Maciel:
>
> > I've started a small pet project with the purpose of getting acquainted with cmake, and I intended to use libsigc++ on that project. Yet, I failed to get a hold of a way to write cmake scripts that test if libsigc++ is present in a system, which version is present and include it in the build process.
> >
> > As far as I could tell, cmake relies on Find scripts to include libraries, which tend to not be provided at all, and it appears it doesn't support standard tools such as pkg-config.
> >
> > So, does anyone have any experience using libsigc++ with cmake projects?
>
> It's actually very simple, if you use pkg-config.
>
> find_package(PkgConfig REQUIRED)
> pkg_check_modules(SIGC2 REQUIRED sigc++-2.0)
> include_directories(${SIGC2_INCLUDE_DIRS})
> # Define how to build yourapp here
> target_link_libraries(yourapp ${SIGC2_LIBRARIES})
>
> _______________________________________________
> libsigc-list mailing list
> libsigc-list gnome org
> http://mail.gnome.org/mailman/listinfo/libsigc-list
[
Date Prev][Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]