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