cmake: Prevent semicolon separated lists in llvm-config (PR17020)
[oota-llvm.git] / tools / llvm-config / CMakeLists.txt
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_system_libs(LLVM_SYSTEM_LIBS_LIST)
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 set(LLVM_LDFLAGS ${CMAKE_SHARED_LINKER_FLAGS})
20 set(LLVM_BUILDMODE ${CMAKE_BUILD_TYPE})
21 set(LLVM_SYSTEM_LIBS ${SYSTEM_LIBS})
22 string(REPLACE ";" " " LLVM_TARGETS_BUILT "${LLVM_TARGETS_TO_BUILD}")
23 configure_file(${BUILDVARIABLES_SRCPATH} ${BUILDVARIABLES_OBJPATH} @ONLY)
24
25 # Add the llvm-config tool.
26 add_llvm_tool(llvm-config
27   llvm-config.cpp
28   )
29
30 # Add the dependency on the generation step.
31 add_file_dependencies(${CMAKE_CURRENT_SOURCE_DIR}/llvm-config.cpp ${BUILDVARIABLES_OBJPATH})