1 set(LLVM_LINK_COMPONENTS support) 2 3 set(BUILDVARIABLES_SRCPATH ${CMAKE_CURRENT_SOURCE_DIR}/BuildVariables.inc.in) 4 set(BUILDVARIABLES_OBJPATH ${CMAKE_CURRENT_BINARY_DIR}/BuildVariables.inc) 5 6 # Compute the substitution values for various items. 7 get_property(LLVM_SYSTEM_LIBS_LIST TARGET LLVMSupport PROPERTY LLVM_SYSTEM_LIBS) 8 foreach(l ${LLVM_SYSTEM_LIBS_LIST}) 9 set(SYSTEM_LIBS ${SYSTEM_LIBS} "-l${l}") 10 endforeach() 11 string(REPLACE ";" " " SYSTEM_LIBS "${SYSTEM_LIBS}") 12 13 # Use configure_file to create BuildVariables.inc. 14 set(LLVM_SRC_ROOT ${LLVM_MAIN_SRC_DIR}) 15 set(LLVM_OBJ_ROOT ${LLVM_BINARY_DIR}) 16 set(LLVM_CPPFLAGS "${CMAKE_CPP_FLAGS} ${CMAKE_CPP_FLAGS_${uppercase_CMAKE_BUILD_TYPE}} ${LLVM_DEFINITIONS}") 17 set(LLVM_CFLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${uppercase_CMAKE_BUILD_TYPE}} ${LLVM_DEFINITIONS}") 18 set(LLVM_CXXFLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${uppercase_CMAKE_BUILD_TYPE}} ${LLVM_DEFINITIONS}") 19 # Use the C++ link flags, since they should be a superset of C link flags. 20 set(LLVM_LDFLAGS "${CMAKE_CXX_LINK_FLAGS}") 21 set(LLVM_BUILDMODE ${CMAKE_BUILD_TYPE}) 22 set(LLVM_SYSTEM_LIBS ${SYSTEM_LIBS}) 23 string(REPLACE ";" " " LLVM_TARGETS_BUILT "${LLVM_TARGETS_TO_BUILD}") 24 configure_file(${BUILDVARIABLES_SRCPATH} ${BUILDVARIABLES_OBJPATH} @ONLY) 25 26 # Set build-time environment(s). 27 add_definitions(-DCMAKE_CFG_INTDIR="${CMAKE_CFG_INTDIR}") 28 29 # Add the llvm-config tool. 30 add_llvm_tool(llvm-config 31 llvm-config.cpp 32 ) 33 34 # Add the dependency on the generation step. 35 add_file_dependencies(${CMAKE_CURRENT_SOURCE_DIR}/llvm-config.cpp ${BUILDVARIABLES_OBJPATH}) 36