Toolchain-mingw32.cmake 1.3 KB

1234567891011121314151617181920212223242526272829
  1. # the name of the target operating system
  2. set(CMAKE_SYSTEM_NAME Windows)
  3. #remove the runtime dependency for libgcc_s_sjlj-1.dll
  4. set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-libgcc")
  5. # You can get a MinGW environment using the script at <http://mxe.cc>.
  6. # It downloads and builds MinGW and most of the dependencies for you.
  7. # You can use the toolchain file generated by MXE called `mxe-conf.cmake'
  8. # or you can use this file by adjusting the above and following paths.
  9. set(CMAKE_C_COMPILER i686-pc-mingw32-gcc)
  10. set(CMAKE_CXX_COMPILER i686-pc-mingw32-g++)
  11. set(CMAKE_RC_COMPILER i686-pc-mingw32-windres)
  12. set(CMAKE_FIND_ROOT_PATH i686-pc-mingw32)
  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 ONLY)
  18. set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
  19. # Tell pkg-config not to look at the target environment's .pc files.
  20. # Setting PKG_CONFIG_LIBDIR sets the default search directory, but we have to
  21. # set PKG_CONFIG_PATH as well to prevent pkg-config falling back to the host's
  22. # path.
  23. set(ENV{PKG_CONFIG_LIBDIR} ${CMAKE_FIND_ROOT_PATH}/lib/pkgconfig)
  24. set(ENV{PKG_CONFIG_PATH} ${CMAKE_FIND_ROOT_PATH}/lib/pkgconfig)
  25. set(ENV{MINGDIR} ${CMAKE_FIND_ROOT_PATH})