r294954 - Fix r291495 -- Normalize LLVM_CMAKE_PATH in clang standalone build.

Michał Górny via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 17 11:50:34 PST 2017


W dniu 16.02.2017, czw o godzinie 08∶17 +0000, użytkownik NAKAMURA
Takumi napisał:
> Michał,
> 
> It'd make sense to use file(TO_CMAKE_PATH). I forgot it.
> I think get_file_component() satisfies in this case. Do you think to use
> file(TO_CMAKE_PATH) anyways?
> I'll wait for you as an opinion before proposing this fix to release_40.
> The bug is still in release_40.

I won't say it's very important but I'd rather have it done
consistently, just in case it could break something.

> 
> I don't think we could twiddle llvm-config stuff in future. FYI, I explain
> its history.
> 
> - When autoconf was alive, I tweaked it to let cmake configure against
> installed tree generated by autoconf.
> - Brad King (@kitware) proposed a mechanism for autoconf to provide cmake
> information in llvm.
> - Autoconf was killed.
> 
> In the ecosystem of cmake, we may go w/o llvm-config but find_package() by
> cmake's way.
> Then, I suggest to rip out llvm-config here.
> 
> Why I introduced cache variables for items supplied by llvm-config;
> I thought they are configurable w/o autoconf to specify their variables
> manually.

I generally support the idea of ridding of llvm-config whenever
possible. I simply didn't have the time to play with CMake more, so went
for the easiest solution that solved my problem.

> 
> BTW, do you think if llvm-config had an option like "--emit-cmake-tmpl"
> to help creating cmake project?

Nah, I think that would be too much. I'd rather keep it providing
whatever it needs to provide, and eventually discourage it.

One issue that needs to be solved long term, however, is how to properly
find CMake modules with different libdir/multilib systems. I'm thinking
of stand-alone runtime builds in particular.

For example, when building libcxx separately for three different ABIs,
all of them need to use CMake files from the host build of LLVM. It may
require splitting CMake files more; having things like LLVMConfig in
lib*/cmake and generic LLVM macros in share.

> 
> On Tue, Feb 14, 2017 at 12:45 AM Michał Górny <mgorny at gentoo.org> wrote:
> 
> > W dniu 13.02.2017, pon o godzinie 14∶59 +0000, użytkownik NAKAMURA
> > Takumi via cfe-commits napisał:
> > > Author: chapuni
> > > Date: Mon Feb 13 08:59:53 2017
> > > New Revision: 294954
> > > 
> > > URL: http://llvm.org/viewvc/llvm-project?rev=294954&view=rev
> > > Log:
> > > Fix r291495 -- Normalize LLVM_CMAKE_PATH in clang standalone build.
> > > 
> > > CMake handles paths with slashes. It caused cmake/install failure on
> > 
> > msbuild.exe.
> > > 
> > > Note, Other llvm-config-oriented variables have been normalized since
> > 
> > they are stored in the cache attributed with PATH.
> > > 
> > > Modified:
> > >     cfe/trunk/CMakeLists.txt
> > > 
> > > Modified: cfe/trunk/CMakeLists.txt
> > > URL:
> > 
> > http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.txt?rev=294954&r1=294953&r2=294954&view=diff
> > > 
> > 
> > ==============================================================================
> > > --- cfe/trunk/CMakeLists.txt (original)
> > > +++ cfe/trunk/CMakeLists.txt Mon Feb 13 08:59:53 2017
> > > @@ -42,7 +42,7 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURR
> > >    list(GET CONFIG_OUTPUT 3 INCLUDE_DIR)
> > >    list(GET CONFIG_OUTPUT 4 LLVM_OBJ_ROOT)
> > >    list(GET CONFIG_OUTPUT 5 MAIN_SRC_DIR)
> > > -  list(GET CONFIG_OUTPUT 6 LLVM_CMAKE_PATH)
> > > +  list(GET CONFIG_OUTPUT 6 LLVM_CONFIG_CMAKE_PATH)
> > > 
> > >    if(NOT MSVC_IDE)
> > >      set(LLVM_ENABLE_ASSERTIONS ${ENABLE_ASSERTIONS}
> > > @@ -57,6 +57,10 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURR
> > >    set(LLVM_BINARY_DIR ${LLVM_OBJ_ROOT} CACHE PATH "Path to LLVM build
> > 
> > tree")
> > >    set(LLVM_MAIN_SRC_DIR ${MAIN_SRC_DIR} CACHE PATH "Path to LLVM source
> > 
> > tree")
> > > 
> > > +  # Normalize LLVM_CMAKE_PATH. --cmakedir might contain backslashes.
> > > +  # CMake assumes slashes as PATH.
> > > +  get_filename_component(LLVM_CMAKE_PATH ${LLVM_CONFIG_CMAKE_PATH}
> > 
> > ABSOLUTE)
> > 
> > Are you sure this is the best way of doing it? I'm not a Windows expert
> > but I've seen others using file(TO_CMAKE_PATH ...) for what I suppose
> > was the same goal.
> > 
> > > +
> > >    find_program(LLVM_TABLEGEN_EXE "llvm-tblgen" ${LLVM_TOOLS_BINARY_DIR}
> > >      NO_DEFAULT_PATH)
> > > 
> > > 
> > > 
> > > _______________________________________________
> > > cfe-commits mailing list
> > > cfe-commits at lists.llvm.org
> > > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
> > 
> > --
> > Best regards,
> > Michał Górny
> > 

-- 
Best regards,
Michał Górny
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 963 bytes
Desc: This is a digitally signed message part
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170217/4b366615/attachment-0001.sig>


More information about the cfe-commits mailing list