how can I write a cmake config that can do "findpackage(wxWidgets)" in a way that should…
- User
how can I write a cmake config that can do "find_package(wxWidgets)" in a way that should be able to handle non-monolithic and monolithic builds of wxWidgets whichever is installed. I am doing it as:
find_package(wxWidgets QUIET CONFIG COMPONENTS # try to load non-monolithic build. 'QUIET' makes sure failure is non-fatal base net core adv aui html propgrid ribbon richtext stc xrc gl qa xml webview) if(NOT wxWidgets_FOUND) # non-monolithic build failed to load, so try monolithic find_package(wxWidgets REQUIRED CONFIG COMPONENTS mono) endif()
On a system with a monolithic build installed I get an error: add_library cannot create ALIAS target "wx::mono" because another target with the same name already exists. The first call to find_package defined wx::mono alias and then fails. How can I sort it out?
- Assistant
The error you're experiencing arises because the first call to is defining some CMake targets (like ), even if it fails to find the non-monolithic build. When you call the second time for the monolithic build, it tries to create the same targets again, leading to the "add_library cannot create ALIAS target" error.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.