rlm@0: # Cross-compiling requires CMake 2.6 or newer. To use it from build/, call it rlm@0: # like this: rlm@0: # cmake .. -DCMAKE_TOOLCHAIN_FILE=../XCompile.txt -DHOST=i686-pc-mingw32 rlm@0: # Where 'i686-pc-mingw32' is the host prefix for your cross-compiler. If you rlm@0: # already have a toolchain file setup, you may use that instead of this file. rlm@0: rlm@0: # the name of the target operating system rlm@0: SET(CMAKE_SYSTEM_NAME Windows) rlm@0: rlm@0: # which compilers to use for C and C++ rlm@0: SET(CMAKE_C_COMPILER "${HOST}-gcc") rlm@0: SET(CMAKE_CXX_COMPILER "${HOST}-g++") rlm@0: rlm@0: # here is the target environment located rlm@0: SET(CMAKE_FIND_ROOT_PATH "/usr/${HOST}") rlm@0: rlm@0: # here is where stuff gets installed to rlm@0: SET(CMAKE_INSTALL_PREFIX "${CMAKE_FIND_ROOT_PATH}/usr" CACHE STRING "Install path prefix, prepended onto install directories." FORCE) rlm@0: rlm@0: # adjust the default behaviour of the FIND_XXX() commands: rlm@0: # search headers and libraries in the target environment, search rlm@0: # programs in the host environment rlm@0: set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) rlm@0: set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) rlm@0: set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) rlm@0: rlm@0: # set env vars so that pkg-config will look in the appropriate directory for rlm@0: # .pc files (as there seems to be no way to force using ${HOST}-pkg-config) rlm@0: set(ENV{PKG_CONFIG_LIBDIR} "${CMAKE_INSTALL_PREFIX}/lib/pkgconfig") rlm@0: set(ENV{PKG_CONFIG_PATH} "")