From 2384236849001fcbbe4b15df237cca0e512f61f7 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Thu, 17 Mar 2016 10:42:52 +0100 Subject: cmake: Try to fix FindArgp module Signed-off-by: Andreas Schneider --- cmake/Modules/FindArgp.cmake | 92 +++++++++++++++++++++++--------------------- 1 file changed, 49 insertions(+), 43 deletions(-) (limited to 'cmake') diff --git a/cmake/Modules/FindArgp.cmake b/cmake/Modules/FindArgp.cmake index 8dedc855..454965ac 100644 --- a/cmake/Modules/FindArgp.cmake +++ b/cmake/Modules/FindArgp.cmake @@ -1,60 +1,66 @@ -# - Try to find Argp +# - Try to find ARGP # Once done this will define # -# ARGP_FOUND - system has Argp -# ARGP_INCLUDE_DIRS - the Argp include directory -# ARGP_LIBRARIES - Link these to use Argp -# ARGP_DEFINITIONS - Compiler switches required for using Argp +# ARGP_ROOT_DIR - Set this variable to the root installation of ARGP # -# Copyright (c) 2010 Andreas Schneider +# Read-Only variables: +# ARGP_FOUND - system has ARGP +# ARGP_INCLUDE_DIR - the ARGP include directory +# ARGP_LIBRARIES - Link these to use ARGP +# ARGP_DEFINITIONS - Compiler switches required for using ARGP # -# Redistribution and use is allowed according to the terms of the New -# BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. +#============================================================================= +# Copyright (c) 2011-2016 Andreas Schneider +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= # +set(_ARGP_ROOT_HINTS +) -if (ARGP_LIBRARIES AND ARGP_INCLUDE_DIRS) - # in cache already - set(ARGP_FOUND TRUE) -else (ARGP_LIBRARIES AND ARGP_INCLUDE_DIRS) +set(_ARGP_ROOT_PATHS + "$ENV{PROGRAMFILES}/argp" +) - find_path(ARGP_INCLUDE_DIR +find_path(ARGP_ROOT_DIR NAMES - argp.h + include/argp.h + HINTS + ${_ARGP_ROOT_HINTS} PATHS - /usr/include - /usr/local/include - /opt/local/include - /sw/include - ) + ${_ARGP_ROOT_PATHS} +) +mark_as_advanced(ARGP_ROOT_DIR) - find_library(ARGP_LIBRARY +find_path(ARGP_INCLUDE_DIR NAMES - argp + argp.h PATHS - /usr/lib - /usr/local/lib - /opt/local/lib - /sw/lib - ) - - set(ARGP_INCLUDE_DIRS - ${ARGP_INCLUDE_DIR} - ) - - if (ARGP_LIBRARY) - set(ARGP_LIBRARIES - ${ARGP_LIBRARIES} - ${ARGP_LIBRARY} - ) - endif (ARGP_LIBRARY) + ${ARGP_ROOT_DIR}/include +) - include(FindPackageHandleStandardArgs) - find_package_handle_standard_args(Argp DEFAULT_MSG ARGP_LIBRARIES ARGP_INCLUDE_DIRS) +find_library(ARGP_LIBRARY + NAMES + argp + PATHS + ${ARGP_ROOT_DIR}/lib +) - # show the ARGP_INCLUDE_DIRS and ARGP_LIBRARIES variables only in the advanced view - mark_as_advanced(ARGP_INCLUDE_DIRS ARGP_LIBRARIES) +if (ARGP_LIBRARY) + set(ARGP_LIBRARIES + ${ARGP_LIBRARIES} + ${ARGP_LIBRARY} + ) +endif (ARGP_LIBRARY) -endif (ARGP_LIBRARIES AND ARGP_INCLUDE_DIRS) +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(ARGP DEFAULT_MSG ARGP_LIBRARIES ARGP_INCLUDE_DIR) +# show the ARGP_INCLUDE_DIR and ARGP_LIBRARIES variables only in the advanced view +mark_as_advanced(ARGP_INCLUDE_DIR ARGP_LIBRARIES) -- cgit v1.2.3