Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

Commit

Permalink
augeas: fix prefix for non-default installations
Browse files Browse the repository at this point in the history
as discussed in #1187
  • Loading branch information
Markus Raab committed Dec 15, 2016
1 parent 814b9f0 commit ef06e88
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
10 changes: 9 additions & 1 deletion cmake/Modules/FindAugeas.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#
# Distributed under the BSD license. See COPYING-CMAKE-SCRIPTS for details.

include (LibFindMacros)

if (LIBAUGEAS_INCLUDE_DIR)
# in cache already
set (LIBAUGEAS_FOUND TRUE)
Expand All @@ -25,6 +27,12 @@ else (LIBAUGEAS_INCLUDE_DIR)
/usr/local/include
)

pkg_get_variable(_LIBAUGEAS_PREFIX augeas prefix)
if (NOT _LIBAUGEAS_PREFIX)
set (_LIBAUGEAS_PREFIX "/usr")
endif ()
set(LIBAUGEAS_PREFIX "${_LIBAUGEAS_PREFIX}" CACHE INTERNAL "prefix path of libaugeas" FORCE)

find_library (LIBAUGEAS_LIBRARIES NAMES augeas
PATHS
${_LIBAUGEAS_PC_LIBDIR}
Expand All @@ -44,6 +52,6 @@ else (LIBAUGEAS_INCLUDE_DIR)
endif (LIBAUGEAS_FIND_REQUIRED)
endif (LIBAUGEAS_FOUND)

mark_as_advanced(LIBAUGEAS_INCLUDE_DIR LIBAUGEAS_LIBRARIES)
mark_as_advanced(LIBAUGEAS_INCLUDE_DIR LIBAUGEAS_LIBRARIES _LIBAUGEAS_PREFIX)

endif (LIBAUGEAS_INCLUDE_DIR)
4 changes: 4 additions & 0 deletions src/plugins/augeas/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ if (DEPENDENCY_PHASE)
find_package (Augeas)
find_package (LibXml2)

set (LIBAUGEAS_COMPILE_DEFINITIONS LIBAUGEAS_PREFIX="${LIBAUGEAS_PREFIX}")

if (LIBAUGEAS_FOUND AND LIBXML2_FOUND)
try_compile (HAS_LIBAUGEAS16
"${CMAKE_BINARY_DIR}"
Expand All @@ -28,6 +30,8 @@ add_plugin(augeas
INCLUDE_DIRECTORIES
${LIBAUGEAS_INCLUDE_DIR}
${LIBXML2_INCLUDE_DIR}
COMPILE_DEFINITIONS
"${LIBAUGEAS_COMPILE_DEFINITIONS}"
LINK_ELEKTRA
elektra-meta
elektra-proposal
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/augeas/augeas.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ int elektraAugeasGenConf (KeySet * ks, Key * errorKey ELEKTRA_UNUSED)
{
glob_t pglob;
int retval = 1;
const char * f = "/usr/share/augeas/lenses/dist/*.aug";
const char * f = LIBAUGEAS_PREFIX "/share/augeas/lenses/dist/*.aug";
if (glob (f, GLOB_NOSORT, NULL, &pglob) == 0)
{
ELEKTRA_LOG ("has glob %zd", pglob.gl_pathc);
Expand Down

0 comments on commit ef06e88

Please sign in to comment.