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

CMake wx-config not present on mingw-cross. #24454

Open
sinetek opened this issue Apr 4, 2024 · 3 comments
Open

CMake wx-config not present on mingw-cross. #24454

sinetek opened this issue Apr 4, 2024 · 3 comments
Labels
build Any build issue (with or without CMake)

Comments

@sinetek
Copy link

sinetek commented Apr 4, 2024

Hello again (#24451 ), I found a bug in the build system when cross compiling wx, it will not produce a wx-config like is expected.
I think we should always try to produce this file if on mingw, since mingw is a unix-like and everything fails to build without this file. On ./configure the wx-config is produced properly, which is what MSYS2 does.

Anyway, look at this:

build/cmake/functions.cmake

# Use the MSVC/makefile naming convention, or the configure naming convention,
# this is the same check as used in FindwxWidgets.
if(WIN32 AND NOT CYGWIN AND NOT MSYS)
    set(WIN32_MSVC_NAMING 1)
else()
    set(WIN32_MSVC_NAMING 0)
endif()

If we look at CMake.
CMake/Modules/FindwxWidgets.cmake

if(WIN32 AND NOT CYGWIN AND NOT MSYS AND NOT CMAKE_CROSSCOMPILING)
  set(wxWidgets_FIND_STYLE "win32")
else()
  set(wxWidgets_FIND_STYLE "unix")
endif()

Clearly these things are not the same, as claims the comment. The find package then fails because wx-config is not present, nor is the wx-config produced at build time.

@sinetek sinetek added the build Any build issue (with or without CMake) label Apr 4, 2024
@sinetek
Copy link
Author

sinetek commented Apr 4, 2024

It's a bit more that just that. On the FindwxWidgets side, wx-config is picked up correctly, however the _LIBRARIES doesn't set because:

<some path>/cmake/modules/FindwxWidgets.cmake(191): wxWidgets not found due to following missing libraries: kernel32 user32 gdi32 comdlg32 winspool winmm shell32 shlwapi comctl32 ole32 oleaut32 uuid rpcrt4 advapi32 version ws2_32 wininet oleacc uxtheme

Unfortunately I don't know where to proceed from there.
EDIT: The answer is, adjust CMAKE_LIBRARY_PATH so that cmake finds these libraries.

@MaartenBent
Copy link
Contributor

You could try find_package(wxWidgets CONFIG). Then it will use the cmake config files instead of FindwxWidgets.

However, I don't know if these are correct when cross-compiling.

@sinetek
Copy link
Author

sinetek commented Apr 9, 2024

You could try find_package(wxWidgets CONFIG). Then it will use the cmake config files instead of FindwxWidgets.

However, I don't know if these are correct when cross-compiling.

thanks this works well as a solution!

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

2 participants