[patch] Don't force the build of toos/lto as a static lib

Alp Toker alp at nuanti.com
Thu Jun 19 18:37:01 PDT 2014


On 20/06/2014 03:57, Rafael EspĂ­ndola wrote:
> Any uses of tools/lto as a static lib should probably move to lib/LTO.
>
> Cheers,
> Rafael
>
> t.patch
>
>
> diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt
> index 13b7f5a..846ad1e 100644
> --- a/tools/CMakeLists.txt
> +++ b/tools/CMakeLists.txt
> @@ -49,7 +49,7 @@ add_llvm_tool_subdirectory(llvm-c-test)
>   add_llvm_tool_subdirectory(obj2yaml)
>   add_llvm_tool_subdirectory(yaml2obj)
>   
> -if( NOT CYGWIN )
> +if(NOT CYGWIN AND LLVM_ENABLE_PIC)
>     add_llvm_tool_subdirectory(lto)
>     add_llvm_tool_subdirectory(llvm-lto)
>   else()
> diff --git a/tools/lto/CMakeLists.txt b/tools/lto/CMakeLists.txt
> index 542053b..71391b7 100644
> --- a/tools/lto/CMakeLists.txt
> +++ b/tools/lto/CMakeLists.txt
> @@ -16,11 +16,7 @@ set(SOURCES
>   
>   set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/lto.exports)
>   
> -if(NOT CYGWIN AND LLVM_ENABLE_PIC)
> -  set(ENABLE_SHARED SHARED)
> -endif()
> -
> -add_llvm_library(LTO ${ENABLE_SHARED} STATIC ${SOURCES})
> +add_llvm_library(LTO SHARED ${SOURCES})

Incidentally, that line was probably faulty. CMake HEAD reports:

   Target "LTO_static" contains $<TARGET_OBJECTS> generator expression 
in its
   sources list.  This content was not previously part of the SOURCES 
property
   when that property was read at configure time.  Code reading that 
property
   needs to be adapted to ignore the generator expression using the
   string(GENEX_STRIP) command.

I haven't tried but the add_llvm_library() change in your patch looks 
like it will resolve the problem.

Alp.

>   
>   install(FILES ${LLVM_MAIN_INCLUDE_DIR}/llvm-c/lto.h
>     DESTINATION include/llvm-c)
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

-- 
http://www.nuanti.com
the browser experts




More information about the llvm-commits mailing list