BuildLibiconv.cmake 1.3 KB

123456789101112131415161718192021222324252627282930313233
  1. if(MSVC)
  2. ExternalProject_Add(libiconv
  3. PREFIX ${DEPS_BUILD_DIR}
  4. URL ${LIBICONV_URL}
  5. DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/libiconv
  6. DOWNLOAD_COMMAND ${CMAKE_COMMAND}
  7. -DPREFIX=${DEPS_BUILD_DIR}
  8. -DDOWNLOAD_DIR=${DEPS_DOWNLOAD_DIR}/libiconv
  9. -DURL=${LIBICONV_URL}
  10. -DEXPECTED_SHA256=${LIBICONV_SHA256}
  11. -DTARGET=libiconv
  12. -DUSE_EXISTING_SRC_DIR=${USE_EXISTING_SRC_DIR}
  13. -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/DownloadAndExtractFile.cmake
  14. CONFIGURE_COMMAND ${CMAKE_COMMAND} -E copy
  15. ${CMAKE_CURRENT_SOURCE_DIR}/cmake/LibiconvCMakeLists.txt
  16. ${DEPS_BUILD_DIR}/src/libiconv/CMakeLists.txt
  17. COMMAND ${CMAKE_COMMAND} ${DEPS_BUILD_DIR}/src/libiconv
  18. -DCMAKE_INSTALL_PREFIX=${DEPS_INSTALL_DIR}
  19. # Pass toolchain
  20. -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN}
  21. -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
  22. -DCMAKE_GENERATOR=${CMAKE_GENERATOR}
  23. -DCMAKE_GENERATOR_PLATFORM=${CMAKE_GENERATOR_PLATFORM}
  24. BUILD_COMMAND ${CMAKE_COMMAND} --build . --config ${CMAKE_BUILD_TYPE}
  25. INSTALL_COMMAND ${CMAKE_COMMAND} --build . --target install --config ${CMAKE_BUILD_TYPE})
  26. else()
  27. message(FATAL_ERROR "Trying to build libiconv in an unsupported system ${CMAKE_SYSTEM_NAME}/${CMAKE_C_COMPILER_ID}")
  28. endif()
  29. list(APPEND THIRD_PARTY_DEPS libiconv)