Main Lemma Repository
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Mingw-Cross.cmake 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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. option (CMAKE_CROSSCOMPILING "Target different arch than you are on" ON)
  11. SET(CMAKE_CROSSCOMPILING ON)
  12. # cross compilers to use for C and C++
  13. set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc)
  14. set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++)
  15. set(CMAKE_RC_COMPILER ${TOOLCHAIN_PREFIX}-windres)
  16. # target environment on the build host system
  17. # set 1st to dir with the cross compiler's C/C++ headers/libs
  18. set(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX})
  19. # modify default behavior of FIND_XXX() commands to
  20. # search for headers/libs in the target environment and
  21. # search for programs in the build host environment
  22. set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER )
  23. set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
  24. set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )
  25. set( CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY )
  26. set( CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "" )
  27. set( CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "" )
  28. #set_target_properties(icarus PROPERTIES LINK_SEARCH_START_STATIC 1)
  29. #set_target_properties(icarus PROPERTIES LINK_SEARCH_END_STATIC 1)
  30. #set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
  31. #Static Libs
  32. #Set Linker flags
  33. set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++")