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