Toolchain-mingw32.cmake 1.3 KB

1234567891011121314151617181920212223242526
  1. # the name of the target operating system
  2. set(CMAKE_SYSTEM_NAME Windows)
  3. # You can get a MinGW environment using the script at <http://mxe.cc>.
  4. # It downloads and builds MinGW and most of the dependencies for you.
  5. # You can use the toolchain file generated by MXE called `mxe-conf.cmake'
  6. # or you can use this file by adjusting the above and following paths.
  7. set(CMAKE_C_COMPILER /opt/mingw/usr/bin/i686-pc-mingw32-gcc)
  8. set(CMAKE_CXX_COMPILER /opt/mingw/usr/bin/i686-pc-mingw32-g++)
  9. set(CMAKE_RC_COMPILER /opt/mingw/usr/bin/i686-pc-mingw32-windres)
  10. set(CMAKE_FIND_ROOT_PATH /opt/mingw/usr/i686-pc-mingw32)
  11. # Adjust the default behaviour of the FIND_XXX() commands:
  12. # search headers and libraries in the target environment, search
  13. # programs in the host environment
  14. set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
  15. set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
  16. set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
  17. # Tell pkg-config not to look at the target environment's .pc files.
  18. # Setting PKG_CONFIG_LIBDIR sets the default search directory, but we have to
  19. # set PKG_CONFIG_PATH as well to prevent pkg-config falling back to the host's
  20. # path.
  21. set(ENV{PKG_CONFIG_LIBDIR} ${CMAKE_FIND_ROOT_PATH}/lib/pkgconfig)
  22. set(ENV{PKG_CONFIG_PATH} ${CMAKE_FIND_ROOT_PATH}/lib/pkgconfig)
  23. set(ENV{MINGDIR} ${CMAKE_FIND_ROOT_PATH})