FindSelfPackers.cmake 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. # - Find upx
  2. # This module looks for some executable packers (i.e. softwares 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. # Copyright 2001-2009 Kitware, Inc.
  9. #
  10. # Distributed under the OSI-approved BSD License (the "License");
  11. # see accompanying file Copyright.txt for details.
  12. #
  13. # This software is distributed WITHOUT ANY WARRANTY; without even the
  14. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  15. # See the License for more information.
  16. #=============================================================================
  17. # (To distribute this file outside of CMake, substitute the full
  18. # License text for the above reference.)
  19. INCLUDE(FindCygwin)
  20. FIND_PROGRAM(SELF_PACKER_FOR_EXECUTABLE
  21. upx
  22. ${CYGWIN_INSTALL_PATH}/bin
  23. /bin
  24. /usr/bin
  25. /usr/local/bin
  26. /sbin
  27. )
  28. FIND_PROGRAM(SELF_PACKER_FOR_SHARED_LIB
  29. upx
  30. ${CYGWIN_INSTALL_PATH}/bin
  31. /bin
  32. /usr/bin
  33. /usr/local/bin
  34. /sbin
  35. )
  36. MARK_AS_ADVANCED(
  37. SELF_PACKER_FOR_EXECUTABLE
  38. SELF_PACKER_FOR_SHARED_LIB
  39. )
  40. #
  41. # Set flags
  42. #
  43. IF (SELF_PACKER_FOR_EXECUTABLE MATCHES "upx")
  44. SET (SELF_PACKER_FOR_EXECUTABLE_FLAGS "-q" CACHE STRING
  45. "Flags for the executable self-packer.")
  46. ELSE (SELF_PACKER_FOR_EXECUTABLE MATCHES "upx")
  47. SET (SELF_PACKER_FOR_EXECUTABLE_FLAGS "" CACHE STRING
  48. "Flags for the executable self-packer.")
  49. ENDIF (SELF_PACKER_FOR_EXECUTABLE MATCHES "upx")
  50. IF (SELF_PACKER_FOR_SHARED_LIB MATCHES "upx")
  51. SET (SELF_PACKER_FOR_SHARED_LIB_FLAGS "-q" CACHE STRING
  52. "Flags for the shared lib self-packer.")
  53. ELSE (SELF_PACKER_FOR_SHARED_LIB MATCHES "upx")
  54. SET (SELF_PACKER_FOR_SHARED_LIB_FLAGS "" CACHE STRING
  55. "Flags for the shared lib self-packer.")
  56. ENDIF (SELF_PACKER_FOR_SHARED_LIB MATCHES "upx")
  57. MARK_AS_ADVANCED(
  58. SELF_PACKER_FOR_EXECUTABLE_FLAGS
  59. SELF_PACKER_FOR_SHARED_LIB_FLAGS
  60. )