martinzink commented on code in PR #1885:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1885#discussion_r1820280802


##########
cmake/LZ4.cmake:
##########
@@ -26,11 +26,29 @@ FetchContent_Declare(lz4
     URL            https://github.com/lz4/lz4/archive/refs/tags/v1.9.4.tar.gz
     URL_HASH       
SHA256=0b0e3aa07c8c063ddf40b082bdf7e37a1562bda40a0ff5272957f3e987e0e54b
     SOURCE_SUBDIR  build/cmake
+    OVERRIDE_FIND_PACKAGE
 )
 
 FetchContent_MakeAvailable(lz4)
 
-add_library(lz4::lz4 ALIAS lz4_static)
+if(NOT TARGET lz4::lz4)
+    add_library(lz4::lz4 ALIAS lz4_static)
+    add_library(LZ4::LZ4 ALIAS lz4_static)
+
+    install(TARGETS lz4_static
+            EXPORT Lz4Targets          # Add to Lz4Targets export set
+            ARCHIVE DESTINATION lib
+            LIBRARY DESTINATION lib
+            RUNTIME DESTINATION bin
+    )
+
+    # Install the export set itself
+    install(EXPORT Lz4Targets
+            FILE Lz4Targets.cmake       # Generate Lz4Targets.cmake file
+            NAMESPACE lz4::             # Set the namespace to lz4::
+            DESTINATION lib/cmake/Lz4   # Where to install the CMake config
+    )

Review Comment:
   I'm not quite sure if this was the right approach, but without this 
librdkafka cmake calls fail due to
   `install(EXPORT "RdKafkaTargets" ...) includes target "rdkafka" which 
requires target "lz4_static" that is not in any export set.`



-- 
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.

To unsubscribe, e-mail: [email protected]

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

Reply via email to