CMP0175.cmake 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. enable_language(CXX)
  2. file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/main.cpp "int main() {}")
  3. add_executable(main ${CMAKE_CURRENT_BINARY_DIR}/main.cpp)
  4. #============================================================================
  5. # add_custom_command(TARGET)
  6. #============================================================================
  7. # Unsupported keywords. Need to test them in batches to avoid other checks.
  8. add_custom_command(TARGET main
  9. POST_BUILD
  10. COMMAND ${CMAKE_COMMAND} -E true
  11. # None of the following are allowed for the TARGET form
  12. #APPEND # Has its own check requiring OUTPUT to be set
  13. #CODEGEN # Other checks will fail before the CMP0175 check
  14. DEPENDS valueDoesNotMatterHere
  15. DEPENDS_EXPLICIT_ONLY YES
  16. DEPFILE valueDoesNotMatterHere
  17. #IMPLICIT_DEPENDS # Earlier check fails when DEPFILE is present
  18. JOB_POOL valueDoesNotMatterHere
  19. MAIN_DEPENDENCY valueDoesNotMatterHere
  20. #OUTPUT # Other checks will fail before the CMP0175 check
  21. #OUTPUTS # Special case, not a documented keyword (used for deprecated form)
  22. #SOURCE # Old signature, special handling makes it hard to check
  23. )
  24. add_custom_command(TARGET main
  25. POST_BUILD
  26. COMMAND ${CMAKE_COMMAND} -E true
  27. # Has to be tested separately due to separate check for clash with DEPFILE
  28. IMPLICIT_DEPENDS valueDoesNotMatterHere
  29. # Has to be tested separately due to separate check for clash with JOB_POOL.
  30. # This one is supported, but was erroneously rejected in the 3.31.0 release.
  31. # We keep this here to verify the fix for that regression.
  32. USES_TERMINAL NO
  33. )
  34. # Missing any PRE_BUILD, PRE_LINK, or POST_BUILD
  35. add_custom_command(TARGET main
  36. COMMAND ${CMAKE_COMMAND} -E true
  37. )
  38. # More than one of PRE_BUILD, PRE_LINK, or POST_BUILD
  39. add_custom_command(TARGET main
  40. PRE_BUILD PRE_LINK POST_BUILD
  41. COMMAND ${CMAKE_COMMAND} -E true
  42. )
  43. # Missing COMMAND
  44. add_custom_command(TARGET main
  45. POST_BUILD
  46. COMMENT "Need at least 4 arguments, so added this comment"
  47. )
  48. #============================================================================
  49. # add_custom_command(OUTPUT)
  50. #============================================================================
  51. add_custom_command(OUTPUT blah.txt
  52. OUTPUTS
  53. POST_BUILD
  54. PRE_BUILD
  55. PRE_LINK
  56. SOURCE
  57. )