forked from rraju1/cmake-buildscripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Findlog4cxx.cmake
56 lines (47 loc) · 1.96 KB
/
Findlog4cxx.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# Amber: taken from https://fossies.org/linux/orocos-ocl/ocl/config/FindLog4cxx.cmake
################################################################################
#
# CMake script for finding Log4cxx.
# The default CMake search process is used to locate files.
#
# This script creates the following variables:
# LOG4CXX_FOUND: Boolean that indicates if the package was found
# LOG4CXX_INCLUDE_DIR: Path to the necessary header files
# LOG4CXX_LIBRARY: Package library
#
################################################################################
include(FindPackageHandleStandardArgs)
include(LibFindMacros)
# See if LOG4CXX_ROOT is not already set in CMake
IF (NOT DEFINED LOG4CXX_ROOT)
# See if LOG4CXX_ROOT is set in process environment
IF ( DEFINED ENV{LOG4CXX_ROOT})
SET (LOG4CXX_ROOT "$ENV{LOG4CXX_ROOT}")
MESSAGE(STATUS "Detected LOG4CXX_ROOT set to '${LOG4CXX_ROOT}'")
ENDIF ()
ENDIF ()
# If LOG4CXX_ROOT is available, set up our hints
IF (LOG4CXX_ROOT)
SET (LOG4CXX_INCLUDE_HINTS "${LOG4CXX_ROOT}/include" "${LOG4CXX_ROOT}")
SET (LOG4CXX_LIBRARY_HINTS "${LOG4CXX_ROOT}/lib")
else()
# Use pkg-config to get hints about paths
libfind_pkg_check_modules(LOG4CXX_PKGCONF log4cxx)
if(DEFINED LOG4CXX_PKGCONF_INCLUDE_DIRS)
set(LOG4CXX_INCLUDE_HINTS ${LOG4CXX_PKGCONF_INCLUDE_DIRS})
else()
set(LOG4CXX_INCLUDE_HINTS "")
endif()
if(DEFINED LOG4CXX_PKGCONF_LIBRARY_DIRS)
set(LOG4CXX_LIBRARY_HINTS ${LOG4CXX_PKGCONF_LIBRARY_DIRS})
else()
set(LOG4CXX_LIBRARY_HINTS "")
endif()
endif()
# Find headers and libraries
find_path(LOG4CXX_INCLUDE_DIR NAMES log4cxx/log4cxx.h HINTS ${LOG4CXX_INCLUDE_HINTS})
find_library(LOG4CXX_LIBRARY NAMES log4cxx HINTS ${LOG4CXX_LIBRARY_HINTS})
# Set LOG4CXX_FOUND honoring the QUIET and REQUIRED arguments
find_package_handle_standard_args(LOG4CXX DEFAULT_MSG LOG4CXX_LIBRARY LOG4CXX_INCLUDE_DIR)
# Advanced options for not cluttering the cmake UIs
mark_as_advanced(LOG4CXX_INCLUDE_DIR LOG4CXX_LIBRARY)