How to build n install both static and shared llvm/clang libraries

Greetings,

Could you please let me know how to build and install both static and shared llvm/clang libraries (e.g libclang.{a,so}, libclangAnalysis.{a,so}, libLLVMCore.{a,so}, libLTO.{a,so} etc.)?

I am using following CMake options…

<cmake_options>

cmake …/$ROOTDIR -G “Unix Makefiles” \

-DCMAKE_INSTALL_PREFIX=$PREFIX_DIR \

-DCMAKE_C_COMPILER=$GCC_ROOT/bin/gcc \

-DCMAKE_CXX_COMPILER=$GCC_ROOT/bin/g++ \

-DGCC_INSTALL_PREFIX=$GCC_ROOT \

-DCMAKE_CXX_LINK_FLAGS=“$LDFLAGS” \

-DLLVM_ENABLE_ASSERTIONS=ON \

-DLLVM_BINUTILS_INCDIR=${DESTROOT}/include \

-DLLVM_ENABLE_FFI=ON \

-DFFI_LIBRARY_DIR=$DESTROOT/lib \

-DFFI_INCLUDE_DIR=$DESTROOT/lib/libffi-3.0.11/include \

-DBUILD_SHARED_LIBS=ON \

-DLLVM_ENABLE_LIBCXX=ON \

-DCMAKE_SYSTEM_INCLUDE_PATH=$imp_inc_path \

-DCMAKE_SYSTEM_LIBRARY_PATH=$imp_lib_path \

-DCMAKE_BUILD_TYPE=“Release” \

-DLLVM_TARGETS_TO_BUILD=X86 \

-DLLVM_OPTIMIZED_TABLEGEN=ON \

-DLLVM_INCLUDE_UTILS=ON \

-DLLVM_INCLUDE_EXAMPLES=ON \

-DLLVM_BUILD_EXAMPLES=ON \

-DCMAKE_SKIP_INSTALL_RPATH=OFF -DCMAKE_SKIP_RPATH=OFF

</cmake_options>

Thank you.

-Hiral