On 20 July 2015 at 10:53, Brad King <brad.king at kitware.com> wrote:> On 07/20/2015 10:48 AM, Rafael Espíndola wrote: >>>> Setting CMAKE_CXX_CREATE_STATIC_LIBRARY works on OS X and linux, but >>>> on windows I still see a call to "lld-link2 /lib..." when >>>> CMAKE_CXX_CREATE_STATIC_LIBRARY is set to use llvm-lib. >> >> I was using ninja for windows too. > > Where does lld-link2 get chosen? CMake doesn't have code for that > name so something else in your project must be specifying it somehow.Yes, the simplest way to reproduce the problem is to run mkdir build cd build cmake ..\llvm -G Ninja -DCMAKE_CXX_CREATE_STATIC_LIBRARY=foobar -DCMAKE_LINKER=c:\users\espindola\llvm\inst\bin\lld-link2 and then ninja -v lib\LLVMSupport.lib I would expect it to fail trying to run foobar, but it works by running lld-link2 Cheers, Rafael
On 07/22/2015 11:38 AM, Rafael Espíndola wrote:> the simplest way to reproduce the problem is to run > > cmake ..\llvm -G Ninja -DCMAKE_CXX_CREATE_STATIC_LIBRARY=foobar -DCMAKE_LINKER=c:\users\espindola\llvm\inst\bin\lld-link2The Modules/Platform/Windows-MSVC.cmake module unconditionally sets CMAKE_CXX_CREATE_STATIC_LIBRARY and uses CMAKE_LINKER. As mentioned earlier the CMAKE_<LANG>_CREATE_STATIC_LIBRARY and similar variables are internal implementation details that are not meant to be set by users or project code. That is why the above works only on certain platforms. Will thin archive support be distributed as part of llvm-ar proper for general use or is this only for LLVM's own build? If it will be for general use then it may also be worthwhile teaching CMake this option directly. -Brad
> The Modules/Platform/Windows-MSVC.cmake module unconditionally > sets CMAKE_CXX_CREATE_STATIC_LIBRARY and uses CMAKE_LINKER. > As mentioned earlier the CMAKE_<LANG>_CREATE_STATIC_LIBRARY > and similar variables are internal implementation details > that are not meant to be set by users or project code. That > is why the above works only on certain platforms. > > Will thin archive support be distributed as part of llvm-ar > proper for general use or is this only for LLVM's own build? > If it will be for general use then it may also be worthwhile > teaching CMake this option directly.It is generally useful. The gnu ar already supports it. The implementation in llvm-ar is compatible with it. Making it available in llvm-lib is an extension over lib.exe. Cheers, Rafael