If I manually link the GLES and EGL libraries(using pkg-config), the compiler won't find the gl symbols.
-- Checking for module 'glesv2'
-- Found glesv2, version 3.2
-- Checking for module 'egl'
-- Found egl, version 1.5
/usr/lib/gcc-cross/aarch64-linux-gnu/9/../../../../aarch64-linux-gnu/bin/ld: CMakeFiles/opengltest.dir/main.cpp.o: undefined reference to symbol 'glColor3f'
/usr/lib/gcc-cross/aarch64-linux-gnu/9/../../../../aarch64-linux-gnu/bin/ld: /lib/aarch64-linux-gnu/libGL.so.1: error adding symbols: DSO missing from command line
from cmakelists:
find_package(PkgConfig)
pkg_check_modules(GLES2 REQUIRED IMPORTED_TARGET GLOBAL glesv2)
pkg_check_modules(EGL REQUIRED IMPORTED_TARGET GLOBAL egl)
target_link_libraries(${PROJECT_NAME} Qt5::Gui Qt5::Qml Qt5::Quick Qt5::QuickControls2 Qt5::OpenGL PkgConfig::GLES2 PkgConfig::EGL)