the installed llvm package is not relocatable and has reference to the source tree, this problem maybe fixed using dynamic relative path calculations as follows: line21: set(LLVM_TOOLS_BINARY_DIR @LLVM_TOOLS_BINARY_DIR@) should be replaced to set(LLVM_TOOLS_BINARY_DIR ${CMAKE_CURRENT_LIST_DIR}/../../bin) line 34 set(LLVM_INSTALL_PREFIX @LLVM_INSTALL_PREFIX@) to: set(LLVM_INSTALL_PREFIX ${CMAKE_CURRENT_LIST_DIR}/../..) line 136: "@LLVM_SOURCE_DIR@/cmake/modules") to ${LLVM_INSTALL_PREFIX}/share/llvm/cmake)
two typing mistakes, they should be instead as above set(LLVM_TOOLS_BINARY_DIR ${CMAKE_CURRENT_LIST_DIR}/../../../bin) set(LLVM_INSTALL_PREFIX ${CMAKE_CURRENT_LIST_DIR}/../../..)
diff -Nur modules_orig/LLVMConfig.cmake.in modules/LLVMConfig.cmake.in --- modules_orig/LLVMConfig.cmake.in 2011-07-30 07:52:01 +0800 +++ modules/LLVMConfig.cmake.in 2012-03-12 14:59:11 +0800 @@ -16,7 +16,7 @@ set(TARGET_TRIPLE "@TARGET_TRIPLE@") -set(LLVM_TOOLS_BINARY_DIR @LLVM_TOOLS_BINARY_DIR@) +set(LLVM_TOOLS_BINARY_DIR ${CMAKE_CURRENT_LIST_DIR}/../../../bin) set(LLVM_ENABLE_THREADS @LLVM_ENABLE_THREADS@) @@ -29,7 +29,7 @@ set(LLVM_ON_UNIX @LLVM_ON_UNIX@) set(LLVM_ON_WIN32 @LLVM_ON_WIN32@) -set(LLVM_INSTALL_PREFIX @LLVM_INSTALL_PREFIX@) +set(LLVM_INSTALL_PREFIX ${CMAKE_CURRENT_LIST_DIR}/../../..) set(LLVM_INCLUDE_DIRS ${LLVM_INSTALL_PREFIX}/include) set(LLVM_LIBRARY_DIRS ${LLVM_INSTALL_PREFIX}/lib) set(LLVM_DEFINITIONS "-D__STDC_LIMIT_MACROS" "-D__STDC_CONSTANT_MACROS") @@ -43,7 +43,7 @@ if( NOT LLVMCONFIG_INCLUDED ) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} - "@LLVM_SOURCE_DIR@/cmake/modules") + "${LLVM_INSTALL_PREFIX}/share/llvm/cmake") include( LLVM-Config ) endif()
the above patch should fix the problem, hope to see it merged in the codebase
Created attachment 8793 [details] the patch this patch resolved the relocatable problem more reasonabaly, and make the uninstall build really worked for clients.
LLVM_TOOLS_BINARY_DIR is correct for installations and should be correct for make build systems but will not work under MSVC builds or xcode Build because they are in a per configuration dir, it's not so easy to solve this. the patch is tested under windows and msvc.
CMAKE_CURRENT_LIST_FILE variable is provide at least in cmake 2.6.4 version, so this should be enough?
This can be closed when Brads patches are merged.
(In reply to comment #7) > This can be closed when Brads patches are merged. Where are Brad's patches? There's no reference to Brad or his patches in this thread.
r201048 r201049 r201050 r201053 I didn't test them though.
I think these patches were all landed. Is there anything else to be done here?
Nope, this is done. I didn't test it, but we can assume Brad is making use of them.
Any reason to keep this bug report open?
This should be all completed.