about summary refs log tree commit diff homepage
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorLukas Zaoral <lzaoral@redhat.com>2021-10-13 15:51:03 +0200
committerMartinNowack <2443641+MartinNowack@users.noreply.github.com>2021-12-19 15:55:56 +0000
commit9aa216c819ee2f97a5423efb2cd46e2176352e5a (patch)
tree264c8fef037d21511763f120f25b4c9f06119481 /CMakeLists.txt
parent0379144709c2bc47b6fc4bc42c5fe00a24d01a0d (diff)
downloadklee-9aa216c819ee2f97a5423efb2cd46e2176352e5a.tar.gz
cmake: copy klee-uclibc and klee-libcxx to expected locations
Before this change, we created a symlink to the given libraries in their
expected location and then installed the original library.  This was
problematic as the install directives are performed the order they are
encountered during the configure step and the installation of directory
containing the symlink was processed after the installation of the original
library.  Therefore, the original libraries were installed but were
subsequently overwritten by the symlinks that can become broken rather easily.

This commit changes the behaviour so that we create copy the libraries to the
expected location and install them together with the rest of the KLEE runtime
as was originally intended.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt26
1 files changed, 4 insertions, 22 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1d00d7f9..ed6f22f4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -539,23 +539,14 @@ if (ENABLE_KLEE_UCLIBC)
   endif()
   message(STATUS "Found klee-uclibc library: \"${KLEE_UCLIBC_C_BCA}\"")
 
-  # Make a symlink to KLEE_UCLIBC_C_BCA so KLEE can find it where it
-  # is expected.
-  execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink
+  # Copy KLEE_UCLIBC_C_BCA so KLEE can find it where it is expected.
+  execute_process(COMMAND ${CMAKE_COMMAND} -E copy
     "${KLEE_UCLIBC_C_BCA}"
     "${KLEE_RUNTIME_DIRECTORY}/${KLEE_UCLIBC_BCA_NAME}"
   )
   list(APPEND KLEE_COMPONENT_CXX_DEFINES
     -DKLEE_UCLIBC_BCA_NAME=\"${KLEE_UCLIBC_BCA_NAME}\")
 
-  # Add klee-uclibc to the install target. We install the original
-  # file rather than the symlink because CMake would just copy the symlink
-  # rather than the file.
-  install(FILES "${KLEE_UCLIBC_C_BCA}"
-    DESTINATION "${KLEE_INSTALL_RUNTIME_DIR}"
-    RENAME "${KLEE_UCLIBC_BCA_NAME}"
-    )
-
 else()
   message(STATUS "klee-uclibc support disabled")
   set(SUPPORT_KLEE_UCLIBC 0) # For config.h
@@ -605,24 +596,15 @@ if (ENABLE_KLEE_LIBCXX)
   endif()
   message(STATUS "Found libc++ library: \"${KLEE_LIBCXX_BC_PATH}\"")
 
-  # Make a symlink to KLEE_LIBCXX_BC_PATH so KLEE can find it where it
-  # is expected.
+  # Copy KLEE_LIBCXX_BC_PATH so KLEE can find it where it is expected.
   file(MAKE_DIRECTORY "${KLEE_RUNTIME_DIRECTORY}")
-  execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink
+  execute_process(COMMAND ${CMAKE_COMMAND} -E copy
     "${KLEE_LIBCXX_BC_PATH}"
     "${KLEE_RUNTIME_DIRECTORY}/${KLEE_LIBCXX_BC_NAME}"
   )
   list(APPEND KLEE_COMPONENT_CXX_DEFINES
     -DKLEE_LIBCXX_BC_NAME=\"${KLEE_LIBCXX_BC_NAME}\")
 
-  # Add libc++ to the install target. We install the original
-  # file rather than the symlink because CMake would just copy the symlink
-  # rather than the file.
-  install(FILES "${KLEE_LIBCXX_BC_PATH}"
-    DESTINATION "${KLEE_INSTALL_RUNTIME_DIR}"
-    RENAME "${KLEE_LIBCXX_BC_NAME}"
-    )
-
 else()
   message(STATUS "libc++ support disabled")
   set(SUPPORT_KLEE_LIBCXX 0) # For config.h