diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/CMakeLists.txt b/src/algorithms/telemetry_decoder/gnuradio_blocks/CMakeLists.txt index 5fc8e8bcd..48cc517ae 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/CMakeLists.txt @@ -74,6 +74,21 @@ if(has_rotl) ) endif() +if(USE_GENERIC_LAMBDAS) + set(has_generic_lambdas HAS_GENERIC_LAMBDA=1) + set(no_has_generic_lambdas HAS_GENERIC_LAMBDA=0) + target_compile_definitions(telemetry_decoder_gr_blocks + PRIVATE + "$<$:${has_generic_lambdas}>" + "$<$>:${no_has_generic_lambdas}>" + ) +else() + target_compile_definitions(telemetry_decoder_gr_blocks + PRIVATE + -DHAS_GENERIC_LAMBDA=0 + ) +endif() + if(ENABLE_CLANG_TIDY) if(CLANG_TIDY_EXE) set_target_properties(telemetry_decoder_gr_blocks diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_gs.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_gs.cc index f3954b6cf..dd81fd043 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_gs.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_gs.cc @@ -39,8 +39,16 @@ namespace my_rotl = std; #else namespace my_rotl { -auto rotl = [](auto x, auto n) { return (((x) << (n)) ^ ((x) >> (32 - (n)))); }; // Used in the parity check algorithm -} +#ifndef _rotl +#if HAS_GENERIC_LAMBDA +auto rotl = [](auto x, auto n) { return (((x) << (n)) ^ ((x) >> (32 - (n)))); }; +#else +#define rotl(X, N) (((X) << (N)) ^ ((X) >> (32 - (N)))) +#endif +#else +#define rotl _rotl +#endif +} // namespace my_rotl #endif