getopt-win32 provides CMake targets: find_package(unofficial-getopt-win32 REQUIRED) target_link_libraries(main PRIVATE unofficial::getopt-win32::getopt)