diff options
| author | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
|---|---|---|
| committer | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
| commit | 54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch) | |
| tree | d915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/scripts/test_ports/vcpkg-fixup-macho-rpath/portfile.cmake | |
Diffstat (limited to 'vcpkg/scripts/test_ports/vcpkg-fixup-macho-rpath/portfile.cmake')
| -rw-r--r-- | vcpkg/scripts/test_ports/vcpkg-fixup-macho-rpath/portfile.cmake | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/vcpkg/scripts/test_ports/vcpkg-fixup-macho-rpath/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-fixup-macho-rpath/portfile.cmake new file mode 100644 index 0000000..6754431 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-fixup-macho-rpath/portfile.cmake @@ -0,0 +1,65 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +# Test for empty string +set(macho_dir "${CURRENT_PACKAGES_DIR}/lib") +set(test_rpath "") +set(expected "@loader_path") + +z_vcpkg_calculate_corrected_macho_rpath( + MACHO_FILE_DIR "${macho_dir}" + OUT_NEW_RPATH_VAR new_rpath +) + +if(NOT "x${new_rpath}x" STREQUAL "x${expected}x") + message(FATAL_ERROR "--- Calculated rpath does not match expected rpath: '${new_rpath}' != '${expected}' ") +else() + message(STATUS "--- Calculated rpath matches expected rpath: '${new_rpath}' ") +endif() + +# Test for empty string in the tools directory +set(macho_dir "${CURRENT_PACKAGES_DIR}/tools/hdf5") +set(test_rpath "") +set(expected "@loader_path/../../lib") + +z_vcpkg_calculate_corrected_macho_rpath( + MACHO_FILE_DIR "${macho_dir}" + OUT_NEW_RPATH_VAR new_rpath +) + +if(NOT "x${new_rpath}x" STREQUAL "x${expected}x") + message(FATAL_ERROR "--- Calculated rpath does not match expected rpath: '${new_rpath}' != '${expected}' ") +else() + message(STATUS "--- Calculated rpath matches expected rpath: '${new_rpath}' ") +endif() + +# macho dir in subdir +set(macho_dir "${CURRENT_PACKAGES_DIR}/lib/somesubdir") +set(test_rpath "") +set(expected "@loader_path/..") + +z_vcpkg_calculate_corrected_macho_rpath( + MACHO_FILE_DIR "${macho_dir}" + OUT_NEW_RPATH_VAR new_rpath +) + +if(NOT "x${new_rpath}x" STREQUAL "x${expected}x") + message(FATAL_ERROR "--- Calculated rpath for '${macho_dir}' does not match expected rpath: '${new_rpath}' != '${expected}' ") +else() + message(STATUS "--- Calculated rpath matches expected rpath: '${new_rpath}' ") +endif() + +# Getting more complex +set(macho_dir "${CURRENT_PACKAGES_DIR}/plugins/notlib/extrasubdir") +set(test_rpath "") +set(expected "@loader_path/../../../lib") + +z_vcpkg_calculate_corrected_macho_rpath( + MACHO_FILE_DIR "${macho_dir}" + OUT_NEW_RPATH_VAR new_rpath +) + +if(NOT "x${new_rpath}x" STREQUAL "x${expected}x") + message(FATAL_ERROR "--- Calculated rpath does not match expected rpath: '${new_rpath}' != '${expected}' ") +else() + message(STATUS "--- Calculated rpath matches expected rpath: '${new_rpath}' ") +endif() |