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 97c65841 Fix find_package(CURL REQUIRED) for standalone etcd build.
97c65841 is described below

commit 97c65841b19aa72eb424043ab375e50c08e16245
Author: PengZheng <[email protected]>
AuthorDate: Sat Jul 15 13:53:15 2023 +0800

    Fix find_package(CURL REQUIRED) for standalone etcd build.
---
 libs/etcdlib/CMakeLists.txt | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/libs/etcdlib/CMakeLists.txt b/libs/etcdlib/CMakeLists.txt
index 51150747..072f2753 100644
--- a/libs/etcdlib/CMakeLists.txt
+++ b/libs/etcdlib/CMakeLists.txt
@@ -36,15 +36,6 @@ if (NOT COMMAND celix_subproject)
     set(CMAKE_EXE_LINKER_FLAGS "-pthread ${CMAKE_EXE_LINKER_FLAGS}")
 
     set(ETCDLIB_CMP ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME})
-    if (NOT TARGET CURL::libcurl)
-        #Note more recent curl will create CURL::libcurl target
-        message("Note CURL::libcurl target not created by find_package(CURL). 
Creating CURL::libcurl Target.")
-        add_library(CURL::libcurl SHARED IMPORTED)
-        set_target_properties(CURL::libcurl PROPERTIES
-                IMPORTED_LOCATION "${CURL_LIBRARIES}"
-                INTERFACE_INCLUDE_DIRECTORIES "${CURL_INCLUDE_DIRS}"
-                )
-    endif ()
     set(ETCDLIB_STANDALONE ON)
 else()
     set(ETCDLIB_CMP framework)
@@ -55,6 +46,16 @@ if (CELIX_ETCDLIB OR ETCDLIB_STANDALONE)
     find_package(CURL REQUIRED)
     find_package(jansson REQUIRED)
 
+    if (NOT TARGET CURL::libcurl)
+        #Note more recent curl will create CURL::libcurl target
+        message("Note CURL::libcurl target not created by find_package(CURL). 
Creating CURL::libcurl Target.")
+        add_library(CURL::libcurl SHARED IMPORTED)
+        set_target_properties(CURL::libcurl PROPERTIES
+                IMPORTED_LOCATION "${CURL_LIBRARIES}"
+                INTERFACE_INCLUDE_DIRECTORIES "${CURL_INCLUDE_DIRS}"
+                )
+    endif ()
+
     add_library(etcdlib SHARED src/etcd.c)
     target_include_directories(etcdlib PUBLIC 
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/api>)
     target_include_directories(etcdlib PRIVATE src)

Reply via email to