Index: CMakeLists.txt =================================================================== --- CMakeLists.txt +++ CMakeLists.txt @@ -31,6 +31,10 @@ option(COMPILER_RT_BUILD_XRAY "Build xray" ON) mark_as_advanced(COMPILER_RT_BUILD_XRAY) +set(COMPILER_RT_GENERIC_BUILD OFF CACHE BOOLEAN + "Build with the CMake options passed by the user and install with a generic name + to a generic location.") + if (COMPILER_RT_STANDALONE_BUILD) load_llvm_config() Index: cmake/Modules/AddCompilerRT.cmake =================================================================== --- cmake/Modules/AddCompilerRT.cmake +++ cmake/Modules/AddCompilerRT.cmake @@ -134,6 +134,14 @@ format_object_libs(sources_${libname} ${os} ${LIB_OBJECT_LIBS}) endif() endforeach() + elseif(COMPILER_RT_GENERIC_BUILD) + set(libname "${name}") + set(output_name_${libname} ${libname}${COMPILER_RT_OS_SUFFIX}) + message(STATUS "Setting libname to ${libname}") + message(STATUS "COMPILER_RT_OS_SUFFIX is ${COMPILER_RT_OS_SUFFIX}") + set(sources_${libname} ${LIB_SOURCES}) + set(libnames ${libnames} ${libname}) + set(extra_cflags_${libname} ${LIB_CFLAGS}) else() foreach(arch ${LIB_ARCHS}) if(NOT CAN_TARGET_${arch}) Index: cmake/base-config-ix.cmake =================================================================== --- cmake/base-config-ix.cmake +++ cmake/base-config-ix.cmake @@ -64,11 +64,17 @@ endif() string(TOLOWER ${CMAKE_SYSTEM_NAME} COMPILER_RT_OS_DIR) -set(COMPILER_RT_LIBRARY_OUTPUT_DIR - ${COMPILER_RT_OUTPUT_DIR}/lib/${COMPILER_RT_OS_DIR}) -set(COMPILER_RT_LIBRARY_INSTALL_DIR - ${COMPILER_RT_INSTALL_PATH}/lib/${COMPILER_RT_OS_DIR}) +if(COMPILER_RT_GENERIC_BUILD) + set(COMPILER_RT_LIBRARY_OUTPUT_DIR ${COMPILER_RT_OUTPUT_DIR}/lib) + set(COMPILER_RT_LIBRARY_INSTALL_DIR ${COMPILER_RT_INSTALL_PATH}/lib) +else() + set(COMPILER_RT_LIBRARY_OUTPUT_DIR + ${COMPILER_RT_OUTPUT_DIR}/lib/${COMPILER_RT_OS_DIR}) + set(COMPILER_RT_LIBRARY_INSTALL_DIR + ${COMPILER_RT_INSTALL_PATH}/lib/${COMPILER_RT_OS_DIR}) +endif() + if(APPLE) # On Darwin if /usr/include doesn't exist, the user probably has Xcode but not # the command line tools. If this is the case, we need to find the OS X