I build wxWidgets and/or my application using:
Full powershell commandline: rm -r -Force cmake ; cmake -B cmake ; cmake --build cmake --parallel
Full log for CMake configure step:
cmake-configure-log.txt
In the CMake configure step, I get an error from CMake Policy CMP0107.
CMake Error at .../vcpkg/scripts/buildsystems/vcpkg.cmake:639 (_add_library):
_add_library cannot create ALIAS target "wx::base" because another target
with the same name already exists.
I use vcpkg to get wxWidget's sources.
In the build/cmake/wxWidgetsConfig.cmake.in file, line 129, with CMP0107 set to NEW my project errors.
This zip folder contains a minimal project example that creates the error (assuming you have an environment variable called VCPKG_ROOT set to where vcpkg is at on your system).
The problem occurs when wxWidgets was found with find_package
's CONFIG
search mode and then target_link_libraries
is called from within a call from add_subdirectory
and also called in the top level CMakeLists.txt.
One work-around I found is to check if the TARGET
exists before attempting to create an alias, like this (from build/cmake/wxWidgetsConfig.cmake.in file, line 129-ish):
... else() if( NOT TARGET wx::${name}) add_library(wx::${name} ALIAS wx::${libname}) endif() endif() ...
Would that be a fix you would consider making to deal with CMP0107? Or maybe there is a better solution? I am by no means a CMake expert.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
Looks like this was fixed recently in PR #25796
Thank you @MaartenBent !
Though I'm not sure how to see which version of wxWidgets this will be available in....
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
Closed #25671 as completed.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
Indeed, for now it is only fixed in the development branch for wx3.3(.2).
But I'll backport CMake improvements to 3.2 as well, before 3.2.9 gets released.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.