diff --git a/cmake/FindUUID.cmake b/cmake/FindUUID.cmake index bf055d4..15be822 100644 --- a/cmake/FindUUID.cmake +++ b/cmake/FindUUID.cmake @@ -18,4 +18,25 @@ if (UNIX) include(IgnPkgConfig) ign_pkg_check_modules(UUID uuid) + + # If pkg-config is not available in the system, + # it is neccessary to manually find uuid + if(NOT TARGET UUID::UUID) + find_path(UUID_INCLUDE_DIRS NAMES uuid.h PATH_SUFFIXES uuid) + mark_as_advanced(UUID_INCLUDE_DIRS) + + find_library(UUID_LIBRARIES NAMES uuid libuuid) + mark_as_advanced(UUID_LIBRARIES) + + if(NOT UUID_INCLUDE_DIRS OR NOT UUID_LIBRARIES) + set(UUID_FOUND false) + else() + set(UUID_FOUND true) + endif() + + if(UUID_FOUND) + include(IgnImportTarget) + ign_import_target(UUID) + endif() + endif() endif()