wgtmac commented on code in PR #3299:
URL: https://github.com/apache/avro/pull/3299#discussion_r1930275129


##########
lang/c++/CMakeLists.txt:
##########
@@ -202,15 +196,16 @@ if (AVRO_BUILD_EXECUTABLES)
     gen (union_redundant_types redundant_types)
 
     add_executable (avrogencpp impl/avrogencpp.cc)
-    target_link_libraries (avrogencpp avrocpp_s ${Boost_LIBRARIES})
+    target_link_libraries (avrogencpp avrocpp_s)
+    target_compile_definitions(avrogencpp PRIVATE 
AVRO_VERSION="${AVRO_VERSION}")
 endif ()
 
 if (AVRO_BUILD_TESTS)
     enable_testing()
 
     macro (unittest name)
         add_executable (${name} test/${name}.cc)
-        target_link_libraries (${name} avrocpp_s ${Boost_LIBRARIES} 
${SNAPPY_LIBRARIES} ${ZLIB_LIBRARIES})
+        target_link_libraries (${name} avrocpp_s Boost::system ZLIB::ZLIB 
$<$<TARGET_EXISTS:Snappy::snappy>:Snappy::snappy>)

Review Comment:
   Yes, that's better. I have switched to use `TARGET_NAME_IF_EXISTS`. At the 
same time, the minimum CMake version has been bumped to 3.12 to use it:  
https://cmake.org/cmake/help/v3.12/release/3.12.html?highlight=target_name_if_exists#generator-expressions



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