Toolchain-mingw32-Linux.cmake 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. # Usage:
  2. #
  3. # For 32-bit:
  4. #
  5. # cmake -DCMAKE_TOOLCHAIN_FILE="../cmake/Toolchain-mingw32-Linux.cmake" ..
  6. # make sagui install/strip
  7. #
  8. # For 64-bit:
  9. #
  10. # cmake -DMINGW64=ON -DCMAKE_TOOLCHAIN_FILE="../cmake/Toolchain-mingw32-Linux.cmake" ..
  11. # make sagui install/strip
  12. # _
  13. # ___ __ _ __ _ _ _(_)
  14. # / __|/ _` |/ _` | | | | |
  15. # \__ \ (_| | (_| | |_| | |
  16. # |___/\__,_|\__, |\__,_|_|
  17. # |___/
  18. #
  19. # Cross-platform library which helps to develop web servers or frameworks.
  20. #
  21. # Copyright (C) 2016-2019 Silvio Clecio <[email protected]>
  22. #
  23. # Sagui library is free software; you can redistribute it and/or
  24. # modify it under the terms of the GNU Lesser General Public
  25. # License as published by the Free Software Foundation; either
  26. # version 2.1 of the License, or (at your option) any later version.
  27. #
  28. # Sagui library is distributed in the hope that it will be useful,
  29. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  30. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  31. # Lesser General Public License for more details.
  32. #
  33. # You should have received a copy of the GNU Lesser General Public
  34. # License along with Sagui library; if not, write to the Free Software
  35. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  36. #
  37. if(__SG_TOOLCHAIN_MINGW32_LINUX_INCLUDED)
  38. return()
  39. endif()
  40. set(__SG_TOOLCHAIN_MINGW32_LINUX_INCLUDED ON)
  41. if(NOT DEFINED SG_USE_OUTPUT_PREFIX)
  42. set(SG_USE_OUTPUT_PREFIX ON)
  43. endif()
  44. if(MINGW64)
  45. set(MINGW_PREFIX "x86_64-w64-mingw32")
  46. elseif(NOT MINGW_PREFIX)
  47. set(MINGW_PREFIX "i686-w64-mingw32")
  48. endif()
  49. set(CMAKE_SYSTEM_NAME Windows)
  50. if(NOT CMAKE_C_COMPILER)
  51. set(CMAKE_C_COMPILER ${MINGW_PREFIX}-gcc)
  52. endif()
  53. if(NOT CMAKE_RC_COMPILER)
  54. set(CMAKE_RC_COMPILER ${MINGW_PREFIX}-windres)
  55. endif()
  56. if(NOT CMAKE_FIND_ROOT_PATH)
  57. set(_tmp_dir /usr/${MINGW_PREFIX}/sys-root/mingw)
  58. if(EXISTS ${_tmp_dir})
  59. set(CMAKE_FIND_ROOT_PATH ${_tmp_dir})
  60. else()
  61. set(CMAKE_FIND_ROOT_PATH /usr/${MINGW_PREFIX})
  62. endif()
  63. unset(_tmp_dir)
  64. endif()
  65. set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
  66. set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
  67. set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)