find_package(OpenSSL 3.5 REQUIRED COMPONENTS Crypto)
add_library(cath_pq_lab2_wire STATIC wire.cpp)
if(CATH_WITH_PQ_STAKE)
  target_sources(cath_pq_lab2_wire PRIVATE stake.cpp)
endif()
target_compile_features(cath_pq_lab2_wire PUBLIC cxx_std_17)
# NDK r26's libc++ hides std::unary_function in C++17, while the
# already-supported Android Boost 1.74 headers still inherit from it.
# Restore that standard-library compatibility declaration for the PQ
# target and its consumers, without changing consensus or crypto code.
if(ANDROID)
  target_compile_definitions(cath_pq_lab2_wire PUBLIC _LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION=1)
endif()
target_link_libraries(cath_pq_lab2_wire PUBLIC OpenSSL::Crypto)
add_executable(cath_pq_wire_test EXCLUDE_FROM_ALL ${PROJECT_SOURCE_DIR}/tests/cath_pq_lab2/wire_test.cpp)
target_link_libraries(cath_pq_wire_test PRIVATE cath_pq_lab2_wire cryptonote_core)

if(CATH_WITH_PQ_MIGRATION)
  add_executable(cath_pq_migration_test EXCLUDE_FROM_ALL
    ${PROJECT_SOURCE_DIR}/tests/cath_pq_migration/funding_test.cpp)
  target_link_libraries(cath_pq_migration_test PRIVATE cryptonote_core)
endif()

if(CATH_PQ_PREACTIVATION)
  add_executable(cath_pq_change_wire_test EXCLUDE_FROM_ALL
    ${PROJECT_SOURCE_DIR}/tests/cath_pq_change_wire/wire_test.cpp)
  target_link_libraries(cath_pq_change_wire_test PRIVATE cath_pq_lab2_wire cryptonote_core)
endif()
