[cfe-dev] How to build both static and shared libs for libc++?

Charles Davis cdavis5x at gmail.com
Fri Apr 5 20:29:54 PDT 2013


On Apr 4, 2013, at 11:52 PM, Zack Perry wrote:

> Since early today, I have been trying to pick up CMake/CPack as far as
> I can so that I can build both static and shared libs for the libc++
> 3.3 from SVN. 
> 
> The goal is to create a RPM for RHEL 6.4.  The CPack part didn't take
> me long to finish.  But so far (as a CMake newbie), I am stumbled by 
> the CMakeLists.txt.
> 
>    40  option(LIBCXX_ENABLE_SHARED "Build libc++ as a shared library." ON)
>    41  
>    [...]
>   232  if (NOT LIBCXX_ENABLE_SHARED)
>   233    list(APPEND LIBCXX_CXX_FEATURE_FLAGS -D_LIBCPP_BUILD_STATIC)
>   234  endif()
> 
> Looking at the above, I tried two ways:
> 
> 0. Changing the ON to OFF in line 40. Got static lib built.
> 1. Keeping line 40 as is, I got shared lib
> 
> In line 232, taking out NOT, I still got shared lib.  Comment out 232
> and 234, I got shared lib again.
> 
> Could anyone kindly tell me what I missed?
I don't think the CMake files in libc++ are set up to build both shared and static at the same time. For now, you'll have to build twice: once shared, and once static. (Someone should really fix that. :)

Chip

> 
> Regards,
> 
> -- Zack
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev





More information about the cfe-dev mailing list