magic-enum provides CMake targets:
find_package(magic_enum CONFIG REQUIRED)
target_link_libraries(main PRIVATE magic_enum::magic_enum)