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

wxwidgets installed but not detected by FindwxWidgets.cmake #4756

Closed
slodki opened this issue Nov 18, 2018 · 33 comments · Fixed by #13361
Closed

wxwidgets installed but not detected by FindwxWidgets.cmake #4756

slodki opened this issue Nov 18, 2018 · 33 comments · Fixed by #13361
Assignees
Labels
category:port-feature The issue is with a library, which is requesting new capabilities that didn’t exist

Comments

@slodki
Copy link

slodki commented Nov 18, 2018

wxWidgets installed with simple vcpkg install wxwidgets:x64-windows-static without problems.
Simple minimal CMake project

cmake_minimum_required(VERSION 3.12)
project(test)
find_package(wxWidgets REQUIRED
    COMPONENTS core qa html xml aui adv stc webview base scintilla)

generates error:

CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.12/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
  Could NOT find wxWidgets (missing: wxWidgets_LIBRARIES
  wxWidgets_INCLUDE_DIRS)
Call Stack (most recent call first):
  C:/Program Files (x86)/CMake/share/cmake-3.12/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
  C:/Program Files (x86)/CMake/share/cmake-3.12/Modules/FindwxWidgets.cmake:963 (find_package_handle_standard_args)
  C:/Tools/vcpkg/scripts/buildsystems/vcpkg.cmake:247 (_find_package)
  CMakeLists.txt:6 (find_package)

because libraries are installed in non-standard directory (${WX_ROOT_DIR}/lib in place of ${WX_ROOT_DIR}/lib/vc141...). See
https://github.com/Kitware/CMake/blob/be9ad8279a29893943b342cc5ffdbf9868fb1b4c/Modules/FindwxWidgets.cmake#L544

@markusobi
Copy link

I created a slightly modified FindwxWidgets.cmake, which I placed in vcpkg/ports/wxwidgets/Modules, but I don't know where to fix the CMAKE_MODULE_PATH globally, so that cmake prefers this file over the default FindwxWidgets.cmake.

It works when modifying CMAKE_MODULE_PATH in the project, which calls find_package(wxWidgets MODULE REQUIRED), but I want to change CMAKE_MODULE_PATH from vcpkg.

I tried modifying the CMAKE_MODULE_PATH inside the portfile.cmake, but this didn't work.
The CMAKE_MODULE_PATH was still empty in my project.

this is what I tried to add in the https://github.com/Microsoft/vcpkg/blob/master/ports/wxwidgets/portfile.cmake :
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/Modules")

@PhoebeHui PhoebeHui added the category:port-feature The issue is with a library, which is requesting new capabilities that didn’t exist label Feb 27, 2019
@fei4xu
Copy link

fei4xu commented Mar 4, 2019

Same issue here.
@markusobi Did you find a workaround in the end?

@markusobi
Copy link

Same issue here.
@markusobi Did you find a workaround in the end?

No, I ended up putting list(APPEND CMAKE_MODULE_PATH "${_VCPKG_ROOT_DIR}/ports/wxwidgets/Modules") before the find_package(wxWidgets) call on the client side.

The whole wxwidgets build system is a mess.

@zelid
Copy link

zelid commented Jun 2, 2019

The same issue, @markusobi can you please share the modified vcpkg aware version of FindwxWidgets.cmake ?

@CaeruleusAqua
Copy link
Contributor

CaeruleusAqua commented Jun 13, 2019

My solution:
https://github.com/CaeruleusAqua/vcpkg-wx-find
(does not work with visual studio generator) -> use ninja

@markusobi
Copy link

@zelid
I couldn't find a solution that works on linux too.

@HenryAWE
Copy link

HenryAWE commented Jul 7, 2019

It seems that I have the same issue.
Visual Studio solution works well on computer, but the cmake can't find the package when I use cmake to build the executable.

@Censacrof
Copy link

I'm having this issue too. I'm making a cross-platform project and I'd like to be able to use cmake on all platforms (Linux, Windows, Mac). Has anyone found a solution to this problem?

@jonathanverner
Copy link

I just stumbled into this too :-(

@jmkerloch
Copy link

Any update on this issue ? vcpkg is really useful but if we can't use it with wxWidgets there is no point in using it in our projects.

@jmkerloch
Copy link

I created a slightly modified FindwxWidgets.cmake, which I placed in vcpkg/ports/wxwidgets/Modules, but I don't know where to fix the CMAKE_MODULE_PATH globally, so that cmake prefers this file over the default FindwxWidgets.cmake.

It works when modifying CMAKE_MODULE_PATH in the project, which calls find_package(wxWidgets MODULE REQUIRED), but I want to change CMAKE_MODULE_PATH from vcpkg.

I tried modifying the CMAKE_MODULE_PATH inside the portfile.cmake, but this didn't work.
The CMAKE_MODULE_PATH was still empty in my project.

this is what I tried to add in the https://github.com/Microsoft/vcpkg/blob/master/ports/wxwidgets/portfile.cmake :
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/Modules")

Could you share with us the modified FindwxWidgets.cmake ?

@nickoe
Copy link

nickoe commented Apr 27, 2020

@jmkerloch I am using this version, slightly modified from what the original author did, see the revisions on the gist.

https://gist.github.com/nickoe/d3c224a2587eff8ea959bc383a993520/

I am not exactly sure why this special findwxwidgets cmake file is needed, it would be nice if a fix could be upstreamed in cmake or vcpkg.

@jmkerloch
Copy link

@nickoe I just tried your file and now I can find wxWidgets from VCPKG. Thanks !

@SeanOMik
Copy link

SeanOMik commented May 4, 2020

@jmkerloch I am using this version, slightly modified from what the original author did, see the revisions on the gist.

https://gist.github.com/nickoe/d3c224a2587eff8ea959bc383a993520/

I am not exactly sure why this special findwxwidgets cmake file is needed, it would be nice if a fix could be upstreamed in cmake or vcpkg.

I tried that but I got lots of linker errors: https://pastebin.com/xCGEJLLc

@jmkerloch
Copy link

@SeanOMik How did you link to wxWidgets in your CMakeList.txt ?

@SeanOMik
Copy link

SeanOMik commented May 5, 2020

@SeanOMik How did you link to wxWidgets in your CMakeList.txt ?

This is how I find it:

find_package(wxWidgets 3.1 COMPONENTS core base REQUIRED)

And link:

target_link_libraries(discord_client PRIVATE ${wxWidgets_LIBRARY})

@brad-anderson
Copy link
Contributor

I've updated the patch @nickoe did for the latest version of FindwxWidgets.cmake (CMake 3.17.2).

https://gist.github.com/brad-anderson/876a8c581abf285dd20b3c532bf48bd2

@jmkerloch
Copy link

@brad-anderson how do you integrate your FindwxWidgets.cmake on your CMakeList.txt ?

The file is working for a release version in Windows but for debug version the path to the .lib are not correct

For example here is the lib include for net module
<vcpkg_root>\installed\x64-windows\lib\wxbase31u_net.lib instead of <vcpkg_root>\installed\x64-windows\debug\lib\wxbase31ud_net.lib

Does anyone have an idea how to get the correct path ?

@jmkerloch
Copy link

For the debug version I wasn't selecting the correct version in Visual Studio...
But for linux wxWidgets can be install but is not found with updated FindwxWidgets.cmake

@myirci
Copy link

myirci commented Aug 17, 2020

Hi, I also have a similar issue.
I can build wxWidgets (3.1.4) projects from VS 2019 using the installed libraries with vcpkg (both with dynamic and static linking: x64-windows and x64-windows-static) but with cmake (3.18.1) I could not figure out how to do that. find_package always fails and complains about missing: wxWidgets_LIBRARIES.

Is there any progress on this issue?
Thanks!

@LilyWangL
Copy link
Contributor

I will confirm and fix this issue soon.

@JCBurnside
Copy link

can confirm that this is still broken at this point in time.

@gvcallen
Copy link

Also broken for me.

@gvcallen
Copy link

Any temporary fix for this please? Running Windows

@gvcallen
Copy link

Using this patch in CMAKE https://gist.github.com/brad-anderson/876a8c581abf285dd20b3c532bf48bd2 I am able to find wxWidgets but get loads of linking errors on Windows

@alvarogalloc
Copy link

Did anyone find out how to do it?, or a solution will be merged to master?

@PhoebeHui
Copy link
Contributor

PR #13361 would address this issue.

ras0219-msft added a commit that referenced this issue Feb 9, 2021
* [wxwidgets] Fix #4756

* [wxwidgets] Avoid replacing FindwxWidgets from CMake

* [wxwidgets] Provide usage information

* [gppanel] Use built-in CMake module

* [wxchartdir] Use built-in CMake module

* [wxwidgets] Fixup for applocal-ing

* [wxwidgets] Fix osx builds

* Update port_versions

* [gppanel][wxchartdir][wxwidgets] Change versioning schemas

Co-authored-by: Robert Schumacher <roschuma@microsoft.com>
Co-authored-by: NancyLi1013 <lirui09@beyondsoft.com>
wangqr added a commit to wangqr/Aegisub that referenced this issue Apr 2, 2021
@fedapo
Copy link
Contributor

fedapo commented Sep 3, 2021

This issue seems closed as of today, but I can't still build a basic wxWidgets project with CMake under Linux. Just for the record, the same CMake project builds ok when using the wxWidgets libraries from the Linux distro (Ubuntu 20.04) instead of vcpkg. The only catch is that this line is required in CMakeLists.txt:

include(${wxWidgets_USE_FILE})

This is not indicated in the message provided at the end of the installation of wxWidgets in vcpkg, which reads:

> ./vcpkg install wxwidgets

...

The package wxwidgets provides CMake integration:

    find_package(wxWidgets REQUIRED)
    target_include_directories(main PRIVATE ${wxWidgets_INCLUDE_DIRS})
    target_link_libraries(main PRIVATE ${wxWidgets_LIBRARIES})

@midrare
Copy link

midrare commented Jul 22, 2022

A note for those who are stuck: make sure your CMake build matches the --triplet you used when you ran vcpkg install wxwidgets.

@dg0yt
Copy link
Contributor

dg0yt commented Jul 22, 2022

A note for those who are stuck: make sure your CMake build matches the --triplet you used when you ran vcpkg install wxwidgets.

This goes without saying, unrelated to wxWidgets.

There have been significant improvements in the past months, including basic CI testing of find_package(wxWidgets).
However, linux support is still incomplete, due to lack of gtk3 in vcpkg (and lack of gtk4 support in wxWidgets).

@EvanBalster
Copy link

Running into this same issue. CMake isn't able to locate a x64-windows-static build of wxWidgets while configuring a Visual Studio x64 project.

@drinkitup777 A note for those who are stuck: make sure your CMake build matches the --triplet you used when you ran vcpkg install wxwidgets.

I'm building a small executable utility so I don't know how I can match the -static part of the triplet other than declaring set(wxWidgets_STATIC ON) before find_package(wxWidgets ...

@dg0yt
Copy link
Contributor

dg0yt commented Jul 28, 2022

@EvanBalster Please open a new new issue, following the current issue templates. There is just too much change in wxwidgets between 2018 and 2022. Again: CMake usage (from a user perspective) is tested in vcpkg CI.

@BunnySakura
Copy link

The present of September 2022

  • English
    The problem has been solved, but there seems to be a small problem. Especially on VS 2022, you need to manually configure VCPKG_TARGET_TRIPLET to correspond to the platform information, such as x64-windows-static.

  • 中文
    这个问题已经解决了,但是瞅着似乎还有一点小问题。尤其是在VS 2022上,需要手动配置一下VCPKG_TARGET_TRIPLET,改为对应平台信息,例如x64-windows-static

azure-sdk added a commit to azure-sdk/vcpkg that referenced this issue Jan 11, 2024
## 1.11.0 (2024-01-11)

### Features Added

- Added 'OPTIONS' HTTP method to `Azure::Core::Http::HttpMethod` enum.
- Added TLS 1.3 support to WinHTTP transport.
- Environment Log Level Listener now logs the ThreadID for the thread originating the trace.
- [[microsoft#4983]](Azure/azure-sdk-for-cpp#4983) Added support for setting `CURLOPT_CAPATH` libcurl option on Linux. (A community contribution, courtesy of _[phoebusm](https://github.com/phoebusm)_)

### Bugs Fixed

- [[microsoft#5172]](Azure/azure-sdk-for-cpp#5172) `Azure::Nullable::Emplace()` does not set `HasValue()` to `true`.
- [[microsoft#5130]](Azure/azure-sdk-for-cpp#5130) `Url::AppendPath()` and `Url::SetPath()` may end up with a double slash at the beginning of a path.
- [[microsoft#5007]](Azure/azure-sdk-for-cpp#5007) Some versions of GCC no longer include stdint.h in cstdint.

### Other Changes

- [[microsoft#4756]] (Azure/azure-sdk-for-cpp#4756) `BearerTokenAuthenticationPolicy` now uses shared mutex lock for read operations.

### Acknowledgments

Thank you to our developer community members who helped to make Azure Core better with their contributions to this release:

- Phoebus Mak _([GitHub](https://github.com/phoebusm))_
JavierMatosD pushed a commit that referenced this issue Jan 12, 2024
* [azure-messaging-eventhubs-cpp] Update to 1.0.0-beta.5
## 1.0.0-beta.5 (2024-01-11)

### Breaking Changes

- EventHub `ConsumerClient` and `ProcessorClient` objects now return pointers to `EventData` objects instead of `EventData` objects by value.

* [azure-core-amqp-cpp] Update to 1.0.0-beta.6
## 1.0.0-beta.6 (2024-01-11)

### Features Added

- AMQP Value reference counts are now atomic, this fixes several AMQP related crashes.

### Breaking Changes

- `MessageReceiver` returns a pointer to the received message instead of a copy.

### Bugs Fixed

- Fixed several memory leaks.
- AMQP Link Credits now work as expected.
- Integrated the fix for NVD - CVE-2024-21646.

* [azure-core-cpp] Update to 1.11.0
## 1.11.0 (2024-01-11)

### Features Added

- Added 'OPTIONS' HTTP method to `Azure::Core::Http::HttpMethod` enum.
- Added TLS 1.3 support to WinHTTP transport.
- Environment Log Level Listener now logs the ThreadID for the thread originating the trace.
- [[#4983]](Azure/azure-sdk-for-cpp#4983) Added support for setting `CURLOPT_CAPATH` libcurl option on Linux. (A community contribution, courtesy of _[phoebusm](https://github.com/phoebusm)_)

### Bugs Fixed

- [[#5172]](Azure/azure-sdk-for-cpp#5172) `Azure::Nullable::Emplace()` does not set `HasValue()` to `true`.
- [[#5130]](Azure/azure-sdk-for-cpp#5130) `Url::AppendPath()` and `Url::SetPath()` may end up with a double slash at the beginning of a path.
- [[#5007]](Azure/azure-sdk-for-cpp#5007) Some versions of GCC no longer include stdint.h in cstdint.

### Other Changes

- [[#4756]] (Azure/azure-sdk-for-cpp#4756) `BearerTokenAuthenticationPolicy` now uses shared mutex lock for read operations.

### Acknowledgments

Thank you to our developer community members who helped to make Azure Core better with their contributions to this release:

- Phoebus Mak _([GitHub](https://github.com/phoebusm))_
Osyotr pushed a commit to Osyotr/vcpkg that referenced this issue Jan 23, 2024
* [azure-messaging-eventhubs-cpp] Update to 1.0.0-beta.5
## 1.0.0-beta.5 (2024-01-11)

### Breaking Changes

- EventHub `ConsumerClient` and `ProcessorClient` objects now return pointers to `EventData` objects instead of `EventData` objects by value.

* [azure-core-amqp-cpp] Update to 1.0.0-beta.6
## 1.0.0-beta.6 (2024-01-11)

### Features Added

- AMQP Value reference counts are now atomic, this fixes several AMQP related crashes.

### Breaking Changes

- `MessageReceiver` returns a pointer to the received message instead of a copy.

### Bugs Fixed

- Fixed several memory leaks.
- AMQP Link Credits now work as expected.
- Integrated the fix for NVD - CVE-2024-21646.

* [azure-core-cpp] Update to 1.11.0
## 1.11.0 (2024-01-11)

### Features Added

- Added 'OPTIONS' HTTP method to `Azure::Core::Http::HttpMethod` enum.
- Added TLS 1.3 support to WinHTTP transport.
- Environment Log Level Listener now logs the ThreadID for the thread originating the trace.
- [[microsoft#4983]](Azure/azure-sdk-for-cpp#4983) Added support for setting `CURLOPT_CAPATH` libcurl option on Linux. (A community contribution, courtesy of _[phoebusm](https://github.com/phoebusm)_)

### Bugs Fixed

- [[microsoft#5172]](Azure/azure-sdk-for-cpp#5172) `Azure::Nullable::Emplace()` does not set `HasValue()` to `true`.
- [[microsoft#5130]](Azure/azure-sdk-for-cpp#5130) `Url::AppendPath()` and `Url::SetPath()` may end up with a double slash at the beginning of a path.
- [[microsoft#5007]](Azure/azure-sdk-for-cpp#5007) Some versions of GCC no longer include stdint.h in cstdint.

### Other Changes

- [[microsoft#4756]] (Azure/azure-sdk-for-cpp#4756) `BearerTokenAuthenticationPolicy` now uses shared mutex lock for read operations.

### Acknowledgments

Thank you to our developer community members who helped to make Azure Core better with their contributions to this release:

- Phoebus Mak _([GitHub](https://github.com/phoebusm))_
TomKatom pushed a commit to TomKatom/vcpkg that referenced this issue Feb 23, 2024
* [azure-messaging-eventhubs-cpp] Update to 1.0.0-beta.5
## 1.0.0-beta.5 (2024-01-11)

### Breaking Changes

- EventHub `ConsumerClient` and `ProcessorClient` objects now return pointers to `EventData` objects instead of `EventData` objects by value.

* [azure-core-amqp-cpp] Update to 1.0.0-beta.6
## 1.0.0-beta.6 (2024-01-11)

### Features Added

- AMQP Value reference counts are now atomic, this fixes several AMQP related crashes.

### Breaking Changes

- `MessageReceiver` returns a pointer to the received message instead of a copy.

### Bugs Fixed

- Fixed several memory leaks.
- AMQP Link Credits now work as expected.
- Integrated the fix for NVD - CVE-2024-21646.

* [azure-core-cpp] Update to 1.11.0
## 1.11.0 (2024-01-11)

### Features Added

- Added 'OPTIONS' HTTP method to `Azure::Core::Http::HttpMethod` enum.
- Added TLS 1.3 support to WinHTTP transport.
- Environment Log Level Listener now logs the ThreadID for the thread originating the trace.
- [[microsoft#4983]](Azure/azure-sdk-for-cpp#4983) Added support for setting `CURLOPT_CAPATH` libcurl option on Linux. (A community contribution, courtesy of _[phoebusm](https://github.com/phoebusm)_)

### Bugs Fixed

- [[microsoft#5172]](Azure/azure-sdk-for-cpp#5172) `Azure::Nullable::Emplace()` does not set `HasValue()` to `true`.
- [[microsoft#5130]](Azure/azure-sdk-for-cpp#5130) `Url::AppendPath()` and `Url::SetPath()` may end up with a double slash at the beginning of a path.
- [[microsoft#5007]](Azure/azure-sdk-for-cpp#5007) Some versions of GCC no longer include stdint.h in cstdint.

### Other Changes

- [[microsoft#4756]] (Azure/azure-sdk-for-cpp#4756) `BearerTokenAuthenticationPolicy` now uses shared mutex lock for read operations.

### Acknowledgments

Thank you to our developer community members who helped to make Azure Core better with their contributions to this release:

- Phoebus Mak _([GitHub](https://github.com/phoebusm))_
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:port-feature The issue is with a library, which is requesting new capabilities that didn’t exist
Projects
None yet
Development

Successfully merging a pull request may close this issue.