FindSelfPackers.cmake 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. # Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. # file Copyright.txt or https://cmake.org/licensing for details.
  3. #[=======================================================================[.rst:
  4. FindSelfPackers
  5. ---------------
  6. Find upx
  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. UPX: http://wildsau.idv.uni-linz.ac.at/mfx/upx.html
  12. #]=======================================================================]
  13. include(${CMAKE_CURRENT_LIST_DIR}/FindCygwin.cmake)
  14. find_program(SELF_PACKER_FOR_EXECUTABLE
  15. upx
  16. ${CYGWIN_INSTALL_PATH}/bin
  17. )
  18. find_program(SELF_PACKER_FOR_SHARED_LIB
  19. upx
  20. ${CYGWIN_INSTALL_PATH}/bin
  21. )
  22. mark_as_advanced(
  23. SELF_PACKER_FOR_EXECUTABLE
  24. SELF_PACKER_FOR_SHARED_LIB
  25. )
  26. #
  27. # Set flags
  28. #
  29. if (SELF_PACKER_FOR_EXECUTABLE MATCHES "upx")
  30. set (SELF_PACKER_FOR_EXECUTABLE_FLAGS "-q" CACHE STRING
  31. "Flags for the executable self-packer.")
  32. else ()
  33. set (SELF_PACKER_FOR_EXECUTABLE_FLAGS "" CACHE STRING
  34. "Flags for the executable self-packer.")
  35. endif ()
  36. if (SELF_PACKER_FOR_SHARED_LIB MATCHES "upx")
  37. set (SELF_PACKER_FOR_SHARED_LIB_FLAGS "-q" CACHE STRING
  38. "Flags for the shared lib self-packer.")
  39. else ()
  40. set (SELF_PACKER_FOR_SHARED_LIB_FLAGS "" CACHE STRING
  41. "Flags for the shared lib self-packer.")
  42. endif ()
  43. mark_as_advanced(
  44. SELF_PACKER_FOR_EXECUTABLE_FLAGS
  45. SELF_PACKER_FOR_SHARED_LIB_FLAGS
  46. )