Skip to content

Commit db738a7

Browse files
authored
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)
1 parent fb7e16a commit db738a7

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

lang/c++/CMakeLists.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,13 @@ if (AVRO_BUILD_EXECUTABLES)
170170

171171
target_link_libraries (precompile avrocpp_s)
172172

173+
add_executable (avrogencpp impl/avrogencpp.cc)
174+
target_link_libraries (avrogencpp avrocpp_s ${Boost_LIBRARIES})
175+
endif ()
176+
177+
if (AVRO_BUILD_TESTS)
178+
enable_testing()
179+
173180
macro (gen file ns)
174181
add_custom_command (OUTPUT ${file}.hh
175182
COMMAND avrogencpp
@@ -201,13 +208,6 @@ if (AVRO_BUILD_EXECUTABLES)
201208
gen (big_union big_union)
202209
gen (union_redundant_types redundant_types)
203210

204-
add_executable (avrogencpp impl/avrogencpp.cc)
205-
target_link_libraries (avrogencpp avrocpp_s ${Boost_LIBRARIES})
206-
endif ()
207-
208-
if (AVRO_BUILD_TESTS)
209-
enable_testing()
210-
211211
macro (unittest name)
212212
add_executable (${name} test/${name}.cc)
213213
target_link_libraries (${name} avrocpp_s ${Boost_LIBRARIES} ${SNAPPY_LIBRARIES} ${ZLIB_LIBRARIES})

lang/c++/impl/avrogencpp.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
* limitations under the License.
1717
*/
1818

19+
#include <algorithm>
1920
#include <cctype>
2021
#ifndef _WIN32
2122
#include <ctime>

0 commit comments

Comments
 (0)