Use system-provided version of YAJL where available

fixes #7454
This commit is contained in:
Gunnar Beutner 2014-10-27 12:42:57 +01:00
parent 196bd89c7a
commit 05d642f69d
6 changed files with 43 additions and 5 deletions

View File

@ -80,6 +80,14 @@ include_directories(${Boost_INCLUDE_DIRS})
find_package(OpenSSL REQUIRED) find_package(OpenSSL REQUIRED)
include_directories(${OPENSSL_INCLUDE_DIR}) include_directories(${OPENSSL_INCLUDE_DIR})
find_package(YAJL)
if(NOT YAJL_FOUND)
include_directories(${icinga2_BINARY_DIR}/third-party/yajl/include)
link_directories(${icinga2_BINARY_DIR}/third-party/yajl)
set(YAJL_LIBRARIES "yajl")
endif()
include_directories( include_directories(
${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/lib ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/lib
${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/lib ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/lib

View File

@ -28,6 +28,7 @@ parentheses):
* recommended: libexecinfo on FreeBSD * recommended: libexecinfo on FreeBSD
* optional: MySQL (mysql-devel on RHEL, libmysqlclient-dev on Debian) * optional: MySQL (mysql-devel on RHEL, libmysqlclient-dev on Debian)
* optional: PostgreSQL (postgresql-devel on RHEL, libpq-dev on Debian) * optional: PostgreSQL (postgresql-devel on RHEL, libpq-dev on Debian)
* optional: YAJL (yajl-devel on RHEL, libyajl-dev on Debian)
Note: RHEL5 ships an ancient flex version. Updated packages are available for Note: RHEL5 ships an ancient flex version. Updated packages are available for
example from the repoforge buildtools repository. example from the repoforge buildtools repository.

28
cmake/FindYAJL.cmake Normal file
View File

@ -0,0 +1,28 @@
# - Try to find libyajl
# Once done this will define
# YAJL_FOUND - System has YAJL
# YAJL_INCLUDE_DIRS - The YAJL include directories
# YAJL_LIBRARIES - The libraries needed to use YAJL
# YAJL_DEFINITIONS - Compiler switches required for using YAJL
find_package(PkgConfig)
pkg_check_modules(PC_YAJL QUIET yajl)
set(YAJL_DEFINITIONS ${PC_YAJL_CFLAGS_OTHER})
find_path(YAJL_INCLUDE_DIR yajl/yajl_parse.h
HINTS ${PC_YAJL_INCLUDEDIR} ${PC_YAJL_INCLUDE_DIRS}
PATH_SUFFIXES libyajl)
find_library(YAJL_LIBRARY NAMES yajl libyajl
HINTS ${PC_YAJL_LIBDIR} ${PC_YAJL_LIBRARY_DIRS})
set(YAJL_LIBRARIES ${YAJL_LIBRARY} )
set(YAJL_INCLUDE_DIRS ${YAJL_INCLUDE_DIR})
include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set YAJL_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args(yajl DEFAULT_MSG
YAJL_LIBRARY YAJL_INCLUDE_DIR)
mark_as_advanced(YAJL_INCLUDE_DIR YAJL_LIBRARY)

1
debian/control vendored
View File

@ -19,6 +19,7 @@ Build-Depends: bison,
libmysqlclient-dev, libmysqlclient-dev,
libpq-dev, libpq-dev,
libssl-dev, libssl-dev,
libyajl-dev,
make (>= 3.81), make (>= 3.81),
po-debconf po-debconf
Standards-Version: 3.9.5 Standards-Version: 3.9.5

View File

@ -41,7 +41,7 @@ endif()
add_library(base SHARED ${base_SOURCES}) add_library(base SHARED ${base_SOURCES})
target_link_libraries(base ${CMAKE_DL_LIBS} ${Boost_LIBRARIES} ${OPENSSL_LIBRARIES} mmatch yajl) target_link_libraries(base ${CMAKE_DL_LIBS} ${Boost_LIBRARIES} ${OPENSSL_LIBRARIES} ${YAJL_LIBRARIES} mmatch)
if(HAVE_LIBEXECINFO) if(HAVE_LIBEXECINFO)
target_link_libraries(base execinfo) target_link_libraries(base execinfo)
@ -56,9 +56,6 @@ link_directories(${icinga2_BINARY_DIR}/third-party/execvpe)
include_directories(${icinga2_SOURCE_DIR}/third-party/mmatch) include_directories(${icinga2_SOURCE_DIR}/third-party/mmatch)
link_directories(${icinga2_BINARY_DIR}/third-party/mmatch) link_directories(${icinga2_BINARY_DIR}/third-party/mmatch)
include_directories(${icinga2_BINARY_DIR}/third-party/yajl/include)
link_directories(${icinga2_BINARY_DIR}/third-party/yajl)
if(UNIX OR CYGWIN) if(UNIX OR CYGWIN)
target_link_libraries(base execvpe) target_link_libraries(base execvpe)
endif() endif()

View File

@ -16,7 +16,10 @@
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
add_subdirectory(mmatch) add_subdirectory(mmatch)
add_subdirectory(yajl)
if(NOT YAJL_FOUND)
add_subdirectory(yajl)
endif()
if(UNIX OR CYGWIN) if(UNIX OR CYGWIN)
add_subdirectory(execvpe) add_subdirectory(execvpe)