hume npx <humeafo at gmail.com> writes: Sorry for commenting the bug report here, but I can't loging to bugzilla right now.> Using cmake should be the right thing if you'd like to support windows, but > it seems that no enough effort on this build system, eg > http://llvm.org/bugs/show_bug.cgi?id=12157 three months passed,There is indeed a problem with the value assigned to LLVM_TOOLS_BINARY_DIR in LLVMConfig.cmake.in because such value is valid for an uninstalled build, but not for an installed one, because on installing, LLVM_TOOLS_BINARY_DIR is not upated. As both build types should be usable for clients, the solution is to detect in LLVMConfig.cmake if it is being processed on an installed or uninstalled build and assign LLVM_TOOLS_BINARY_DIR accordingly. This can be done, for instance, comparing the values of CMAKE_CURRENT_LIST_FILE and LLVM_INSTALL_PREFIX, with the necessary adjustments. Ditto for LLVM_INCLUDE_DIRS and LLVM_LIB_DIRS. The other two variables your patch touches (LLVM_INSTALL_PREFIX and CMAKE_MODULE_PATH) does not need such corrections, as the former is precisely the *intended* location for an installed build and the later needs modification only for uninstalled builds, as the comment above the IF hints. Apart from that, your patch seems wrong for me because you are using CMAKE_CURRENT_LIST_DIR. Such method only gives the desired result for uninstalled, in-source builds.> I'am I bit > familiar with cmake, so if there tasks pending for absence of developer, > I'd like to join.Chandler is doing a great job at maintaining the CMake scripts, but I'm sure he will welcome any help others can offer.> cmake is not perfect but it's open, but many improvements maybe merged > upstream.[snip]
Hi, Óscar: nice to hear some voice on this. about LLVM_TOOLS_BINARY_DIR, yes, it made the installed version work only, if you'd like the uninstalled version to work, it should be detected as you suggested. about LLVM_INSTALL_PREFIX the purpose is to make it really relocatable, eg, when installed under /lib/llvm I just later need to move the installation tree to /lusr/local/lib/llvm without re-run cmake and the time-boring build/install process, and this is especially convinient on Windows. Use CMAKE_CURRENT_LIST_DIR while not the absolute predefined LLVM_INSTALL_PREFIX is just to give the freedom to this, if just installed and not moved, this will work identical to the value original absolute LLVM_INSTALL_PREFIX points. CMAKE_MODULE_PATH should be corrected for installed version, it's still points to the source tree location while not the install tree location, if you removed/moved the source tree after installation, the installed version will not work properly, surely this is not we wanted? as to uninstalled support, I think current script doesn'tsupport the cmake usage properly, If this is needed, some further work should be made. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120629/87bba845/attachment.html>
hume npx <humeafo at gmail.com> writes:> Hi, Óscar: > nice to hear some voice on this. about LLVM_TOOLS_BINARY_DIR, yes, it > made the installed version work only, if you'd like the uninstalled version > to work, it should be detected as you suggested. > > about LLVM_INSTALL_PREFIX the purpose is to make it really relocatable, > eg, when installed under /lib/llvm I just later need to move the > installation tree to /lusr/local/lib/llvm without re-run cmake and the > time-boring build/install process, and this is especially convinient on > Windows.LLVM_INSTALL_PREFIX is supposed to contain the value of CMAKE_INSTALL_PREFIX when you configured LLVM. Using it for setting other variables is just a convenience.> Use CMAKE_CURRENT_LIST_DIR while not the absolute predefined > LLVM_INSTALL_PREFIX is just to give the freedom to this, if just installed and > not moved, this will work identical to the value original absolute > LLVM_INSTALL_PREFIX points.I've never heard CMAKE_CURRENT_LIST_DIR until now. In fact, it was introduced in cmake 2.8.3 while the LLVM CMake scripts require just 2.8. The solution may work indeed, but I'm always reluctant to increase the minimum required version because there are users who can't easily upgrade their CMake install. Let's see what Chandler says. CMAKE_CURRENT_LIST_FILE can be used instead (just take the directory part) but I don't know when it was introduced. In http://www.cmake.org/Wiki/CMake_Useful_Variables CMAKE_CURRENT_LIST_DIR is labeled as 2.8.3 but there is no mention to the version that introduced CMAKE_CURRENT_LIST_FILE.> CMAKE_MODULE_PATH should be corrected for installed version,No, it is the responsability of the user to adjust CMAKE_MODULE_PATH for containing the directory where LLVMConfig.cmake is. See http://llvm.org/docs/CMake.html#embedding For an uninstalled build, the cmake scripts on the source directory are necessary as well, so its directory is automatically added on LLVMConfig.cmake.> it's still > points to the source tree location while not the install tree location, if > you removed/moved the source tree after installation, the installed version > will not work properly, surely this is not we wanted?No, see again how that code block begins: # If failed, we assume that this is an un-installed build: if( NOT LLVMCONFIG_INCLUDED ) that means that CMAKE_MODULE_PATH is only modified for an uninstalled build.> as to uninstalled support, I think current script doesn'tsupport the cmake > usage properly,Why? Please describe a case.> If this is needed, some further work should be made.