CMake: Update to use standard CMake dependency tracking facilities instead

of whatever we were using before...

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113631 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Michael J. Spencer 2010-09-10 21:13:16 +00:00
Родитель ce5eff5c81
Коммит 5a7f34958c
21 изменённых файлов: 256 добавлений и 168 удалений

Просмотреть файл

@ -24,7 +24,7 @@ if( NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR )
endif()
# Compute the Clang version from the LLVM version.
string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION
string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION
${PACKAGE_VERSION})
message(STATUS "Clang version: ${CLANG_VERSION}")
@ -63,7 +63,7 @@ macro(add_clang_library name)
set(srcs ${srcs} ${headers})
string( REGEX MATCHALL "/[^/]+" split_path ${CMAKE_CURRENT_SOURCE_DIR})
list( GET split_path -1 dir)
file( GLOB_RECURSE headers
file( GLOB_RECURSE headers
../../include/clang${dir}/*.h
../../include/clang${dir}/*.td
../../include/clang${dir}/*.def)
@ -92,6 +92,9 @@ macro(add_clang_library name)
if( llvm_system_libs )
target_link_libraries(${name} ${llvm_system_libs})
endif( llvm_system_libs )
if (LLVM_COMMON_LIBS)
target_link_libraries(${name} ${LLVM_COMMON_LIBS})
endif()
add_dependencies(${name} ClangDiagnosticCommon)
if(MSVC)
get_target_property(cflag ${name} COMPILE_FLAGS)
@ -102,6 +105,7 @@ macro(add_clang_library name)
set_target_properties(${name} PROPERTIES COMPILE_FLAGS ${cflag})
endif(MSVC)
install(TARGETS ${name}
EXPORT LLVM
LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
endmacro(add_clang_library)

Просмотреть файл

@ -2,7 +2,16 @@ set(MODULE TRUE)
set(LLVM_NO_RTTI 1)
add_clang_library(PrintFunctionNames PrintFunctionNames.cpp)
add_clang_library(PrintFunctionNames
PrintFunctionNames.cpp
)
target_link_libraries(PrintFunctionNames
clangAST
clangFrontend
clangBasic
)
set_target_properties(PrintFunctionNames
PROPERTIES

Просмотреть файл

@ -1,34 +1,24 @@
set(LLVM_NO_RTTI 1)
set(LLVM_USED_LIBS
clangFrontend
clangSerialization
clangDriver
clangCodeGen
clangSema
clangChecker
clangIndex
clangAnalysis
clangRewrite
clangAST
clangParse
clangLex
clangBasic
)
set(LLVM_LINK_COMPONENTS
jit
interpreter
nativecodegen
asmparser
bitreader
bitwriter
codegen
ipo
selectiondag
)
add_clang_executable(clang-interpreter
main.cpp
)
add_llvm_link_components(clang-interpreter jit interpreter nativecodegen)
target_link_libraries(clang-interpreter
clangFrontend
clangSerialization
clangDriver
clangCodeGen
clangSema
clangChecker
clangIndex
clangAnalysis
clangRewrite
clangAST
clangParse
clangLex
clangBasic
)
add_dependencies(clang-interpreter clang-headers)

Просмотреть файл

@ -1,6 +1,10 @@
set(LLVM_NO_RTTI 1)
set(LLVM_USED_LIBS
add_clang_executable(clang-wpa
clang-wpa.cpp
)
target_link_libraries(clang-wpa
clangIndex
clangFrontend
clangDriver
@ -12,15 +16,9 @@ set(LLVM_USED_LIBS
clangAST
clangParse
clangLex
clangBasic)
set( LLVM_LINK_COMPONENTS
bitreader
mc
core
clangBasic
)
add_clang_executable(clang-wpa
clang-wpa.cpp
add_dependencies(clang-wpa
clang-headers
)
add_dependencies(clang-wpa clang-headers)

Просмотреть файл

@ -1,7 +1,5 @@
set(LLVM_NO_RTTI 1)
set(LLVM_USED_LIBS clangBasic)
add_clang_library(clangAST
APValue.cpp
ASTConsumer.cpp
@ -44,5 +42,16 @@ add_clang_library(clangAST
TypePrinter.cpp
)
add_dependencies(clangAST ClangARMNeon ClangAttrClasses ClangAttrList
ClangAttrImpl ClangDiagnosticAST ClangDeclNodes ClangStmtNodes)
target_link_libraries(clangAST
clangBasic
)
add_dependencies(clangAST
ClangARMNeon
ClangAttrClasses
ClangAttrList
ClangAttrImpl
ClangDiagnosticAST
ClangDeclNodes
ClangStmtNodes
)

Просмотреть файл

@ -1,7 +1,5 @@
set(LLVM_NO_RTTI 1)
set(LLVM_USED_LIBS clangBasic clangAST clangIndex)
add_clang_library(clangAnalysis
AnalysisContext.cpp
CFG.cpp
@ -15,5 +13,16 @@ add_clang_library(clangAnalysis
UninitializedValues.cpp
)
add_dependencies(clangAnalysis ClangAttrClasses ClangAttrList
ClangDiagnosticAnalysis ClangDeclNodes ClangStmtNodes)
target_link_libraries(clangAnalysis
clangBasic
clangAST
clangIndex
)
add_dependencies(clangAnalysis
ClangAttrClasses
ClangAttrList
ClangDiagnosticAnalysis
ClangDeclNodes
ClangStmtNodes
)

Просмотреть файл

@ -14,6 +14,10 @@ add_clang_library(clangBasic
Version.cpp
)
target_link_libraries(clangBasic
LLVMMC
)
# Determine Subversion revision.
# FIXME: This only gets updated when CMake is run, so this revision number
# may be out-of-date!
@ -24,16 +28,17 @@ if (Subversion_FOUND AND EXISTS "${CLANG_SOURCE_DIR}/.svn")
PROPERTIES COMPILE_DEFINITIONS "SVN_REVISION=\"${CLANG_WC_REVISION}\"")
endif()
add_dependencies(clangBasic
ClangARMNeon
ClangAttrList
ClangDiagnosticAnalysis
ClangDiagnosticAST
ClangDiagnosticCommon
ClangDiagnosticDriver
ClangDiagnosticFrontend
ClangDiagnosticGroups
ClangDiagnosticLex
ClangDiagnosticParse
ClangDiagnosticSema)
add_dependencies(clangBasic
ClangARMNeon
ClangAttrList
ClangDiagnosticAnalysis
ClangDiagnosticAST
ClangDiagnosticCommon
ClangDiagnosticDriver
ClangDiagnosticFrontend
ClangDiagnosticGroups
ClangDiagnosticLex
ClangDiagnosticParse
ClangDiagnosticSema
)

Просмотреть файл

@ -1,7 +1,5 @@
set(LLVM_NO_RTTI 1)
set(LLVM_USED_LIBS clangBasic clangLex clangAST clangFrontend clangRewrite)
add_clang_library(clangChecker
AdjustedReturnValueChecker.cpp
AggExprVisitor.cpp
@ -84,5 +82,17 @@ add_clang_library(clangChecker
ValueManager.cpp
)
add_dependencies(clangChecker ClangAttrClasses ClangAttrList ClangDeclNodes
ClangStmtNodes)
target_link_libraries(clangChecker
clangBasic
clangLex
clangAST
clangFrontend
clangRewrite
)
add_dependencies(clangChecker
ClangAttrClasses
ClangAttrList
ClangDeclNodes
ClangStmtNodes
)

Просмотреть файл

@ -1,7 +1,5 @@
set(LLVM_NO_RTTI 1)
set(LLVM_USED_LIBS clangBasic clangAST clangFrontend)
add_clang_library(clangCodeGen
BackendUtil.cpp
CGBlocks.cpp
@ -39,5 +37,17 @@ add_clang_library(clangCodeGen
TargetInfo.cpp
)
add_dependencies(clangCodeGen ClangAttrClasses ClangAttrList ClangDeclNodes
ClangStmtNodes)
target_link_libraries(clangCodeGen
LLVMCore
LLVMAsmParser
LLVMBitReader
LLVMBitWriter
LLVMipo
)
add_dependencies(clangCodeGen
ClangAttrClasses
ClangAttrList
ClangDeclNodes
ClangStmtNodes
)

Просмотреть файл

@ -1,7 +1,5 @@
set(LLVM_NO_RTTI 1)
set(LLVM_USED_LIBS clangBasic clangAST clangParse)
add_clang_library(clangDriver
Action.cpp
Arg.cpp
@ -23,5 +21,16 @@ add_clang_library(clangDriver
Types.cpp
)
add_dependencies(clangDriver ClangAttrList ClangDiagnosticDriver
ClangDriverOptions ClangCC1Options ClangCC1AsOptions)
target_link_libraries(clangDriver
clangBasic
clangAST
clangParse
)
add_dependencies(clangDriver
ClangAttrList
ClangDiagnosticDriver
ClangDriverOptions
ClangCC1Options
ClangCC1AsOptions
)

Просмотреть файл

@ -1,14 +1,5 @@
set(LLVM_NO_RTTI 1)
set( LLVM_USED_LIBS
clangDriver
clangParse
clangSema
clangAST
clangLex
clangBasic
)
add_clang_library(clangFrontend
ASTConsumers.cpp
ASTMerge.cpp
@ -36,6 +27,17 @@ add_clang_library(clangFrontend
Warnings.cpp
)
target_link_libraries(clangFrontend
LLVMCore
clangDriver
clangParse
clangSema
clangAST
clangLex
clangBasic
)
IF(MSVC)
get_target_property(NON_ANSI_COMPILE_FLAGS clangFrontend COMPILE_FLAGS)
string(REPLACE /Za
@ -44,12 +46,13 @@ IF(MSVC)
set_target_properties(clangFrontend PROPERTIES COMPILE_FLAGS ${NON_ANSI_COMPILE_FLAGS})
ENDIF(MSVC)
add_dependencies(clangFrontend
add_dependencies(clangFrontend
ClangAttrClasses
ClangAttrList
ClangCC1Options
ClangDiagnosticFrontend
ClangDiagnosticFrontend
ClangDiagnosticLex
ClangDiagnosticSema
ClangDeclNodes
ClangStmtNodes)
ClangStmtNodes
)

Просмотреть файл

@ -1,8 +1,13 @@
set(LLVM_NO_RTTI 1)
set(LLVM_USED_LIBS clangDriver clangFrontend clangRewrite clangCodeGen
clangChecker)
add_clang_library(clangFrontendTool
ExecuteCompilerInvocation.cpp
)
target_link_libraries(clangFrontendTool
clangDriver
clangFrontend
clangRewrite
clangCodeGen
clangChecker
)

Просмотреть файл

@ -1,21 +1,5 @@
set(LLVM_NO_RTTI 1)
set(LLVM_USED_LIBS clangBasic clangLex clangAST)
set( LLVM_USED_LIBS
clangSerialization
clangFrontend
clangParse
clangSema
clangChecker
clangAnalysis
clangIndex
clangRewrite
clangAST
clangLex
clangBasic
)
add_clang_library(clangIndex
ASTLocation.cpp
Analyzer.cpp
@ -30,5 +14,23 @@ add_clang_library(clangIndex
SelectorMap.cpp
)
add_dependencies(clangIndex ClangAttrClasses ClangAttrList
ClangDeclNodes ClangStmtNodes)
target_link_libraries(clangIndex
clangSerialization
clangFrontend
clangParse
clangSema
clangChecker
clangAnalysis
clangIndex
clangRewrite
clangAST
clangLex
clangBasic
)
add_dependencies(clangIndex
ClangAttrClasses
ClangAttrList
ClangDeclNodes
ClangStmtNodes
)

Просмотреть файл

@ -2,8 +2,6 @@ set(LLVM_NO_RTTI 1)
# TODO: Add -maltivec when ARCH is PowerPC.
set(LLVM_USED_LIBS clangBasic)
add_clang_library(clangLex
HeaderMap.cpp
HeaderSearch.cpp
@ -26,4 +24,10 @@ add_clang_library(clangLex
TokenLexer.cpp
)
add_dependencies(clangLex ClangDiagnosticLex)
target_link_libraries(clangLex
clangBasic
)
add_dependencies(clangLex
ClangDiagnosticLex
)

Просмотреть файл

@ -1,7 +1,5 @@
set(LLVM_NO_RTTI 1)
set(LLVM_USED_LIBS clangBasic clangAST clangLex clangSema)
add_clang_library(clangParse
ParseAST.cpp
ParseCXXInlineMethods.cpp
@ -18,4 +16,17 @@ add_clang_library(clangParse
Parser.cpp
)
add_dependencies(clangParse ClangAttrClasses ClangAttrList ClangDeclNodes ClangDiagnosticParse ClangStmtNodes)
target_link_libraries(clangParse
clangBasic
clangAST
clangLex
clangSema
)
add_dependencies(clangParse
ClangAttrClasses
ClangAttrList
ClangDeclNodes
ClangDiagnosticParse
ClangStmtNodes
)

Просмотреть файл

@ -1,7 +1,5 @@
set(LLVM_NO_RTTI 1)
set(LLVM_USED_LIBS clangBasic clangAST clangParse clangFrontend)
add_clang_library(clangRewrite
DeltaTree.cpp
FixItRewriter.cpp
@ -16,8 +14,16 @@ add_clang_library(clangRewrite
TokenRewriter.cpp
)
target_link_libraries(clangRewrite
clangBasic
clangAST
clangParse
clangFrontend
)
add_dependencies(clangRewrite
ClangAttrClasses
ClangAttrList
ClangDeclNodes
ClangStmtNodes)
ClangStmtNodes
)

Просмотреть файл

@ -1,7 +1,5 @@
set(LLVM_NO_RTTI 1)
set(LLVM_USED_LIBS clangBasic clangAST clangLex clangAnalysis)
add_clang_library(clangSema
AnalysisBasedWarnings.cpp
AttributeList.cpp
@ -37,5 +35,15 @@ add_clang_library(clangSema
TargetAttributesSema.cpp
)
add_dependencies(clangSema ClangARMNeon ClangAttrClasses ClangAttrList
ClangDiagnosticSema ClangDeclNodes ClangStmtNodes)
target_link_libraries(clangSema
clangAnalysis
)
add_dependencies(clangSema
ClangARMNeon
ClangAttrClasses
ClangAttrList
ClangDiagnosticSema
ClangDeclNodes
ClangStmtNodes
)

Просмотреть файл

@ -1,7 +1,5 @@
set(LLVM_NO_RTTI 1)
set(LLVM_USED_LIBS clangFrontend)
add_clang_library(clangSerialization
GeneratePCH.cpp
ASTCommon.cpp
@ -13,6 +11,10 @@ add_clang_library(clangSerialization
ASTWriterStmt.cpp
)
target_link_libraries(clangSerialization
clangFrontend
)
add_dependencies(clangSerialization
ClangAttrClasses
ClangAttrList
@ -22,4 +24,5 @@ add_dependencies(clangSerialization
ClangDiagnosticLex
ClangDiagnosticSema
ClangDeclNodes
ClangStmtNodes)
ClangStmtNodes
)

Просмотреть файл

@ -1,17 +1,13 @@
set(LLVM_NO_RTTI 1)
set(LLVM_USED_LIBS libclang)
set( LLVM_LINK_COMPONENTS
bitreader
mc
core
)
add_clang_executable(c-index-test
c-index-test.c
)
target_link_libraries(c-index-test
libclang
)
set_target_properties(c-index-test
PROPERTIES
LINKER_LANGUAGE CXX)

Просмотреть файл

@ -1,6 +1,20 @@
set(LLVM_NO_RTTI 1)
set( LLVM_USED_LIBS
add_clang_executable(clang
driver.cpp
cc1_main.cpp
cc1as_main.cpp
)
add_llvm_link_components(clang all)
target_link_libraries(clang
LLVMAsmParser
LLVMBitReader
LLVMBitWriter
LLVMCodeGen
LLVMipo
LLVMSelectionDAG
clangFrontendTool
clangFrontend
clangDriver
@ -17,22 +31,6 @@ set( LLVM_USED_LIBS
clangBasic
)
set( LLVM_LINK_COMPONENTS
${LLVM_TARGETS_TO_BUILD}
asmparser
bitreader
bitwriter
codegen
ipo
selectiondag
)
add_clang_executable(clang
driver.cpp
cc1_main.cpp
cc1as_main.cpp
)
if(UNIX)
set(CLANGXX_LINK_OR_COPY create_symlink)
set(CLANGXX_DESTDIR $ENV{DESTDIR}/)

Просмотреть файл

@ -2,22 +2,6 @@ set(SHARED_LIBRARY TRUE)
set(LLVM_NO_RTTI 1)
set(LLVM_USED_LIBS
clangFrontend
clangDriver
clangSerialization
clangIndex
clangSema
clangAST
clangLex
clangBasic)
set( LLVM_LINK_COMPONENTS
bitreader
mc
core
)
add_clang_library(libclang
CIndex.cpp
CIndexCXX.cpp
@ -29,19 +13,34 @@ add_clang_library(libclang
CXCursor.cpp
CXType.cpp
../../include/clang-c/Index.h
)
)
target_link_libraries(libclang
LLVMBitReader
LLVMMC
LLVMCore
clangFrontend
clangDriver
clangSerialization
clangIndex
clangSema
clangAST
clangLex
clangBasic
)
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
# dylib versioning information
# FIXME: Is there a more CMake-ish way to handle this?
set(LIBCLANG_VERSION 1
set(LIBCLANG_VERSION 1
CACHE STRING "Version number of the libclang library")
set(LIBCLANG_SUBVERSION 0
CACHE STRING "Minor version number of the libclang library")
set(LIBCLANG_LINK_FLAGS
set(LIBCLANG_LINK_FLAGS
"-Wl,-current_version -Wl,${LIBCLANG_VERSION}.${LIBCLANG_SUBVERSION} -Wl,-compatibility_version -Wl,1")
set(LIBCLANG_LINK_FLAGS
set(LIBCLANG_LINK_FLAGS
"${LIBCLANG_LINK_FLAGS} -Wl,-dead_strip -Wl,-seg1addr -Wl,0xE0000000")
set_target_properties(libclang