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

Zack Perry zack.perry at sbcglobal.net
Thu Apr 4 22:52:58 PDT 2013


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?

Regards,

-- Zack



More information about the cfe-dev mailing list