Skip to content

Commit

Permalink
AVRO-4113: [c++] Don't generate tests files if test are not requested (
Browse files Browse the repository at this point in the history
…#3298)

* Don't generate tests files if test are not requested

* Added algorithm include (needed for std::find_if)
  • Loading branch information
pkubanek authored Jan 30, 2025
1 parent fb7e16a commit db738a7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lang/c++/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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})
Expand Down
1 change: 1 addition & 0 deletions lang/c++/impl/avrogencpp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* limitations under the License.
*/

#include <algorithm>
#include <cctype>
#ifndef _WIN32
#include <ctime>
Expand Down

0 comments on commit db738a7

Please sign in to comment.