add_shedskin_product(
    BUILD_EXTENSION
)

# Regression test for the symbol-visibility fix in
# fn_add_shedskin_product.cmake: the extension module must not export
# operator new/delete (or other libgc/libgccpp internals) with default
# visibility, since that lets them interpose over the same symbols in
# unrelated C++ extensions (e.g. numpy) loaded into the same host
# process, corrupting the heap. Only meaningful on Linux, where `nm`
# is reliably available and the ELF symbol interposition issue applies;
# skip elsewhere rather than fail on tooling differences.
if(UNIX AND NOT APPLE)
    find_program(NM_EXECUTABLE nm)
    if(NM_EXECUTABLE)
        add_test(
            NAME test_ext_symbol_visibility_symbols
            COMMAND ${CMAKE_COMMAND}
                -DNM_EXECUTABLE=${NM_EXECUTABLE}
                -DSO_FILE=$<TARGET_FILE:test_ext_symbol_visibility-ext>
                -P ${CMAKE_CURRENT_SOURCE_DIR}/check_symbols.cmake
        )
    endif()
endif()
