Browse Source

Merge pull request #477 from zrax/find_uuid

Ensure uuid-dev is present when building on Linux
Adam Johnson 10 years ago
parent
commit
225a3f3ebb
  1. 7
      Sources/Plasma/NucleusLib/pnUUID/CMakeLists.txt
  2. 30
      cmake/FindUuid.cmake

7
Sources/Plasma/NucleusLib/pnUUID/CMakeLists.txt

@ -10,6 +10,11 @@ if(WIN32)
endif(WIN32) endif(WIN32)
if(UNIX) if(UNIX)
if(NOT APPLE)
find_package(Uuid REQUIRED)
include_directories(${Uuid_INCLUDE_DIR})
endif()
set(pnUUID_SOURCES ${pnUUID_SOURCES} pnUUID_Unix.cpp) set(pnUUID_SOURCES ${pnUUID_SOURCES} pnUUID_Unix.cpp)
endif(UNIX) endif(UNIX)
@ -23,7 +28,7 @@ if(WIN32)
target_link_libraries(pnUUID pnUtils) target_link_libraries(pnUUID pnUtils)
target_link_libraries(pnUUID rpcrt4) target_link_libraries(pnUUID rpcrt4)
elseif(NOT APPLE) elseif(NOT APPLE)
target_link_libraries(pnUUID uuid) target_link_libraries(pnUUID ${Uuid_LIBRARIES})
endif(WIN32) endif(WIN32)
source_group("Source Files" FILES ${pnUUID_SOURCES}) source_group("Source Files" FILES ${pnUUID_SOURCES})

30
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()
Loading…
Cancel
Save