Imported Upstream version 2.8.10.2
[platform/upstream/cmake.git] / Modules / FindSelfPackers.cmake
1 # - Find upx
2 # This module looks for some executable packers (i.e. software that
3 # compress executables or shared libs into on-the-fly self-extracting
4 # executables or shared libs.
5 # Examples:
6 #  UPX: http://wildsau.idv.uni-linz.ac.at/mfx/upx.html
7
8 #=============================================================================
9 # Copyright 2001-2009 Kitware, Inc.
10 #
11 # Distributed under the OSI-approved BSD License (the "License");
12 # see accompanying file Copyright.txt for details.
13 #
14 # This software is distributed WITHOUT ANY WARRANTY; without even the
15 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16 # See the License for more information.
17 #=============================================================================
18 # (To distribute this file outside of CMake, substitute the full
19 #  License text for the above reference.)
20
21 include(FindCygwin)
22
23 find_program(SELF_PACKER_FOR_EXECUTABLE
24   upx
25   ${CYGWIN_INSTALL_PATH}/bin
26   /bin
27   /usr/bin
28   /usr/local/bin
29   /sbin
30 )
31
32 find_program(SELF_PACKER_FOR_SHARED_LIB
33   upx
34   ${CYGWIN_INSTALL_PATH}/bin
35   /bin
36   /usr/bin
37   /usr/local/bin
38   /sbin
39 )
40
41 mark_as_advanced(
42   SELF_PACKER_FOR_EXECUTABLE
43   SELF_PACKER_FOR_SHARED_LIB
44 )
45
46 #
47 # Set flags
48 #
49 if (SELF_PACKER_FOR_EXECUTABLE MATCHES "upx")
50   set (SELF_PACKER_FOR_EXECUTABLE_FLAGS "-q" CACHE STRING
51        "Flags for the executable self-packer.")
52 else ()
53   set (SELF_PACKER_FOR_EXECUTABLE_FLAGS "" CACHE STRING
54        "Flags for the executable self-packer.")
55 endif ()
56
57 if (SELF_PACKER_FOR_SHARED_LIB MATCHES "upx")
58   set (SELF_PACKER_FOR_SHARED_LIB_FLAGS "-q" CACHE STRING
59        "Flags for the shared lib self-packer.")
60 else ()
61   set (SELF_PACKER_FOR_SHARED_LIB_FLAGS "" CACHE STRING
62        "Flags for the shared lib self-packer.")
63 endif ()
64
65 mark_as_advanced(
66   SELF_PACKER_FOR_EXECUTABLE_FLAGS
67   SELF_PACKER_FOR_SHARED_LIB_FLAGS
68 )