FindSelfPackers.cmake 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. # - Find upx
  2. # This module looks for some executable packers (i.e. software 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(${CMAKE_CURRENT_LIST_DIR}/FindCygwin.cmake)
  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 ()
  47. set (SELF_PACKER_FOR_EXECUTABLE_FLAGS "" CACHE STRING
  48. "Flags for the executable self-packer.")
  49. endif ()
  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 ()
  54. set (SELF_PACKER_FOR_SHARED_LIB_FLAGS "" CACHE STRING
  55. "Flags for the shared lib self-packer.")
  56. endif ()
  57. mark_as_advanced(
  58. SELF_PACKER_FOR_EXECUTABLE_FLAGS
  59. SELF_PACKER_FOR_SHARED_LIB_FLAGS
  60. )