BuildGettext.cmake 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. if(MSVC)
  2. ExternalProject_Add(gettext
  3. PREFIX ${DEPS_BUILD_DIR}
  4. URL ${GETTEXT_URL}
  5. DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/gettext
  6. DOWNLOAD_COMMAND ${CMAKE_COMMAND}
  7. -DPREFIX=${DEPS_BUILD_DIR}
  8. -DDOWNLOAD_DIR=${DEPS_DOWNLOAD_DIR}/gettext
  9. -DURL=${GETTEXT_URL}
  10. -DEXPECTED_SHA256=${GETTEXT_SHA256}
  11. -DTARGET=gettext
  12. -DUSE_EXISTING_SRC_DIR=${USE_EXISTING_SRC_DIR}
  13. -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/DownloadAndExtractFile.cmake
  14. PATCH_COMMAND ${GIT_EXECUTABLE} -C ${DEPS_BUILD_DIR}/src/gettext init
  15. COMMAND ${GIT_EXECUTABLE} -C ${DEPS_BUILD_DIR}/src/gettext apply --ignore-whitespace
  16. ${CMAKE_CURRENT_SOURCE_DIR}/patches/gettext-Fix-compilation-on-a-system-without-alloca.patch
  17. ${CMAKE_CURRENT_SOURCE_DIR}/patches/gettext-Fix-building-with-MSVC.patch
  18. CONFIGURE_COMMAND ${CMAKE_COMMAND} -E copy
  19. ${CMAKE_CURRENT_SOURCE_DIR}/cmake/GettextCMakeLists.txt
  20. ${DEPS_BUILD_DIR}/src/gettext/CMakeLists.txt
  21. COMMAND ${CMAKE_COMMAND} ${DEPS_BUILD_DIR}/src/gettext
  22. -DCMAKE_INSTALL_PREFIX=${DEPS_INSTALL_DIR}
  23. # Pass toolchain
  24. -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN}
  25. -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
  26. -DCMAKE_GENERATOR=${CMAKE_GENERATOR}
  27. -DLIBICONV_INCLUDE_DIRS=${DEPS_INSTALL_DIR}/include
  28. -DLIBICONV_LIBRARIES=${DEPS_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}libcharset${CMAKE_STATIC_LIBRARY_SUFFIX}$<SEMICOLON>${DEPS_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}libiconv${CMAKE_STATIC_LIBRARY_SUFFIX}
  29. BUILD_COMMAND ${CMAKE_COMMAND} --build . --config ${CMAKE_BUILD_TYPE}
  30. INSTALL_COMMAND ${CMAKE_COMMAND} --build . --target install --config ${CMAKE_BUILD_TYPE})
  31. else()
  32. message(FATAL_ERROR "Trying to build gettext in an unsupported system ${CMAKE_SYSTEM_NAME}/${CMAKE_C_COMPILER_ID}")
  33. endif()
  34. list(APPEND THIRD_PARTY_DEPS gettext)
  35. if(USE_BUNDLED_LIBICONV)
  36. add_dependencies(gettext libiconv)
  37. endif()