Make targets added with add_llvm_loadable_module macro to be in their named components rather than end up in Unspecified one.
Diff Detail
- Repository
- rL LLVM
Event Timeline
I looked at the documentation for the cmake install command, but I still have no idea what a component is or what effect this option has. Can you elaborate on that?
D51748 proposes refactoring this whole function and effectively makes the same change. Would you be able to test this to see if it helps your uses case?
Component here is named portion of installed files. We need finer grain control over installation process (specifically need to be able to install just LLVMgold.so):
cmake -DCOMPONENT=LLVMgold -P cmake_install.cmake
Now it falls into Unspecified component name with tons of other stuff.
Unfortunately the patch "as is" failed at makefiles generation (cmake -G "Unix Makefiles" ...) with number of error messages like one below:
CMake Error at cmake/modules/LLVM-Config.cmake:105 (target_link_libraries):
Target "LLVMHello" of type MODULE_LIBRARY may not be linked into another target. One may link only to STATIC or SHARED libraries, or to executables with the ENABLE_EXPORTS property set.
Call Stack (most recent call first):
cmake/modules/LLVM-Config.cmake:93 (explicit_llvm_config) cmake/modules/AddLLVM.cmake:750 (llvm_config) cmake/modules/AddLLVM.cmake:887 (add_llvm_executable) examples/Kaleidoscope/CMakeLists.txt:6 (add_llvm_example) examples/Kaleidoscope/Chapter8/CMakeLists.txt:5 (add_kaleidoscope_chapter)
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD="X86" -DCMAKE_INSTALL_PREFIX="/your/install/dir" "/local/ll.org/source/root/llvm"
$ cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.2 (Maipo)
$ uname -sr
Linux 3.10.0-327.el7.x86_64
The latest patch version seems to work fine. Thanks!
May suggest you to not guard against creating install target for MODULE? (if it does not create any problem)
if (NOT CMAKE_CONFIGURATION_TYPES) add_llvm_install_targets(install-${name} DEPENDS ${name} COMPONENT ${name}) endif()
Updated. If you have any more feedback you can leave it on the review for the other patch.