CPackZIP.cmake 986 B

123456789101112131415161718192021222324252627282930
  1. # Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. # file Copyright.txt or https://cmake.org/licensing for details.
  3. if(CMAKE_BINARY_DIR)
  4. message(FATAL_ERROR "CPackZIP.cmake may only be used by CPack internally.")
  5. endif()
  6. find_program(ZIP_EXECUTABLE wzzip PATHS "$ENV{ProgramFiles}/WinZip")
  7. if(ZIP_EXECUTABLE)
  8. set(CPACK_ZIP_COMMAND "\"${ZIP_EXECUTABLE}\" -P \"<ARCHIVE>\" @<FILELIST>")
  9. set(CPACK_ZIP_NEED_QUOTES TRUE)
  10. endif()
  11. if(NOT ZIP_EXECUTABLE)
  12. find_program(ZIP_EXECUTABLE 7z PATHS "$ENV{ProgramFiles}/7-Zip")
  13. if(ZIP_EXECUTABLE)
  14. set(CPACK_ZIP_COMMAND "\"${ZIP_EXECUTABLE}\" a -tzip \"<ARCHIVE>\" @<FILELIST>")
  15. set(CPACK_ZIP_NEED_QUOTES TRUE)
  16. endif()
  17. endif()
  18. if(NOT ZIP_EXECUTABLE)
  19. find_package(Cygwin)
  20. find_program(ZIP_EXECUTABLE zip PATHS "${CYGWIN_INSTALL_PATH}/bin")
  21. if(ZIP_EXECUTABLE)
  22. set(CPACK_ZIP_COMMAND "\"${ZIP_EXECUTABLE}\" -r \"<ARCHIVE>\" . -i@<FILELIST>")
  23. set(CPACK_ZIP_NEED_QUOTES FALSE)
  24. endif()
  25. endif()