CMakeVCManifestExe.cmake 999 B

123456789101112131415161718192021222324252627282930
  1. # Leave the first line of this file empty so this module will not be
  2. # included in the documentation.
  3. # This script is invoked from Windows-cl.cmake and passed the TARGET
  4. # variable on the command line.
  5. # Conditionally embed the manifest in the executable if it exists.
  6. IF(EXISTS "${TARGET}.manifest")
  7. # Construct the manifest embedding command.
  8. SET(CMD
  9. mt ${CMAKE_CL_NOLOGO} /manifest ${TARGET}.manifest
  10. /outputresource:${TARGET}
  11. )
  12. # Run the embedding command.
  13. EXECUTE_PROCESS(COMMAND ${CMD}\;\#1 RESULT_VARIABLE RESULT)
  14. # Check whether the command failed.
  15. IF(NOT "${RESULT}" MATCHES "^0$")
  16. # The embedding failed remove the target and the manifest.
  17. FILE(REMOVE ${TARGET} ${TARGET}.manifest)
  18. # Describe the failure in a message.
  19. STRING(REGEX REPLACE ";" " " CMD "${CMD}")
  20. MESSAGE(FATAL_ERROR
  21. "Failed to embed manifest in ${TARGET} using command \"${CMD};#1\""
  22. )
  23. ENDIF(NOT "${RESULT}" MATCHES "^0$")
  24. ENDIF(EXISTS "${TARGET}.manifest")