zlib.cmake 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. # ***** BEGIN GPL LICENSE BLOCK *****
  2. #
  3. # This program is free software; you can redistribute it and/or
  4. # modify it under the terms of the GNU General Public License
  5. # as published by the Free Software Foundation; either version 2
  6. # of the License, or (at your option) any later version.
  7. #
  8. # This program is distributed in the hope that it will be useful,
  9. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. # GNU General Public License for more details.
  12. #
  13. # You should have received a copy of the GNU General Public License
  14. # along with this program; if not, write to the Free Software Foundation,
  15. # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  16. #
  17. # ***** END GPL LICENSE BLOCK *****
  18. ExternalProject_Add(external_zlib
  19. URL ${ZLIB_URI}
  20. URL_HASH MD5=${ZLIB_HASH}
  21. DOWNLOAD_DIR ${DOWNLOAD_DIR}
  22. PREFIX ${BUILD_DIR}/zlib
  23. CMAKE_ARGS -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=${LIBDIR}/zlib ${DEFAULT_CMAKE_FLAGS}
  24. INSTALL_DIR ${LIBDIR}/zlib
  25. )
  26. if(WIN32)
  27. if(BUILD_MODE STREQUAL Release)
  28. ExternalProject_Add_Step(external_zlib after_install
  29. COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/zlib/lib/zlibstatic${LIBEXT} ${HARVEST_TARGET}/zlib/lib/libz_st${LIBEXT}
  30. COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/zlib/include/ ${HARVEST_TARGET}/zlib/include/
  31. DEPENDEES install
  32. )
  33. endif()
  34. if(BUILD_MODE STREQUAL Debug)
  35. ExternalProject_Add_Step(external_zlib after_install
  36. COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/zlib/lib/zlibstaticd${LIBEXT} ${HARVEST_TARGET}/zlib/lib/libz_st_d${LIBEXT}
  37. DEPENDEES install
  38. )
  39. endif()
  40. else()
  41. ExternalProject_Add_Step(external_zlib after_install
  42. COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/zlib/lib/libz.a ${LIBDIR}/zlib/lib/libz_pic.a
  43. DEPENDEES install
  44. )
  45. endif()