MinGW.cmake 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. # This is a CMake toolchain file so we can using Mingw to build Windows32 binaries.
  2. # http://vtk.org/Wiki/CMake_Cross_Compiling
  3. # usage
  4. # cmake -DCMAKE_TOOLCHAIN_FILE=./toolchain-mingw32.cmake ../
  5. set( CMAKE_SYSTEM_NAME Windows )
  6. set( CMAKE_SYSTEM_PROCESSOR $ENV{CMAKE_SYSTEM_PROCESSOR} )
  7. #-----<configuration>-----------------------------------------------
  8. # configure only the lines within this <configure> block, typically
  9. set( TC_PATH /usr/bin )
  10. set( CROSS_COMPILE ${CMAKE_SYSTEM_PROCESSOR}-w64-mingw32- )
  11. # specify the cross compiler
  12. set( CMAKE_C_COMPILER ${TC_PATH}/${CROSS_COMPILE}gcc )
  13. set( CMAKE_CXX_COMPILER ${TC_PATH}/${CROSS_COMPILE}g++ )
  14. set( CMAKE_RC_COMPILER ${TC_PATH}/${CROSS_COMPILE}windres )
  15. # where is the target environment
  16. set( CMAKE_FIND_ROOT_PATH /usr/${CMAKE_SYSTEM_PROCESSOR}-w64-mingw32 )
  17. #-----</configuration>-----------------------------------------------
  18. # search for programs in the build host directories
  19. set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER )
  20. # for libraries and headers in the target directories
  21. set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
  22. set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )
  23. # for Atomic
  24. set( WIN32 1 )
  25. set( MINGW 1 )