FindSelfPackers.cmake 1.48 KB
Newer Older
1 2 3
# Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.

4 5 6 7 8 9 10 11 12 13 14 15 16 17
#[=======================================================================[.rst:
FindSelfPackers
---------------

Find upx

This module looks for some executable packers (i.e.  software that
compress executables or shared libs into on-the-fly self-extracting
executables or shared libs.  Examples:

::

  UPX: http://wildsau.idv.uni-linz.ac.at/mfx/upx.html
#]=======================================================================]
Sebastien Barre's avatar
Sebastien Barre committed
18

19
include(${CMAKE_CURRENT_LIST_DIR}/FindCygwin.cmake)
Sebastien Barre's avatar
Sebastien Barre committed
20

21
find_program(SELF_PACKER_FOR_EXECUTABLE
22 23 24 25
  upx
  ${CYGWIN_INSTALL_PATH}/bin
)

26
find_program(SELF_PACKER_FOR_SHARED_LIB
27 28 29 30
  upx
  ${CYGWIN_INSTALL_PATH}/bin
)

31
mark_as_advanced(
32 33 34
  SELF_PACKER_FOR_EXECUTABLE
  SELF_PACKER_FOR_SHARED_LIB
)
Sebastien Barre's avatar
Sebastien Barre committed
35 36 37 38

#
# Set flags
#
39 40
if (SELF_PACKER_FOR_EXECUTABLE MATCHES "upx")
  set (SELF_PACKER_FOR_EXECUTABLE_FLAGS "-q" CACHE STRING
Sebastien Barre's avatar
Sebastien Barre committed
41
       "Flags for the executable self-packer.")
42
else ()
43
  set (SELF_PACKER_FOR_EXECUTABLE_FLAGS "" CACHE STRING
Sebastien Barre's avatar
Sebastien Barre committed
44
       "Flags for the executable self-packer.")
45
endif ()
Sebastien Barre's avatar
Sebastien Barre committed
46

47 48
if (SELF_PACKER_FOR_SHARED_LIB MATCHES "upx")
  set (SELF_PACKER_FOR_SHARED_LIB_FLAGS "-q" CACHE STRING
Sebastien Barre's avatar
Sebastien Barre committed
49
       "Flags for the shared lib self-packer.")
50
else ()
51
  set (SELF_PACKER_FOR_SHARED_LIB_FLAGS "" CACHE STRING
Sebastien Barre's avatar
Sebastien Barre committed
52
       "Flags for the shared lib self-packer.")
53
endif ()
54

55
mark_as_advanced(
56 57 58
  SELF_PACKER_FOR_EXECUTABLE_FLAGS
  SELF_PACKER_FOR_SHARED_LIB_FLAGS
)