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

thiru pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/avro.git


The following commit(s) were added to refs/heads/main by this push:
     new db738a76b AVRO-4113: [c++] Don't generate tests files if test are not 
requested (#3298)
db738a76b is described below

commit db738a76bd1fe79614eef6d6626d63692910f7b2
Author: Petr Kubánek <[email protected]>
AuthorDate: Thu Jan 30 06:51:56 2025 +0100

    AVRO-4113: [c++] Don't generate tests files if test are not requested 
(#3298)
    
    * Don't generate tests files if test are not requested
    
    * Added algorithm include (needed for std::find_if)
---
 lang/c++/CMakeLists.txt     | 14 +++++++-------
 lang/c++/impl/avrogencpp.cc |  1 +
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/lang/c++/CMakeLists.txt b/lang/c++/CMakeLists.txt
index 8e7f12bb5..47d0d42de 100644
--- a/lang/c++/CMakeLists.txt
+++ b/lang/c++/CMakeLists.txt
@@ -170,6 +170,13 @@ if (AVRO_BUILD_EXECUTABLES)
 
     target_link_libraries (precompile avrocpp_s)
 
+    add_executable (avrogencpp impl/avrogencpp.cc)
+    target_link_libraries (avrogencpp avrocpp_s ${Boost_LIBRARIES})
+endif ()
+
+if (AVRO_BUILD_TESTS)
+    enable_testing()
+
     macro (gen file ns)
         add_custom_command (OUTPUT ${file}.hh
             COMMAND avrogencpp
@@ -201,13 +208,6 @@ if (AVRO_BUILD_EXECUTABLES)
     gen (big_union big_union)
     gen (union_redundant_types redundant_types)
 
-    add_executable (avrogencpp impl/avrogencpp.cc)
-    target_link_libraries (avrogencpp avrocpp_s ${Boost_LIBRARIES})
-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})
diff --git a/lang/c++/impl/avrogencpp.cc b/lang/c++/impl/avrogencpp.cc
index f49e1205d..d6e914e96 100644
--- a/lang/c++/impl/avrogencpp.cc
+++ b/lang/c++/impl/avrogencpp.cc
@@ -16,6 +16,7 @@
  * limitations under the License.
  */
 
+#include <algorithm>
 #include <cctype>
 #ifndef _WIN32
 #include <ctime>

Reply via email to