This is an automated email from the ASF dual-hosted git repository.

pengzheng pushed a commit to branch feature/579-automatic-dependency-deduction
in repository https://gitbox.apache.org/repos/asf/celix.git


The following commit(s) were added to 
refs/heads/feature/579-automatic-dependency-deduction by this push:
     new 3a363187 Recover Findlibuuid.cmake
3a363187 is described below

commit 3a3631879d2e7bd74b940df7e305f57cdf3ab9cc
Author: PengZheng <[email protected]>
AuthorDate: Sat Jul 15 00:38:02 2023 +0800

    Recover Findlibuuid.cmake
---
 cmake/Modules/Findlibuuid.cmake | 43 +++++++++++++++++++++++++++--------------
 1 file changed, 28 insertions(+), 15 deletions(-)

diff --git a/cmake/Modules/Findlibuuid.cmake b/cmake/Modules/Findlibuuid.cmake
index b0e47200..f67bd742 100644
--- a/cmake/Modules/Findlibuuid.cmake
+++ b/cmake/Modules/Findlibuuid.cmake
@@ -22,23 +22,36 @@
 #  UUID_LIBRARIES - The libraries needed to use UUID
 #  libuuid::libuuid - Imported target for UUID
 
-find_path(UUID_INCLUDE_DIR uuid/uuid.h
-        /usr/include
-        /usr/local/include )
+if (APPLE)
+    set(UUID_INCLUDE_DIRS )
+    set(UUID_LIBRARIES )
 
-find_library(UUID_LIBRARY NAMES uuid
-        PATHS /usr/lib /usr/local/lib /usr/lib64 /usr/local/lib64 
/lib/i386-linux-gnu /lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu)
+    find_package_handle_standard_args(UUID DEFAULT_MSG)
 
-include(FindPackageHandleStandardArgs)
-if (APPLE)
-    find_package_handle_standard_args(UUID  DEFAULT_MSG
-            UUID_INCLUDE_DIR)
+    if (NOT TARGET UUID::lib)
+        add_library(UUID::lib INTERFACE IMPORTED)
+    endif ()
 else ()
-    find_package_handle_standard_args(UUID  DEFAULT_MSG
-            UUID_LIBRARY UUID_INCLUDE_DIR)
-endif ()
 
+    find_path(UUID_INCLUDE_DIR uuid/uuid.h
+            /usr/include
+            /usr/local/include )
+
+    find_library(UUID_LIBRARY NAMES uuid
+            PATHS /usr/lib /usr/local/lib /usr/lib64 /usr/local/lib64 
/lib/i386-linux-gnu /lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu)
+
+    include(FindPackageHandleStandardArgs)
+    find_package_handle_standard_args(UUID DEFAULT_MSG
+            UUID_LIBRARY UUID_INCLUDE_DIR)
 
-mark_as_advanced(UUID_INCLUDE_DIR UUID_LIBRARY)
-set(UUID_INCLUDE_DIRS ${UUID_INCLUDE_DIR})
-set(UUID_LIBRARIES ${UUID_LIBRARY})
\ No newline at end of file
+    mark_as_advanced(UUID_INCLUDE_DIR UUID_LIBRARY)
+    set(UUID_INCLUDE_DIRS ${UUID_INCLUDE_DIR})
+    set(UUID_LIBRARIES ${UUID_LIBRARY})
+    if (UUID_FOUND AND NOT TARGET UUID::lib)
+        add_library(UUID::lib SHARED IMPORTED)
+        set_target_properties(UUID::lib PROPERTIES
+                IMPORTED_LOCATION "${UUID_LIBRARY}"
+                INTERFACE_INCLUDE_DIRECTORIES "${UUID_INCLUDE_DIR}"
+                )
+    endif ()
+endif ()
\ No newline at end of file

Reply via email to