2013-10-15 15:17:36 +00:00
|
|
|
#.rst:
|
|
|
|
# FindSelfPackers
|
|
|
|
# ---------------
|
|
|
|
#
|
|
|
|
# Find upx
|
|
|
|
#
|
|
|
|
# This module looks for some executable packers (i.e. software that
|
2001-11-09 21:15:58 +00:00
|
|
|
# compress executables or shared libs into on-the-fly self-extracting
|
2013-10-15 15:17:36 +00:00
|
|
|
# executables or shared libs. Examples:
|
|
|
|
#
|
|
|
|
# ::
|
|
|
|
#
|
|
|
|
# UPX: http://wildsau.idv.uni-linz.ac.at/mfx/upx.html
|
2001-11-09 21:15:58 +00:00
|
|
|
|
2009-09-28 15:45:50 +00:00
|
|
|
#=============================================================================
|
|
|
|
# Copyright 2001-2009 Kitware, Inc.
|
|
|
|
#
|
|
|
|
# Distributed under the OSI-approved BSD License (the "License");
|
|
|
|
# see accompanying file Copyright.txt for details.
|
|
|
|
#
|
|
|
|
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
|
|
|
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
# See the License for more information.
|
|
|
|
#=============================================================================
|
2010-08-07 00:48:47 +00:00
|
|
|
# (To distribute this file outside of CMake, substitute the full
|
2009-09-28 15:45:50 +00:00
|
|
|
# License text for the above reference.)
|
|
|
|
|
2012-11-03 20:35:44 +00:00
|
|
|
include(${CMAKE_CURRENT_LIST_DIR}/FindCygwin.cmake)
|
2001-11-09 21:15:58 +00:00
|
|
|
|
2012-08-13 17:47:32 +00:00
|
|
|
find_program(SELF_PACKER_FOR_EXECUTABLE
|
2001-12-04 15:55:17 +00:00
|
|
|
upx
|
|
|
|
${CYGWIN_INSTALL_PATH}/bin
|
|
|
|
/bin
|
2012-08-13 17:42:58 +00:00
|
|
|
/usr/bin
|
2001-12-04 15:55:17 +00:00
|
|
|
/usr/local/bin
|
|
|
|
/sbin
|
|
|
|
)
|
|
|
|
|
2012-08-13 17:47:32 +00:00
|
|
|
find_program(SELF_PACKER_FOR_SHARED_LIB
|
2001-12-04 15:55:17 +00:00
|
|
|
upx
|
|
|
|
${CYGWIN_INSTALL_PATH}/bin
|
|
|
|
/bin
|
2012-08-13 17:42:58 +00:00
|
|
|
/usr/bin
|
2001-12-04 15:55:17 +00:00
|
|
|
/usr/local/bin
|
|
|
|
/sbin
|
|
|
|
)
|
|
|
|
|
2012-08-13 17:47:32 +00:00
|
|
|
mark_as_advanced(
|
2001-12-04 15:55:17 +00:00
|
|
|
SELF_PACKER_FOR_EXECUTABLE
|
|
|
|
SELF_PACKER_FOR_SHARED_LIB
|
|
|
|
)
|
2001-11-09 21:15:58 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# Set flags
|
|
|
|
#
|
2012-08-13 17:47:32 +00:00
|
|
|
if (SELF_PACKER_FOR_EXECUTABLE MATCHES "upx")
|
|
|
|
set (SELF_PACKER_FOR_EXECUTABLE_FLAGS "-q" CACHE STRING
|
2001-11-09 21:15:58 +00:00
|
|
|
"Flags for the executable self-packer.")
|
2012-08-13 17:50:14 +00:00
|
|
|
else ()
|
2012-08-13 17:47:32 +00:00
|
|
|
set (SELF_PACKER_FOR_EXECUTABLE_FLAGS "" CACHE STRING
|
2001-11-09 21:15:58 +00:00
|
|
|
"Flags for the executable self-packer.")
|
2012-08-13 17:50:14 +00:00
|
|
|
endif ()
|
2001-11-09 21:15:58 +00:00
|
|
|
|
2012-08-13 17:47:32 +00:00
|
|
|
if (SELF_PACKER_FOR_SHARED_LIB MATCHES "upx")
|
|
|
|
set (SELF_PACKER_FOR_SHARED_LIB_FLAGS "-q" CACHE STRING
|
2001-11-09 21:15:58 +00:00
|
|
|
"Flags for the shared lib self-packer.")
|
2012-08-13 17:50:14 +00:00
|
|
|
else ()
|
2012-08-13 17:47:32 +00:00
|
|
|
set (SELF_PACKER_FOR_SHARED_LIB_FLAGS "" CACHE STRING
|
2001-11-09 21:15:58 +00:00
|
|
|
"Flags for the shared lib self-packer.")
|
2012-08-13 17:50:14 +00:00
|
|
|
endif ()
|
2001-12-04 15:55:17 +00:00
|
|
|
|
2012-08-13 17:47:32 +00:00
|
|
|
mark_as_advanced(
|
2001-12-04 15:55:17 +00:00
|
|
|
SELF_PACKER_FOR_EXECUTABLE_FLAGS
|
|
|
|
SELF_PACKER_FOR_SHARED_LIB_FLAGS
|
|
|
|
)
|