Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[vcpkg] Cannot use wxGLCanvas in CMake project on Windows #24519

Open
1 of 6 tasks
sidy3d opened this issue May 4, 2024 · 4 comments
Open
1 of 6 tasks

[vcpkg] Cannot use wxGLCanvas in CMake project on Windows #24519

sidy3d opened this issue May 4, 2024 · 4 comments
Labels
build Any build issue (with or without CMake)

Comments

@sidy3d
Copy link

sidy3d commented May 4, 2024

Reference: microsoft/vcpkg#38539

Build System Used

I build wxWidgets and/or my application using:

  • CMake
  • configure
  • mingw32-make with makefile.gcc
  • MSBuild (Microsoft Visual Studio solution file)
  • nmake with makefile.vc
  • Xcode

Description

Cannot use wxGLCanvas in a CMake project using vcpkg on Windows. The same project works fine when using Visual Studio and vcpkg.

CMakeLists.txt

cmake_minimum_required (VERSION 3.28)

set(CMAKE_CXX_STANDARD 20)
project (openGLIntergration CXX)

find_package(gl3w CONFIG REQUIRED)
find_package(wxwidgets CONFIG REQUIRED)

# Add source to this project's executable.
add_executable (openGLIntergration WIN32 "main.cpp")

target_link_libraries(openGLIntergration PRIVATE unofficial::gl3w::gl3w)
target_link_libraries(openGLIntergration PRIVATE wx::core wx::base wx::wxgl)

Failure Log:

Severity	Code	Description	Project	File	Line	Suppression State	Details
Error		CMake Error at out/build/x64-Debug-MSVC/vcpkg_installed/x64-windows/share/wxwidgets/wxWidgetsTargets.cmake:159 (set_target_properties):
  The link interface of target "wx::wxgl" contains:

    OpenGL::GLU

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.		C:\dev\source\wxWidgetsTutorials\openGLIntergration\out/build/x64-Debug-MSVC/vcpkg_installed/x64-windows/share/wxwidgets/wxWidgetsTargets.cmake	159		

Platform and version information

  • wxWidgets version you are building: 3.2.4
  • wxWidgets port you are building: wxMSW
  • OS and its version: Windows 11
  • Compiler being used: MSVC 2022
  • Non-default compiler options, if any: None
@sidy3d sidy3d added the build Any build issue (with or without CMake) label May 4, 2024
@MaartenBent
Copy link
Contributor

MaartenBent commented May 13, 2024

What if you add find_package(OpenGL) to your CMake file?
I think this has been fixed in the wx-master branch

find_package(OpenGL QUIET)

but 3.2 does not have this.

@vadz
Copy link
Contributor

vadz commented May 13, 2024

@MaartenBent If you think it's worth doing this, I could still backport 302ad5f to 3.2 and rebuild the 3.2.5 source archives once again (this wouldn't affect the MSW binaries). Should I do this?

@MaartenBent
Copy link
Contributor

I don't think it is necessary to add this to 3.2.5 and recreate the release files. The workaround is easy enough.

I can create a PR with the backport, and maybe include some other stuff from #24263 as well.

@sidy3d
Copy link
Author

sidy3d commented May 15, 2024

What if you add find_package(OpenGL) to your CMake file? I think this has been fixed in the wx-master branch

find_package(OpenGL QUIET)

but 3.2 does not have this.

Thanks, this seems to have fixed the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Any build issue (with or without CMake)
Projects
None yet
Development

No branches or pull requests

3 participants