~ubuntu-branches/ubuntu/lucid/cmake/lucid

« back to all changes in this revision

Viewing changes to Tests/CMakeTests/ELFTest.cmake.in

  • Committer: Bazaar Package Importer
  • Author(s): Artur Rona
  • Date: 2009-12-16 11:11:54 UTC
  • mfrom: (3.1.9 sid)
  • Revision ID: james.westby@ubuntu.com-20091216111154-6accvv6yq86h2hkc
Tags: 2.8.0-5ubuntu1
* Merge from debian testing (LP: #497349). Remaining changes:
  - Keep the Replaces: on cmake-data to cover the Kubuntu version from
    Jaunty in case someone decides to do an (unsupported) Jaunty->Lucid
    upgrade.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
set(names
 
2
  elf32lsb.bin
 
3
  elf32msb.bin
 
4
  elf64lsb.bin
 
5
  elf64msb.bin
 
6
  )
 
7
 
 
8
# Prepare binaries on which to operate.
 
9
set(in "@CMAKE_CURRENT_SOURCE_DIR@/ELF")
 
10
set(out "@CMAKE_CURRENT_BINARY_DIR@/ELF-Out")
 
11
file(REMOVE_RECURSE "${out}")
 
12
file(MAKE_DIRECTORY "${out}")
 
13
foreach(f ${names})
 
14
  file(COPY ${in}/${f} DESTINATION ${out})
 
15
  list(APPEND files "${out}/${f}")
 
16
endforeach()
 
17
 
 
18
foreach(f ${files})
 
19
  # Check for the initial RPATH.
 
20
  file(RPATH_CHECK FILE "${f}" RPATH "/sample/rpath")
 
21
  if(NOT EXISTS "${f}")
 
22
    message(FATAL_ERROR "RPATH_CHECK removed ${f}")
 
23
  endif()
 
24
 
 
25
  # Change the RPATH.
 
26
  file(RPATH_CHANGE FILE "${f}"
 
27
    OLD_RPATH "/sample/rpath"
 
28
    NEW_RPATH "/rpath/sample")
 
29
  set(rpath)
 
30
  file(STRINGS "${f}" rpath REGEX "/rpath/sample" LIMIT_COUNT 1)
 
31
  if(NOT rpath)
 
32
    message(FATAL_ERROR "RPATH not changed in ${f}")
 
33
  endif()
 
34
 
 
35
  # Remove the RPATH.
 
36
  file(RPATH_REMOVE FILE "${f}")
 
37
  set(rpath)
 
38
  file(STRINGS "${f}" rpath REGEX "/rpath/sample" LIMIT_COUNT 1)
 
39
  if(rpath)
 
40
    message(FATAL_ERROR "RPATH not removed from ${f}")
 
41
  endif()
 
42
 
 
43
  # Check again...this should remove the file.
 
44
  file(RPATH_CHECK FILE "${f}" RPATH "/sample/rpath")
 
45
  if(EXISTS "${f}")
 
46
    message(FATAL_ERROR "RPATH_CHECK did not remove ${f}")
 
47
  endif()
 
48
endforeach()