CMAKE_PREFIX_PATH option doesn't work
Ghabry opened this issue · 7 comments
In my build system I have the Wii(U) libraries outside of the ${DEVKITPPC} folder and want to specify the folder via -DCMAKE_PREFIX_PATH, but line 44 in wut-toolchain.cmake hardcodes a CMAKE_FIND_ROOT_PATH, so the PREFIX_PATH doesn't work anymore (because the ROOT_PATH is prefixed to the PREFIX_PATH I guess?).
Looks like CMAKE_PREFIX_PATH is the newer option.
No idea how to properly fix this, maybe use CMAKE_PREFIX_PATH and APPEND?
Not sure if this will help, but I was able to get a CMake WUT project to link with the devkitPro PowerPC portlibs by adding the following to my CMakeLists.txt file, underneath my project declaration:
include_directories(include $ENV{DEVKITPRO}/portlibs/ppc/include)
set(CMAKE_LIBRARY_PATH $ENV{DEVKITPRO}/portlibs/ppc/lib)
The WUT toolchain automatically detects if these are used and adds these to WUT's predefined paths.
thanks, this seems to work however I would prefer if the standard CMake way is supported.
I can't really see the purpose of
set(CMAKE_FIND_ROOT_PATH ${DEVKITPPC})
when I delete this everything still works including the -DCMAKE_PREFIX_PATH.
I think the point of using CMAKE_FIND_ROOT_PATH was to stop CMake from looking into your library paths where there could be libs which are not designed for the toolchain you're targeting - your default lib path is going to have be full of x64 libs, not only the ones for PPC.
CMake docs seem to support this idea by mentioning cross-compiling: https://cmake.org/cmake/help/v3.0/variable/CMAKE_FIND_ROOT_PATH.html
Yeah, I know that this is the purpose. By further reading through the docs I think CMAKE_PREFIX_PATH is appended to CMAKE_FIND_ROOT_PATH.
Untested, but by replacing the line with
list(APPEND CMAKE_FIND_ROOT_PATH ${DEVKITPPC})
everything should work as expected (and I simply pass my library path via -DCMAKE_FIND_ROOT_PATH instead of PREFIX_PATH)
EDIT:
Just looked at vitasdk. They do
set( CMAKE_FIND_ROOT_PATH "${VITASDK}/bin" "${VITASDK}/arm-vita-eabi" "${CMAKE_INSTALL_PREFIX}" "${CMAKE_INSTALL_PREFIX}/share" )
set( CMAKE_INSTALL_PREFIX "${VITASDK}/arm-vita-eabi" CACHE PATH "default install path" )
Explicitly adding CMAKE_INSTALL_PREFIX to CMAKE_FIND_ROOT_PATH sounds like a solution, too. 👍
Fixed in the rewrite branch. https://github.com/decaf-emu/wut/blob/rewrite/share/wut.toolchain.cmake#L37
Please don't necrobump issues with broken links. If you have an issue you need help with then please ask on the devkitPro forums or raise a new issue.
Unfortunately attempting to research and solve your problem by yourself will most likely lead to further problems due to following poor advice.