diff --git a/lang/c++/CMakeLists.txt b/lang/c++/CMakeLists.txt index 8e7f12bb530..47d0d42de81 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 f49e1205daf..d6e914e9657 100644 --- a/lang/c++/impl/avrogencpp.cc +++ b/lang/c++/impl/avrogencpp.cc @@ -16,6 +16,7 @@ * limitations under the License. */ +#include #include #ifndef _WIN32 #include