wxWidgets installed in a custom folder like C:\Users\abc\AppData\Local\Programs\installed_libs. CMAKE_PREFIX_PATH not set
only -DCMAKE_INSTALL_PREFIX=C:\Users\abc\AppData\Local\Programs\installed_libs
As a result, wxWidgets is found, C:\Users\abc\AppData\Local\Programs\installed_libs has not been referenced anywhere else
If -DCMAKE_INSTALL_PREFIX=C:\Users\abc\AppData\Local\Programs\installed_libs
changes to -DCMAKE_INSTALL_PREFIX=C:\Users\abc\AppData\Local\Programs\installed_libs111,
it fails to find wxWidgets, so find_package finds in CMAKE_INSTALL_PREFIX definitely, but not documented.
The --prefix argument to cmake --install is generally the best way to set an installation prefix because it lets you decouple install-time requirements from your configuration logic.
I think the fact that CMAKE_INSTALL_PREFIX affects configure-time logic just reinforces that position.
Usually you (or at least consumers of your project!) really want to directly manipulate CMAKE_PREFIX_PATH or CMAKE_SYSTEM_PREFIX_PATH to alter configure-time logic. Ideally in a mechanism like a CMake toolchain file of maybe a CMake preset to keep your logic consistent, reusable, and tidy. As an aside, pretty much every time CMakeLists.txt or reusable CMake modules start manipulating these variables, they lose portability, gain complexity, or both.
Anyway, CMAKE_INSTALL_PREFIX seems to mostly work a lot of the time, but I’m currently convinced that it has been sufficiently surpassed by other mechanisms at this point to just stop using it full-stop. I’d be curious if there are edge cases that challenge that advice.