41 lines
1.4 KiB
Diff
41 lines
1.4 KiB
Diff
|
CMakeLists.txt: use pkg-config to detect uuid when possible
|
||
|
|
||
|
In order to take into account the libraries used by libuuid when
|
||
|
building statically, using pkg-config is recommended. This patch
|
||
|
therefore improves the CMakeLists.txt to use pkg-config to detect
|
||
|
libuuid when pkg-config is available.
|
||
|
|
||
|
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
|
||
|
|
||
|
Index: b/CMakeLists.txt
|
||
|
===================================================================
|
||
|
--- a/CMakeLists.txt
|
||
|
+++ b/CMakeLists.txt
|
||
|
@@ -6,6 +6,7 @@
|
||
|
|
||
|
include (CheckFunctionExists)
|
||
|
include (CheckStructHasMember)
|
||
|
+include (FindPkgConfig)
|
||
|
|
||
|
set (HAVE_CMAKE true)
|
||
|
|
||
|
@@ -119,8 +120,16 @@
|
||
|
# Apple and FreeBSD include the uuid functions in their libc, rather than libuuid
|
||
|
check_function_exists (uuid_unparse_lower HAVE_UUID_UNPARSE_LOWER)
|
||
|
else (DARWIN OR FREEBSD)
|
||
|
- find_path (UUID_INCLUDE_DIR uuid/uuid.h)
|
||
|
- find_library (UUID_LIBRARY NAMES uuid)
|
||
|
+ if(PKG_CONFIG_FOUND)
|
||
|
+ pkg_check_modules(PC_UUID uuid)
|
||
|
+ if(PC_UUID_FOUND)
|
||
|
+ set (UUID_INCLUDE_DIR ${PC_UUID_INCLUDE_DIRS})
|
||
|
+ set (UUID_LIBRARY ${PC_UUID_LIBRARIES})
|
||
|
+ endif(PC_UUID_FOUND)
|
||
|
+ else(PKG_CONFIG_FOUND)
|
||
|
+ find_path (UUID_INCLUDE_DIR uuid/uuid.h)
|
||
|
+ find_library (UUID_LIBRARY NAMES uuid)
|
||
|
+ endif(PKG_CONFIG_FOUND)
|
||
|
if (UUID_INCLUDE_DIR AND UUID_LIBRARY)
|
||
|
set (TASKD_INCLUDE_DIRS ${TASKD_INCLUDE_DIRS} ${UUID_INCLUDE_DIR})
|
||
|
set (TASKD_LIBRARIES ${TASKD_LIBRARIES} ${UUID_LIBRARY})
|