r250834 - [CMake] Make external compiler-rt install scripts relative to CMAKE_INSTALL_PREFIX.

Chris Bieneman via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 20 09:39:25 PDT 2015


Author: cbieneman
Date: Tue Oct 20 11:39:25 2015
New Revision: 250834

URL: http://llvm.org/viewvc/llvm-project?rev=250834&view=rev
Log:
[CMake] Make external compiler-rt install scripts relative to CMAKE_INSTALL_PREFIX.

This change makes LLVM_BUILD_EXTERNAL_COMPILER_RT work correctly when overriding CMAKE_INSTALL_PREFIX on the install action (which is how LLVM_CREATE_XCODE_TOOLCHAIN works).

This fix is two parts:
(1) Pass CMAKE_INSTALL_PREFIX in as a variable from the parent install to the child install
(2) When passing COMPILER_RT_INSTALL_PATH into the external project make sure it is passed as a string not a path.

Not specifying the full path for COMPILER_RT_INSTALL_PATH isn't enough to fix the issue because relative paths specified on the CMake command line are expanded relative to the working directory before the cache is populated. Forcing this to a string allows it to remain a relative path through to the install() calls. Relative paths specified in install() calls are expanded relative to CMAKE_INSTALL_PREFIX at install time.

Modified:
    cfe/trunk/runtime/CMakeLists.txt

Modified: cfe/trunk/runtime/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/runtime/CMakeLists.txt?rev=250834&r1=250833&r2=250834&view=diff
==============================================================================
--- cfe/trunk/runtime/CMakeLists.txt (original)
+++ cfe/trunk/runtime/CMakeLists.txt Tue Oct 20 11:39:25 2015
@@ -66,7 +66,7 @@ if(LLVM_BUILD_EXTERNAL_COMPILER_RT AND E
                -DLLVM_CONFIG_PATH=${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-config
                -DCOMPILER_RT_OUTPUT_DIR=${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION}
                -DCOMPILER_RT_EXEC_OUTPUT_DIR=${LLVM_RUNTIME_OUTPUT_INTDIR}
-               -DCOMPILER_RT_INSTALL_PATH=${CMAKE_INSTALL_PREFIX}/lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}
+               -DCOMPILER_RT_INSTALL_PATH:STRING=lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}
                -DCOMPILER_RT_INCLUDE_TESTS=${LLVM_INCLUDE_TESTS}
                -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
                ${COMPILER_RT_PASSTHROUGH_VARIABLES}
@@ -87,7 +87,7 @@ if(LLVM_BUILD_EXTERNAL_COMPILER_RT AND E
 
   add_dependencies(compiler-rt-configure clang llvm-config)
 
-  install(CODE "execute_process\(COMMAND ${CMAKE_COMMAND} -P ${BINARY_DIR}/cmake_install.cmake \)"
+  install(CODE "execute_process\(COMMAND \${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX=\${CMAKE_INSTALL_PREFIX} -P ${BINARY_DIR}/cmake_install.cmake \)"
     COMPONENT compiler-rt)
 
   add_custom_target(install-compiler-rt




More information about the cfe-commits mailing list