CMAKE_INSTALL_PREFIX not searched when CMAKE_FIND_ROOT_PATH is set
CMAKE_FIND_ROOT_PATH is prepended to CMAKE_INSTALL_PREFIX, but libraries are still installed to CMAKE_INSTALL_PREFIX. Therefore, the installed are not found, because find_package only searches CMAKE_FIND_ROOT_PATH/CMAKE_INSTALL_PREFIX.
One work-around is to append CMAKE_INSTALL_PREFIX to CMAKE_FIND_ROOT_PATH, but this is hacky.
I encountered this issue when cross-compiling Boost:
- build and install boost with CMAKE_FIND_ROOT_PATH="some-cross-compile-target-folder" and CMAKE_INSTALL_PREFIX="my-install-folder".
- build another library, that uses find_package(Boost) with CMAKE_FIND_ROOT_PATH="some-cross-compile-target-folder" and CMAKE_INSTALL_PREFIX="my-install-folder"
- boost is not found
Maybe this is just a FindBoost.cmake error?
I am using cmake 3.18.4