CMP0054-policy-while-scope.cmake 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. set(FOO BAR)
  2. set(LOOP_VAR "")
  3. cmake_policy(SET CMP0054 NEW)
  4. while(NOT LOOP_VAR STREQUAL "xx")
  5. if(NOT FOO STREQUAL BAR)
  6. message(FATAL_ERROR "The variable should match the string")
  7. endif()
  8. if("FOO" STREQUAL BAR)
  9. message(FATAL_ERROR "The strings should not match")
  10. endif()
  11. cmake_policy(SET CMP0054 OLD)
  12. if(NOT FOO STREQUAL BAR)
  13. message(FATAL_ERROR "The variable should match the string")
  14. endif()
  15. if(NOT "FOO" STREQUAL BAR)
  16. message(FATAL_ERROR "The quoted variable should match the string")
  17. endif()
  18. cmake_policy(SET CMP0054 NEW)
  19. string(APPEND LOOP_VAR "x")
  20. endwhile()
  21. while("FOO" STREQUAL BAR)
  22. message(FATAL_ERROR "The strings should not match")
  23. endwhile()
  24. set(LOOP_VAR "")
  25. cmake_policy(SET CMP0054 OLD)
  26. while(NOT LOOP_VAR STREQUAL "xx")
  27. if(NOT FOO STREQUAL BAR)
  28. message(FATAL_ERROR "The variable should match the string")
  29. endif()
  30. if(NOT "FOO" STREQUAL BAR)
  31. message(FATAL_ERROR "The quoted variable should match the string")
  32. endif()
  33. cmake_policy(SET CMP0054 NEW)
  34. if(NOT FOO STREQUAL BAR)
  35. message(FATAL_ERROR "The variable should match the string")
  36. endif()
  37. if("FOO" STREQUAL BAR)
  38. message(FATAL_ERROR "The strings should not match")
  39. endif()
  40. cmake_policy(SET CMP0054 OLD)
  41. string(APPEND LOOP_VAR "x")
  42. endwhile()
  43. if(NOT "FOO" STREQUAL BAR)
  44. message(FATAL_ERROR "The quoted variable should match the string")
  45. endif()