Simplify FindLibIniparser.cmake

This commit is contained in:
Dominik Schmidt 2012-04-13 23:20:34 +02:00
parent a6c16c063e
commit 0927bae5d4

View File

@ -7,68 +7,32 @@
# INIPARSER_DEFINITIONS - Compiler switches required for using Iniparser
#
# Copyright (c) 2007 Andreas Schneider <mail@cynapses.org>
# (c) 2012 Dominik Schmidt <dev@dominik-schmidt.org>
#
# 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)