FindSelfPackers.cmake 1.9 KB

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