opencv / opencv/opencv-python

Build on windows CMAKE_ARGS using generator with spaces doesn't work

Open
#1,086 0 comments 0 reactions 1 assignee View on GitHub

@asmorkalov is already working on this.

Since Apr 24, 2025.

Dominant language
Python
Stars
5.4k
Forks
1k
Avg merge
22h 17m
Merged PRs (30d)
3

Description

Hello,
I am trying to build opencv-python with GStreamer on Windows with custom CMAKE_ARGS.
As Gstreamer was compiled with MSVC 2019 and I have Visual Studio 2022 (with MSVC 2019 Build Tools), I need to specify 2 flags so the Linker will be able to work:
-G "Visual Studio 17 2022" -T v142
This works for me when I run directly the "cmake" command.
But in my case I would like to create python wheels, that is why I use the pip wheel . --verbose command to build it.

Unfortunatly I coudn't make it work, because as I pass these through the CMAKE_ARGS it complains that it look for "Visual" word only and not the whole "Visual Studio 17 2022" phrase.

$env:CMAKE_ARGS='-G "Visual Studio 17 2022" -T v142 -DWITH_GSTREAMER=ON'
py.exe -V:3.11 -m pip wheel . --verbose
CMake Error: Could not create named generator "Visual

Can you please help me with it?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.