1
0
Fork 0
mirror of https://github.com/KingDuckZ/dindexer.git synced 2024-11-25 00:53:43 +00:00
dindexer/cmake/Modules/Findblkid.cmake
King_DuckZ fe2ea40c4f Implement autodetect set type.
Only supports HardDisk, Directory, CdRom, DVD, BluRay for now.
2015-12-08 13:56:46 +00:00

35 lines
1,022 B
CMake

#Find libblkid
#
# BLKID_INCLUDE_DIRS - where to find blkid/blkid.h
# BLKID_LIBRARIES - list of libraries when using libblkid
# BLKID_FOUND - true if libblkid found
# BLKID_VERSION_STRING- the version of the libblkid found
#
find_path(BLKID_INCLUDE_DIR NAMES blkid/blkid.h)
mark_as_advanced(BLKID_INCLUDE_DIR)
find_library(BLKID_LIBRARY NAMES
blkid
)
mark_as_advanced(BLKID_LIBRARY)
if(BLKID_INCLUDE_DIR)
if(EXISTS "${BLKID_INCLUDE_DIR}/blkid/blkid.h")
file(STRINGS "${BLKID_INCLUDE_DIR}/blkid/blkid.h" blkid_version_str REGEX "^#define[\t ]+BLKID_VERSION[\t ]+\".*\"")
string(REGEX REPLACE "^#define[\t ]+BLKID_VERSION[\t ]+\"([^\"]*)\".*" "\\1" BLKID_VERSION_STRING "${blkid_version_str}")
unset(blkid_version_str)
endif()
endif()
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(BLKID
REQUIRED_VARS BLKID_LIBRARY BLKID_INCLUDE_DIR
VERSION_VAR BLKID_VERSION_STRING
)
if(BLKID_FOUND)
set(BLKID_LIBRARIES ${BLKID_LIBRARY})
set(BLKID_INCLUDE_DIRS ${BLKID_INCLUDE_DIR})
endif()