[
https://issues.apache.org/jira/browse/AVRO-4113?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17930856#comment-17930856
]
ASF subversion and git services commented on AVRO-4113:
-------------------------------------------------------
Commit db738a76bd1fe79614eef6d6626d63692910f7b2 in avro's branch
refs/heads/dependabot/maven/lang/java/org.apache.thrift-libthrift-0.21.0 from
Petr Kubánek
[ https://gitbox.apache.org/repos/asf?p=avro.git;h=db738a76b ]
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)
> [c++] Don't generate test C++ files when tests aren't selected
> --------------------------------------------------------------
>
> Key: AVRO-4113
> URL: https://issues.apache.org/jira/browse/AVRO-4113
> Project: Apache Avro
> Issue Type: Improvement
> Components: c++
> Reporter: Petr Kubánek
> Assignee: Petr Kubánek
> Priority: Blocker
> Labels: pull-request-available
> Fix For: 1.13.0
>
> Time Spent: 40m
> Remaining Estimate: 0h
>
> The gen macro (which converts interfaces to c++ bindings) is called when
> tests aren't needed. This works fine unless you try to cross-compile Avro -
> then of course avrocppgen is a binary, that cannot be run on your host, and
> so the compilation fails.
> This patch should make it possible to skip gen when tests aren't requested:
> {code}
> 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})
> {code}
> I marked that as blocked, as without that I will be unable to get
> openembedded/NI cRIO compilation working without some manual tinkering.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)