Toolchain-mingw.cmake 968 B

123456789101112131415161718192021222324
  1. # Usage:
  2. # cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-mingw.cmake
  3. # the name of the target operating system
  4. SET(CMAKE_SYSTEM_NAME Windows)
  5. # which compilers to use for C and C++
  6. SET(CMAKE_C_COMPILER i686-w64-mingw32-gcc-posix)
  7. SET(CMAKE_CXX_COMPILER i686-w64-mingw32-g++-posix)
  8. SET(CMAKE_RC_COMPILER i686-w64-mingw32-windres)
  9. # figure out folder to look in
  10. execute_process(COMMAND sh -c "ls /usr/lib/gcc/i686-w64-mingw32/ | grep posix | tr -d '\n'" OUTPUT_VARIABLE MINGW_DEPS_FOLDER)
  11. # here is the target environment located
  12. SET(CMAKE_FIND_ROOT_PATH /usr/i686-w64-mingw32 /usr/lib/gcc/i686-w64-mingw32/${MINGW_DEPS_FOLDER}/ ${PROJECT_SOURCE_DIR}/dependencies)
  13. # adjust the default behaviour of the FIND_XXX() commands:
  14. # search headers and libraries in the target environment, search
  15. # programs in the host environment
  16. set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
  17. set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ALWAYS)
  18. set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)