summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2011-10-19 18:05:23 -0700
committerCarl Worth <cworth@cworth.org>2011-10-19 18:05:23 -0700
commit746d2de0f6d2d0f161254bdbf4b2b279c3ba8287 (patch)
tree13fb7c38c7567d528cae051ae14b19c739136caa
parent4c348c15f52fae933c1c693627c1dd55608069ba (diff)
Add support for linking against talloc.
This isn't used yet, but will be in a subsequent commit, so it's convenient to see here only the changes to the build system to enable the use of talloc.
-rwxr-xr-xCMakeLists.txt3
-rw-r--r--apitrace.cpp2
-rw-r--r--cmake/FindTalloc.cmake72
3 files changed, 77 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index bf0f41c..b1459a7 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -51,6 +51,9 @@ else ()
include_directories (${X11_INCLUDE_DIR})
endif ()
+find_package(Talloc REQUIRED)
+include_directories(${TALLOC_INCLUDE_DIRS})
+link_libraries(${TALLOC_LIBRARIES})
##############################################################################
# Set global build options
diff --git a/apitrace.cpp b/apitrace.cpp
index 5aa5a65..4a4ebea 100644
--- a/apitrace.cpp
+++ b/apitrace.cpp
@@ -39,6 +39,8 @@
#include <sys/stat.h>
#include <unistd.h>
+#include <talloc.h>
+
#include "config.h"
#define ARRAY_SIZE(arr) (sizeof (arr) / sizeof (arr[0]))
diff --git a/cmake/FindTalloc.cmake b/cmake/FindTalloc.cmake
new file mode 100644
index 0000000..1eb3de7
--- /dev/null
+++ b/cmake/FindTalloc.cmake
@@ -0,0 +1,72 @@
+# - Try to find Talloc
+# Once done this will define
+#
+# TALLOC_FOUND - system has Talloc
+# TALLOC_INCLUDE_DIRS - the Talloc include directory
+# TALLOC_LIBRARIES - Link these to use Talloc
+# TALLOC_DEFINITIONS - Compiler switches required for using Talloc
+#
+# Copyright (c) 2010 Holger Hetterich <hhetter@novell.com>
+# Copyright (c) 2007 Andreas Schneider <mail@cynapses.org>
+#
+# Redistribution and use is allowed according to the terms of the New
+# BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+if (TALLOC_LIBRARIES AND TALLOC_INCLUDE_DIRS)
+ # in cache already
+ set(TALLOC_FOUND TRUE)
+else (TALLOC_LIBRARIES AND TALLOC_INCLUDE_DIRS)
+ find_path(TALLOC_INCLUDE_DIR
+ NAMES
+ talloc.h
+ PATHS
+ /usr/include
+ /usr/local/include
+ /opt/local/include
+ /sw/include
+ )
+
+ find_library(TALLOC_LIBRARY
+ NAMES
+ talloc
+ PATHS
+ /usr/lib
+ /usr/local/lib
+ /opt/local/lib
+ /sw/lib
+ )
+
+ if (TALLOC_LIBRARY)
+ set(TALLOC_FOUND TRUE)
+ endif (TALLOC_LIBRARY)
+
+ set(TALLOC_INCLUDE_DIRS
+ ${INIPARSER_INCLUDE_DIR}
+ )
+
+ if (TALLOC_FOUND)
+ set(TALLOC_LIBRARIES
+ ${TALLOC_LIBRARIES}
+ ${TALLOC_LIBRARY}
+ )
+ endif (TALLOC_FOUND)
+
+ if (TALLOC_INCLUDE_DIRS AND TALLOC_LIBRARIES)
+ set(TALLOC_FOUND TRUE)
+ endif (TALLOC_INCLUDE_DIRS AND TALLOC_LIBRARIES)
+
+ if (TALLOC_FOUND)
+ if (NOT Talloc_FIND_QUIETLY)
+ message(STATUS "Found Talloc: ${TALLOC_LIBRARIES}")
+ endif (NOT Talloc_FIND_QUIETLY)
+ else (TALLOC_FOUND)
+ if (Talloc_FIND_REQUIRED)
+ message(FATAL_ERROR "Could not find Talloc")
+ endif (Talloc_FIND_REQUIRED)
+ endif (TALLOC_FOUND)
+
+ # show the INIPARSER_INCLUDE_DIRS and INIPARSER_LIBRARIES variables only in the advanced view
+ mark_as_advanced(TALLOC_INCLUDE_DIRS TALLOC_LIBRARIES)
+
+endif (TALLOC_LIBRARIES AND TALLOC_INCLUDE_DIRS)