| function(check_rpath name expect_rpath) | |
| file(GLOB_RECURSE files "${dir}/${name}") | |
| list(LENGTH files count) | |
| if(NOT count EQUAL 1) | |
| message(FATAL_ERROR "Expected one '${name}' under '${dir}', found: ${files}") | |
| endif() | |
| file(STRINGS "${files}" found REGEX "/opt/foo/lib") | |
| if(expect_rpath AND NOT found) | |
| message(SEND_ERROR "'${name}' is missing the expected RPATH /opt/foo/lib") | |
| elseif(NOT expect_rpath AND found) | |
| message(SEND_ERROR "'${name}' unexpectedly contains RPATH /opt/foo/lib") | |
| endif() | |
| endfunction() | |
| check_rpath(skipped FALSE) | |
| check_rpath(kept TRUE) |