2016-09-27 22:01:08 +03:00
|
|
|
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
|
|
# file Copyright.txt or https://cmake.org/licensing for details.
|
|
|
|
|
2013-10-15 19:17:36 +04:00
|
|
|
#.rst:
|
|
|
|
# FindSelfPackers
|
|
|
|
# ---------------
|
|
|
|
#
|
|
|
|
# Find upx
|
|
|
|
#
|
|
|
|
# This module looks for some executable packers (i.e. software that
|
2001-11-10 00:15:58 +03:00
|
|
|
# compress executables or shared libs into on-the-fly self-extracting
|
2013-10-15 19:17:36 +04:00
|
|
|
# executables or shared libs. Examples:
|
|
|
|
#
|
|
|
|
# ::
|
|
|
|
#
|
|
|
|
# UPX: http://wildsau.idv.uni-linz.ac.at/mfx/upx.html
|
2001-11-10 00:15:58 +03:00
|
|
|
|
2012-11-04 00:35:44 +04:00
|
|
|
include(${CMAKE_CURRENT_LIST_DIR}/FindCygwin.cmake)
|
2001-11-10 00:15:58 +03:00
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
find_program(SELF_PACKER_FOR_EXECUTABLE
|
2001-12-04 18:55:17 +03:00
|
|
|
upx
|
|
|
|
${CYGWIN_INSTALL_PATH}/bin
|
|
|
|
/bin
|
2012-08-13 21:42:58 +04:00
|
|
|
/usr/bin
|
2001-12-04 18:55:17 +03:00
|
|
|
/usr/local/bin
|
|
|
|
/sbin
|
|
|
|
)
|
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
find_program(SELF_PACKER_FOR_SHARED_LIB
|
2001-12-04 18:55:17 +03:00
|
|
|
upx
|
|
|
|
${CYGWIN_INSTALL_PATH}/bin
|
|
|
|
/bin
|
2012-08-13 21:42:58 +04:00
|
|
|
/usr/bin
|
2001-12-04 18:55:17 +03:00
|
|
|
/usr/local/bin
|
|
|
|
/sbin
|
|
|
|
)
|
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
mark_as_advanced(
|
2001-12-04 18:55:17 +03:00
|
|
|
SELF_PACKER_FOR_EXECUTABLE
|
|
|
|
SELF_PACKER_FOR_SHARED_LIB
|
|
|
|
)
|
2001-11-10 00:15:58 +03:00
|
|
|
|
|
|
|
#
|
|
|
|
# Set flags
|
|
|
|
#
|
2012-08-13 21:47:32 +04:00
|
|
|
if (SELF_PACKER_FOR_EXECUTABLE MATCHES "upx")
|
|
|
|
set (SELF_PACKER_FOR_EXECUTABLE_FLAGS "-q" CACHE STRING
|
2001-11-10 00:15:58 +03:00
|
|
|
"Flags for the executable self-packer.")
|
2012-08-13 21:50:14 +04:00
|
|
|
else ()
|
2012-08-13 21:47:32 +04:00
|
|
|
set (SELF_PACKER_FOR_EXECUTABLE_FLAGS "" CACHE STRING
|
2001-11-10 00:15:58 +03:00
|
|
|
"Flags for the executable self-packer.")
|
2012-08-13 21:50:14 +04:00
|
|
|
endif ()
|
2001-11-10 00:15:58 +03:00
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
if (SELF_PACKER_FOR_SHARED_LIB MATCHES "upx")
|
|
|
|
set (SELF_PACKER_FOR_SHARED_LIB_FLAGS "-q" CACHE STRING
|
2001-11-10 00:15:58 +03:00
|
|
|
"Flags for the shared lib self-packer.")
|
2012-08-13 21:50:14 +04:00
|
|
|
else ()
|
2012-08-13 21:47:32 +04:00
|
|
|
set (SELF_PACKER_FOR_SHARED_LIB_FLAGS "" CACHE STRING
|
2001-11-10 00:15:58 +03:00
|
|
|
"Flags for the shared lib self-packer.")
|
2012-08-13 21:50:14 +04:00
|
|
|
endif ()
|
2001-12-04 18:55:17 +03:00
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
mark_as_advanced(
|
2001-12-04 18:55:17 +03:00
|
|
|
SELF_PACKER_FOR_EXECUTABLE_FLAGS
|
|
|
|
SELF_PACKER_FOR_SHARED_LIB_FLAGS
|
|
|
|
)
|