jiridanek commented on a change in pull request #312:
URL: https://github.com/apache/qpid-proton/pull/312#discussion_r632144705



##########
File path: c/src/ProtonConfig.cmake.in
##########
@@ -22,50 +22,56 @@
 # Version: @PN_VERSION@
 # URL: http://qpid.apache.org/proton/
 
-set (Proton_VERSION       @PN_VERSION@)
+@PACKAGE_INIT@
+include("${CMAKE_CURRENT_LIST_DIR}/ProtonTargets.cmake")
 
-set (Proton_INCLUDE_DIRS  @INCLUDEDIR@)
-set (Proton_LIBRARIES     optimized @LIBDIR@/@PROTONLIB@ debug 
@LIBDIR@/@PROTONLIBDEBUG@)
-set (Proton_FOUND True)
+set(Proton_VERSION @PN_VERSION@)
+
+# find dependencies, because static libs don't transitively pull them
+if (Proton_USE_STATIC_LIBS)
+    set(CMAKE_MODULE_PATH_OLD ${CMAKE_MODULE_PATH})
+    set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")
+
+    set(CyrusSASL_FOUND @CyrusSASL_FOUND@)
+    if (CyrusSASL_FOUND)
+        find_package (CyrusSASL REQUIRED)
+    endif()
+
+    set(OpenSSL_FOUND @OpenSSL_FOUND@)
+    if (OpenSSL_FOUND)
+        find_package (OpenSSL REQUIRED)
+    endif()
 
-set (Proton_Core_INCLUDE_DIRS  @INCLUDEDIR@)
-set (Proton_Core_LIBRARIES     optimized @LIBDIR@/@PROTONCORELIB@ debug 
@LIBDIR@/@PROTONCORELIBDEBUG@)
+    set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH_OLD})
+endif()
 
-# Add modular target in a way compatible with cmake 2.8.12
-if (NOT TARGET Proton::core)
-  add_library(Proton::core UNKNOWN IMPORTED)
-  set_target_properties(Proton::core
-    PROPERTIES
-      IMPORTED_LOCATION "@LIBDIR@/@PROTONCORELIB@"
-      IMPORTED_LOCATION_DEBUG "@LIBDIR@/@PROTONCORELIBDEBUG@"
-      INTERFACE_INCLUDE_DIRECTORIES "${Proton_Core_INCLUDE_DIRS}")
+set(Proton_INCLUDE_DIRS @INCLUDEDIR@)
+if (NOT Proton_USE_STATIC_LIBS)
+    set (Proton_LIBRARIES Proton::qpid-proton)
+else()
+    set (Proton_LIBRARIES Proton::qpid-proton-static)
 endif()
+set (Proton_FOUND True)
 
+if (NOT Proton_USE_STATIC_LIBS)
+    add_library(Proton::core ALIAS Proton::qpid-proton-core)
+else ()
+    add_library(Proton::core ALIAS Proton::qpid-proton-core-static)
+endif ()
+set (Proton_Core_INCLUDE_DIRS @INCLUDEDIR@)
+set (Proton_Core_LIBRARIES Proton::core)
 set (Proton_Core_FOUND True)

Review comment:
       the idea is to be backwards compatible and allow easy api to switch 
between static/dynamic libs for cmake users; it is weird but so far it worked




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to