diff --git a/CMakeLists.txt b/CMakeLists.txt index 6c471ece71..43f283d8f7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,8 +6,13 @@ list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake") # Prefer our bundled versions of dependencies. set(DEPS_PREFIX "${CMAKE_CURRENT_SOURCE_DIR}/.deps/usr" CACHE PATH "Path prefix for finding dependencies") -list(INSERT CMAKE_PREFIX_PATH 0 ${DEPS_PREFIX}) -set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:${DEPS_PREFIX}/lib/pkgconfig") +if(CMAKE_CROSSCOMPILING AND NOT UNIX) + list(INSERT CMAKE_FIND_ROOT_PATH 0 ${DEPS_PREFIX}) + list(INSERT CMAKE_PREFIX_PATH 0 ${DEPS_PREFIX}/../host/bin) +else() + list(INSERT CMAKE_PREFIX_PATH 0 ${DEPS_PREFIX}) + set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:${DEPS_PREFIX}/lib/pkgconfig") +endif() # used for check_c_compiler_flag include(CheckCCompilerFlag)