diff --git a/Sources/Plasma/NucleusLib/pnUUID/CMakeLists.txt b/Sources/Plasma/NucleusLib/pnUUID/CMakeLists.txt index 76566021..0398aeb1 100644 --- a/Sources/Plasma/NucleusLib/pnUUID/CMakeLists.txt +++ b/Sources/Plasma/NucleusLib/pnUUID/CMakeLists.txt @@ -10,6 +10,11 @@ if(WIN32) endif(WIN32) if(UNIX) + if(NOT APPLE) + find_package(Uuid REQUIRED) + include_directories(${Uuid_INCLUDE_DIR}) + endif() + set(pnUUID_SOURCES ${pnUUID_SOURCES} pnUUID_Unix.cpp) endif(UNIX) @@ -23,7 +28,7 @@ if(WIN32) target_link_libraries(pnUUID pnUtils) target_link_libraries(pnUUID rpcrt4) elseif(NOT APPLE) - target_link_libraries(pnUUID uuid) + target_link_libraries(pnUUID ${Uuid_LIBRARIES}) endif(WIN32) source_group("Source Files" FILES ${pnUUID_SOURCES}) diff --git a/cmake/FindUuid.cmake b/cmake/FindUuid.cmake new file mode 100644 index 00000000..af803e20 --- /dev/null +++ b/cmake/FindUuid.cmake @@ -0,0 +1,30 @@ +if(Uuid_INCLUDE_DIR AND Uuid_LIBRARY) + set(Uuid_FIND_QUIETLY TRUE) +endif() + + +find_path(Uuid_INCLUDE_DIR uuid/uuid.h + /usr/local/include + /usr/include +) + +find_library(Uuid_LIBRARY NAMES uuid + PATHS /usr/local/lib /usr/lib +) + +set(Uuid_LIBRARIES ${Uuid_LIBRARY}) + + +if(Uuid_INCLUDE_DIR AND Uuid_LIBRARY) + set(Uuid_FOUND TRUE) +endif() + +if(Uuid_FOUND) + if(NOT Uuid_FIND_QUIETLY) + message(STATUS "Found libuuid: ${Uuid_INCLUDE_DIR}") + endif() +else() + if(Uuid_FIND_REQUIRED) + message(FATAL_ERROR "Could not find libuuid") + endif() +endif()