source: calamares/trunk/fuentes/CMakeModules/FindLIBPARTED.cmake @ 7538

Last change on this file since 7538 was 7538, checked in by kbut, 13 months ago

sync with github

File size: 2.6 KB
Line 
1# Copyright (C) 2008,2010,2011 by Volker Lanz <vl@fidra.de>
2#
3# Redistribution and use in source and binary forms, with or without
4# modification, are permitted provided that the following conditions
5# are met:
6#
7# 1. Redistributions of source code must retain the above copyright
8#    notice, this list of conditions and the following disclaimer.
9# 2. Redistributions in binary form must reproduce the above copyright
10#    notice, this list of conditions and the following disclaimer in the
11#    documentation and/or other materials provided with the distribution.
12#
13# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
14# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
15# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
16# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
17# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
18# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
19# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
20# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23
24include(CheckCSourceCompiles)
25include(CheckFunctionExists)
26
27if (LIBPARTED_INCLUDE_DIR AND LIBPARTED_LIBRARY)
28  # Already in cache, be silent
29  set(LIBPARTED_FIND_QUIETLY TRUE)
30endif (LIBPARTED_INCLUDE_DIR AND LIBPARTED_LIBRARY)
31
32
33FIND_PATH(LIBPARTED_INCLUDE_DIR parted.h PATH_SUFFIXES parted )
34
35FIND_LIBRARY(LIBPARTED_LIBRARY NAMES parted)
36FIND_LIBRARY(LIBPARTED_FS_RESIZE_LIBRARY NAMES parted-fs-resize)
37
38INCLUDE(FindPackageHandleStandardArgs)
39FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBPARTED DEFAULT_MSG LIBPARTED_LIBRARY LIBPARTED_INCLUDE_DIR)
40
41if (LIBPARTED_FS_RESIZE_LIBRARY)
42  set(LIBPARTED_LIBS ${LIBPARTED_LIBRARY} ${LIBPARTED_FS_RESIZE_LIBRARY})
43else (LIBPARTED_FS_RESIZE_LIBRARY)
44  set(LIBPARTED_LIBS ${LIBPARTED_LIBRARY})
45endif (LIBPARTED_FS_RESIZE_LIBRARY)
46
47# KDE adds -ansi to the C make flags, parted headers use GNU extensions, so
48# undo that
49unset(CMAKE_C_FLAGS)
50
51set(CMAKE_REQUIRED_INCLUDES ${LIBPARTED_INCLUDE_DIR})
52set(CMAKE_REQUIRED_LIBRARIES ${LIBPARTED_LIBS})
53
54CHECK_FUNCTION_EXISTS("ped_file_system_clobber" LIBPARTED_FILESYSTEM_SUPPORT) # parted < 3.0
55CHECK_FUNCTION_EXISTS("ped_file_system_resize" LIBPARTED_FS_RESIZE_LIBRARY_SUPPORT) # parted != 3.0
56
57MARK_AS_ADVANCED(LIBPARTED_LIBRARY LIBPARTED_INCLUDE_DIR LIBPARTED_FILESYSTEM_SUPPORT LIBPARTED_FS_RESIZE_LIBRARY LIBPARTED_FS_RESIZE_LIBRARY_SUPPORT)
Note: See TracBrowser for help on using the repository browser.