Main Lemma Repository
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

Mingw-Cross.cmake 1.1KB

1234567891011121314151617181920212223242526272829303132
  1. # Sample toolchain file for building for Windows from an Ubuntu Linux system.
  2. #
  3. # Typical usage:
  4. # *) install cross compiler: `sudo apt-get install mingw-w64 g++-mingw-w64`
  5. # *) cd build
  6. # *) cmake -DCMAKE_TOOLCHAIN_FILE=~/Mingw-Cross.cmake ..
  7. set(CMAKE_SYSTEM_NAME Windows)
  8. set(CMAKE_SYSTEM Windows)
  9. set(TOOLCHAIN_PREFIX x86_64-w64-mingw32)
  10. SET(CMAKE_CROSSCOMPILING 1)
  11. # cross compilers to use for C and C++
  12. set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc)
  13. set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++)
  14. set(CMAKE_RC_COMPILER ${TOOLCHAIN_PREFIX}-windres)
  15. # target environment on the build host system
  16. # set 1st to dir with the cross compiler's C/C++ headers/libs
  17. set(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX})
  18. # modify default behavior of FIND_XXX() commands to
  19. # search for headers/libs in the target environment and
  20. # search for programs in the build host environment
  21. set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
  22. set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
  23. set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
  24. set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
  25. set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
  26. set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")