REPLACE_ITEM.cmake.in 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. include ("${RunCMake_SOURCE_DIR}/check_errors.cmake")
  2. unset (errors)
  3. set (reference "a/b/c.e.f")
  4. cmake_path (REPLACE_FILENAME reference "x.y")
  5. set(output "$<PATH:REPLACE_FILENAME,a/b/c.e.f,x.y>")
  6. if (NOT output STREQUAL reference)
  7. list (APPEND errors "FILENAME: '${output}' instead of '${reference}'")
  8. endif()
  9. set (reference "a/b/")
  10. cmake_path (REPLACE_FILENAME reference "x.y")
  11. set(output "$<PATH:REPLACE_FILENAME,a/b/,x.y>")
  12. if (NOT output STREQUAL reference)
  13. list (APPEND errors "FILENAME: '${output}' instead of '${reference}'")
  14. endif()
  15. set (reference "a/b/c.e.f")
  16. cmake_path (REPLACE_EXTENSION reference ".x")
  17. set(output "$<PATH:REPLACE_EXTENSION,a/b/c.e.f,.x>")
  18. if (NOT output STREQUAL reference)
  19. list (APPEND errors "EXTENSION: '${output}' instead of '${reference}'")
  20. endif()
  21. cmake_path (REPLACE_EXTENSION reference ".y")
  22. set(output "$<PATH:REPLACE_EXTENSION,a/b/c.x,.y>")
  23. if (NOT output STREQUAL reference)
  24. list (APPEND errors "EXTENSION: '${output}' instead of '${reference}'")
  25. endif()
  26. cmake_path (REPLACE_EXTENSION reference "")
  27. set(output "$<PATH:REPLACE_EXTENSION,a/b/c.y,>")
  28. if (NOT output STREQUAL reference)
  29. list (APPEND errors "EXTENSION: '${output}' instead of '${reference}'")
  30. endif()
  31. set (reference "a/b/c.e.f")
  32. cmake_path (REPLACE_EXTENSION reference ".x" LAST_ONLY)
  33. set(output "$<PATH:REPLACE_EXTENSION,LAST_ONLY,a/b/c.e.f,.x>")
  34. if (NOT output STREQUAL reference)
  35. list (APPEND errors "EXTENSION: '${output}' instead of '${reference}'")
  36. endif()
  37. cmake_path (REPLACE_EXTENSION reference ".y" LAST_ONLY)
  38. set(output "$<PATH:REPLACE_EXTENSION,LAST_ONLY,a/b/c.e.x,.y>")
  39. if (NOT output STREQUAL reference)
  40. list (APPEND errors "EXTENSION: '${output}' instead of '${reference}'")
  41. endif()
  42. cmake_path (REPLACE_EXTENSION reference "" LAST_ONLY)
  43. set(output "$<PATH:REPLACE_EXTENSION,LAST_ONLY,a/b/c.e.y,>")
  44. if (NOT output STREQUAL reference)
  45. list (APPEND errors "EXTENSION: '${output}' instead of '${reference}'")
  46. endif()
  47. set (reference "/a/.b")
  48. cmake_path (REPLACE_EXTENSION reference ".x")
  49. set(output "$<PATH:REPLACE_EXTENSION,/a/.b,.x>")
  50. if (NOT output STREQUAL reference)
  51. list (APPEND errors "EXTENSION: '${output}' instead of '/${reference}'")
  52. endif()
  53. cmake_path (REPLACE_EXTENSION reference ".x" LAST_ONLY)
  54. set(output "$<PATH:REPLACE_EXTENSION,LAST_ONLY,/a/.b.x,.x>")
  55. if (NOT output STREQUAL reference)
  56. list (APPEND errors "EXTENSION: '${output}' instead of '${reference}'")
  57. endif()
  58. set (reference "/a/b")
  59. cmake_path (REPLACE_EXTENSION reference ".x")
  60. set(output "$<PATH:REPLACE_EXTENSION,/a/b,.x>")
  61. if (NOT output STREQUAL reference)
  62. list (APPEND errors "EXTENSION: '${output}' instead of '${reference}'")
  63. endif()
  64. check_errors("PATH:REPLACE..." ${errors})