TARGETS-FILE_RPATH_CHANGE-check-common.cmake 1.3 KB

1234567891011121314151617181920212223242526272829303132
  1. file(READ ${RunCMake_TEST_BINARY_DIR}/cmake_install.cmake install_script)
  2. #message(STATUS ${install_script})
  3. set(wsnl " *[\n\r]+ *") # whitespace + single newline + whitespace
  4. set(wssl " *[\n\r]+[^\n\r]*[\n\r]+ *") # ws nl skipline nl ws
  5. string(CONCAT prefix [[file\(RPATH_CHANGE]])
  6. set(_msg "cmake_install.cmake does not match ")
  7. macro(check)
  8. if(NOT install_script MATCHES "${regex}")
  9. message(STATUS "${test} - check \"${target}\" - FAILED:")
  10. string(CONCAT RunCMake_TEST_FAILED "${_msg}" ">>>${regex}<<<")
  11. return()
  12. else()
  13. message(STATUS "${test} - check \"${target}\" - PASSED")
  14. endif()
  15. endmacro()
  16. macro(skip_without_rpath_change_rule)
  17. # Not all platforms generate a file(RPATH_CHANGE) rule
  18. if(NOT install_script MATCHES [[file\(RPATH_CHANGE]])
  19. # Sanity check against a platform known to generate a file(RPATH_CHANGE) rule
  20. if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
  21. message(FATAL_ERROR "Expected generated file(RPATH_CHANGE) rule on platform Linux.")
  22. elseif(CMAKE_SYSTEM_NAME STREQUAL "AIX")
  23. message(FATAL_ERROR "Expected generated file(RPATH_CHANGE) rule on platform AIX.")
  24. else()
  25. message(STATUS "${test} - All checks skipped. No file(RPATH_CHANGE) rule found on this platform.")
  26. return()
  27. endif()
  28. endif()
  29. endmacro()