diff options
author | Brad King <brad.king@kitware.com> | 2021-02-04 13:29:52 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2021-02-04 13:29:57 (GMT) |
commit | 67cb0067328b158c730fbe009a91ae542238a456 (patch) | |
tree | 6a7e56966c0cc3e65817f4f3a79e48bfa6c2cc67 /Tests | |
parent | 4cd23c5e0d5835781b95f6eda778a35d2f55beb8 (diff) | |
parent | e017ba046ccab62fcc67e7cf8fc858e991c1d3e7 (diff) | |
download | CMake-67cb0067328b158c730fbe009a91ae542238a456.zip CMake-67cb0067328b158c730fbe009a91ae542238a456.tar.gz CMake-67cb0067328b158c730fbe009a91ae542238a456.tar.bz2 |
Merge topic 'aix-xcoff-edit'
e017ba046c AIX: Enable XCOFF editing to replace RPATH on installation
56fc4a325f cmXCOFF: Add helper to parse and edit the XCOFF binary format
ddaaee907d CMakeDetermineCompilerId: Recognize XCOFF executable format
69e1d95a8a Tests: Add sample XCOFF binaries
f79d991dfd Tests: Convert CMake.ELF to RunCMake.file-RPATH ELF case
d8f3e68ca9 Ninja Multi-Config: Enable relink diagnostic message
cdcfe3eb99 Rename CMAKE_USE_MACH_PARSER to CMake_USE_MACH_PARSER
b6071c93f5 Rename CMAKE_USE_ELF_PARSER to CMake_USE_ELF_PARSER
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5769
Diffstat (limited to 'Tests')
14 files changed, 38 insertions, 19 deletions
diff --git a/Tests/CMakeTests/CMakeLists.txt b/Tests/CMakeTests/CMakeLists.txt index 348e6d0..6bbbe7d 100644 --- a/Tests/CMakeTests/CMakeLists.txt +++ b/Tests/CMakeTests/CMakeLists.txt @@ -44,10 +44,6 @@ set_property(TEST CMake.FileDownloadBadHash PROPERTY AddCMakeTest(FileUpload "") -if(HAVE_ELF_H) - AddCMakeTest(ELF "") -endif() - set(EndStuff_PreArgs "-Ddir:STRING=${CMAKE_CURRENT_BINARY_DIR}/EndStuffTest" ) diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index f58e2f3..549d8eb 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -358,6 +358,9 @@ add_RunCMake_test(ctest_upload) add_RunCMake_test(ctest_fixtures) add_RunCMake_test(file) add_RunCMake_test(file-CHMOD) +if(HAVE_ELF_H OR CMAKE_SYSTEM_NAME STREQUAL "AIX") + add_RunCMake_test(file-RPATH -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME} -DHAVE_ELF_H=${HAVE_ELF_H}) +endif() add_RunCMake_test(find_file) add_RunCMake_test(find_library -DCYGWIN=${CYGWIN}) add_RunCMake_test(find_package) diff --git a/Tests/CMakeTests/ELFTest.cmake.in b/Tests/RunCMake/file-RPATH/Common.cmake index 85c2360..cc1efb5 100644 --- a/Tests/CMakeTests/ELFTest.cmake.in +++ b/Tests/RunCMake/file-RPATH/Common.cmake @@ -1,15 +1,6 @@ -set(names - elf32lsb.bin - elf32msb.bin - elf64lsb.bin - elf64msb.bin - ) - # Prepare binaries on which to operate. -set(in "@CMAKE_CURRENT_SOURCE_DIR@/ELF") -set(out "@CMAKE_CURRENT_BINARY_DIR@/ELF-Out") -file(REMOVE_RECURSE "${out}") -file(MAKE_DIRECTORY "${out}") +set(in "${CMAKE_CURRENT_LIST_DIR}/${format}") +set(out "${CMAKE_CURRENT_BINARY_DIR}") foreach(f ${names}) file(COPY ${in}/${f} DESTINATION ${out} NO_SOURCE_PERMISSIONS) list(APPEND files "${out}/${f}") diff --git a/Tests/RunCMake/file-RPATH/ELF.cmake b/Tests/RunCMake/file-RPATH/ELF.cmake new file mode 100644 index 0000000..558b2e2 --- /dev/null +++ b/Tests/RunCMake/file-RPATH/ELF.cmake @@ -0,0 +1,9 @@ +set(names + elf32lsb.bin + elf32msb.bin + elf64lsb.bin + elf64msb.bin + ) +set(format ELF) + +include(${CMAKE_CURRENT_LIST_DIR}/Common.cmake) diff --git a/Tests/CMakeTests/ELF/elf32lsb.bin b/Tests/RunCMake/file-RPATH/ELF/elf32lsb.bin Binary files differindex 803ac43..803ac43 100644..100755 --- a/Tests/CMakeTests/ELF/elf32lsb.bin +++ b/Tests/RunCMake/file-RPATH/ELF/elf32lsb.bin diff --git a/Tests/CMakeTests/ELF/elf32msb.bin b/Tests/RunCMake/file-RPATH/ELF/elf32msb.bin Binary files differindex d04aaf7..d04aaf7 100644..100755 --- a/Tests/CMakeTests/ELF/elf32msb.bin +++ b/Tests/RunCMake/file-RPATH/ELF/elf32msb.bin diff --git a/Tests/CMakeTests/ELF/elf64lsb.bin b/Tests/RunCMake/file-RPATH/ELF/elf64lsb.bin Binary files differindex a21e3ea..a21e3ea 100644..100755 --- a/Tests/CMakeTests/ELF/elf64lsb.bin +++ b/Tests/RunCMake/file-RPATH/ELF/elf64lsb.bin diff --git a/Tests/CMakeTests/ELF/elf64msb.bin b/Tests/RunCMake/file-RPATH/ELF/elf64msb.bin Binary files differindex bbe2551..bbe2551 100644..100755 --- a/Tests/CMakeTests/ELF/elf64msb.bin +++ b/Tests/RunCMake/file-RPATH/ELF/elf64msb.bin diff --git a/Tests/RunCMake/file-RPATH/RunCMakeTest.cmake b/Tests/RunCMake/file-RPATH/RunCMakeTest.cmake new file mode 100644 index 0000000..eb7b497 --- /dev/null +++ b/Tests/RunCMake/file-RPATH/RunCMakeTest.cmake @@ -0,0 +1,9 @@ +include(RunCMake) + +if(HAVE_ELF_H) + run_cmake_command(ELF ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/ELF.cmake) +endif() + +if(CMAKE_SYSTEM_NAME STREQUAL "AIX") + run_cmake_command(XCOFF ${CMAKE_COMMAND} -P ${RunCMake_SOURCE_DIR}/XCOFF.cmake) +endif() diff --git a/Tests/RunCMake/file-RPATH/XCOFF.cmake b/Tests/RunCMake/file-RPATH/XCOFF.cmake new file mode 100644 index 0000000..b570920 --- /dev/null +++ b/Tests/RunCMake/file-RPATH/XCOFF.cmake @@ -0,0 +1,7 @@ +set(names + xcoff32.bin + xcoff64.bin + ) +set(format XCOFF) + +include(${CMAKE_CURRENT_LIST_DIR}/Common.cmake) diff --git a/Tests/RunCMake/file-RPATH/XCOFF/xcoff32.bin b/Tests/RunCMake/file-RPATH/XCOFF/xcoff32.bin Binary files differnew file mode 100644 index 0000000..2d8d961 --- /dev/null +++ b/Tests/RunCMake/file-RPATH/XCOFF/xcoff32.bin diff --git a/Tests/RunCMake/file-RPATH/XCOFF/xcoff64.bin b/Tests/RunCMake/file-RPATH/XCOFF/xcoff64.bin Binary files differnew file mode 100644 index 0000000..bb5f5a7 --- /dev/null +++ b/Tests/RunCMake/file-RPATH/XCOFF/xcoff64.bin diff --git a/Tests/RunCMake/install/RunCMakeTest.cmake b/Tests/RunCMake/install/RunCMakeTest.cmake index b067b3a..efd03df 100644 --- a/Tests/RunCMake/install/RunCMakeTest.cmake +++ b/Tests/RunCMake/install/RunCMakeTest.cmake @@ -48,14 +48,16 @@ in directory: endif() endfunction() -# Wrapper for run_cmake() that skips platforms that are non-ELF or have no RPATH support -function(run_cmake_ELFRPATH_only case) - if(UNIX AND CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG AND CMAKE_EXECUTABLE_FORMAT STREQUAL "ELF") +# Wrapper for run_cmake() that skips platforms on which we do not support editing the RPATH. +function(run_cmake_EDIT_RPATH_only case) + if(UNIX AND CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG AND CMAKE_EXECUTABLE_FORMAT MATCHES "^(ELF|XCOFF)$") run_cmake(${case}) else() # Sanity check against a platform known to be ELF-based if(CMAKE_SYSTEM_NAME STREQUAL "Linux") message(FATAL_ERROR "Expected platform Linux to advertize itself as ELF-based, but it did not.") + elseif(CMAKE_SYSTEM_NAME STREQUAL "AIX") + message(FATAL_ERROR "Expected platform AIX to advertize itself as XCOFF-based, but it did not.") else() message(STATUS "${case} - SKIPPED (No ELF-based platform found)") endif() @@ -63,7 +65,7 @@ function(run_cmake_ELFRPATH_only case) endfunction() run_cmake(TARGETS-FILE_RPATH_CHANGE-old_rpath) -run_cmake_ELFRPATH_only(TARGETS-FILE_RPATH_CHANGE-new_rpath) +run_cmake_EDIT_RPATH_only(TARGETS-FILE_RPATH_CHANGE-new_rpath) run_cmake(DIRECTORY-MESSAGE_NEVER) run_cmake(DIRECTORY-PATTERN-MESSAGE_NEVER) run_cmake(DIRECTORY-message) diff --git a/Tests/RunCMake/install/TARGETS-FILE_RPATH_CHANGE-check-common.cmake b/Tests/RunCMake/install/TARGETS-FILE_RPATH_CHANGE-check-common.cmake index 673fdde..6b2faa3 100644 --- a/Tests/RunCMake/install/TARGETS-FILE_RPATH_CHANGE-check-common.cmake +++ b/Tests/RunCMake/install/TARGETS-FILE_RPATH_CHANGE-check-common.cmake @@ -22,6 +22,8 @@ macro(skip_without_rpath_change_rule) # Sanity check against a platform known to generate a file(RPATH_CHANGE) rule if(CMAKE_SYSTEM_NAME STREQUAL "Linux") message(FATAL_ERROR "Expected generated file(RPATH_CHANGE) rule on platform Linux.") + elseif(CMAKE_SYSTEM_NAME STREQUAL "AIX") + message(FATAL_ERROR "Expected generated file(RPATH_CHANGE) rule on platform AIX.") else() message(STATUS "${test} - All checks skipped. No file(RPATH_CHANGE) rule found on this platform.") return() |