CPackZIP.cmake 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #=============================================================================
  2. # Copyright 2007-2009 Kitware, Inc.
  3. #
  4. # Distributed under the OSI-approved BSD License (the "License");
  5. # see accompanying file Copyright.txt for details.
  6. #
  7. # This software is distributed WITHOUT ANY WARRANTY; without even the
  8. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  9. # See the License for more information.
  10. #=============================================================================
  11. # (To distribute this file outside of CMake, substitute the full
  12. # License text for the above reference.)
  13. if(CMAKE_BINARY_DIR)
  14. message(FATAL_ERROR "CPackZIP.cmake may only be used by CPack internally.")
  15. endif()
  16. find_program(ZIP_EXECUTABLE wzzip PATHS "$ENV{ProgramFiles}/WinZip")
  17. if(ZIP_EXECUTABLE)
  18. set(CPACK_ZIP_COMMAND "\"${ZIP_EXECUTABLE}\" -P \"<ARCHIVE>\" @<FILELIST>")
  19. set(CPACK_ZIP_NEED_QUOTES TRUE)
  20. endif()
  21. if(NOT ZIP_EXECUTABLE)
  22. find_program(ZIP_EXECUTABLE 7z PATHS "$ENV{ProgramFiles}/7-Zip")
  23. if(ZIP_EXECUTABLE)
  24. set(CPACK_ZIP_COMMAND "\"${ZIP_EXECUTABLE}\" a -tzip \"<ARCHIVE>\" @<FILELIST>")
  25. set(CPACK_ZIP_NEED_QUOTES TRUE)
  26. endif()
  27. endif()
  28. if(NOT ZIP_EXECUTABLE)
  29. find_package(Cygwin)
  30. find_program(ZIP_EXECUTABLE zip PATHS "${CYGWIN_INSTALL_PATH}/bin")
  31. if(ZIP_EXECUTABLE)
  32. set(CPACK_ZIP_COMMAND "\"${ZIP_EXECUTABLE}\" -r \"<ARCHIVE>\" . -i@<FILELIST>")
  33. set(CPACK_ZIP_NEED_QUOTES FALSE)
  34. endif()
  35. endif()