From 0927bae5d493cbe5902cffd803a6d7eba9ff5a5d Mon Sep 17 00:00:00 2001 From: Dominik Schmidt Date: Fri, 13 Apr 2012 23:20:34 +0200 Subject: [PATCH] Simplify FindLibIniparser.cmake --- cmake/Modules/FindIniparser.cmake | 66 +++++++------------------------ 1 file changed, 15 insertions(+), 51 deletions(-) diff --git a/cmake/Modules/FindIniparser.cmake b/cmake/Modules/FindIniparser.cmake index cce6fe0ffa..b18c405fc5 100644 --- a/cmake/Modules/FindIniparser.cmake +++ b/cmake/Modules/FindIniparser.cmake @@ -7,68 +7,32 @@ # INIPARSER_DEFINITIONS - Compiler switches required for using Iniparser # # Copyright (c) 2007 Andreas Schneider +# (c) 2012 Dominik Schmidt # # Redistribution and use is allowed according to the terms of the New # BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. # +include(GNUInstallDirs) -if (INIPARSER_LIBRARIES AND INIPARSER_INCLUDE_DIRS) - # in cache already - set(INIPARSER_FOUND TRUE) -else (INIPARSER_LIBRARIES AND INIPARSER_INCLUDE_DIRS) - find_path(INIPARSER_INCLUDE_DIR +find_path(INIPARSER_INCLUDE_DIRS NAMES - iniparser.h - PATHS - /usr/include - /usr/local/include - /opt/local/include - /sw/include - ) + iniparser.h + HINTS + ${CMAKE_INSTALL_INCLUDEDIR} +) - find_library(INIPARSER_LIBRARY +find_library(INIPARSER_LIBRARIES NAMES - iniparser + iniparser PATHS - /usr/lib - /usr/local/lib - /opt/local/lib - /sw/lib - ) + ${CMAKE_INSTALL_LIBDIR} +) - if (INIPARSER_LIBRARY) - set(INIPARSER_FOUND TRUE) - endif (INIPARSER_LIBRARY) +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Iniparser + REQUIRED_VARS INIPARSER_LIBRARIES INIPARSER_INCLUDE_DIRS +) - set(INIPARSER_INCLUDE_DIRS - ${INIPARSER_INCLUDE_DIR} - ) - - if (INIPARSER_FOUND) - set(INIPARSER_LIBRARIES - ${INIPARSER_LIBRARIES} - ${INIPARSER_LIBRARY} - ) - endif (INIPARSER_FOUND) - - if (INIPARSER_INCLUDE_DIRS AND INIPARSER_LIBRARIES) - set(INIPARSER_FOUND TRUE) - endif (INIPARSER_INCLUDE_DIRS AND INIPARSER_LIBRARIES) - - if (INIPARSER_FOUND) - if (NOT Iniparser_FIND_QUIETLY) - message(STATUS "Found Iniparser: ${INIPARSER_LIBRARIES}") - endif (NOT Iniparser_FIND_QUIETLY) - else (INIPARSER_FOUND) - if (Iniparser_FIND_REQUIRED) - message(FATAL_ERROR "Could not find Iniparser") - endif (Iniparser_FIND_REQUIRED) - endif (INIPARSER_FOUND) - - # show the INIPARSER_INCLUDE_DIRS and INIPARSER_LIBRARIES variables only in the advanced view - mark_as_advanced(INIPARSER_INCLUDE_DIRS INIPARSER_LIBRARIES) - -endif (INIPARSER_LIBRARIES AND INIPARSER_INCLUDE_DIRS)