blob: 6ed32d9578b17472151a164258deaae8ed7b52d0 [file] [log] [blame]
Douglas Gregor7f7b7482009-08-23 05:28:29 +00001# Clang version information
Mike Stumpf918b8f2009-09-16 01:26:05 +00002# FIXME: get from a file called ./VER
Douglas Gregor291fbde2009-09-15 22:30:13 +00003set(CLANG_VERSION 1.1)
Douglas Gregor7f7b7482009-08-23 05:28:29 +00004
Oscar Fuentesd2f4e5e2008-10-26 00:56:18 +00005macro(add_clang_library name)
Cedric Venetfe2f8082008-11-02 16:28:53 +00006 set(srcs ${ARGN})
Ted Kremenekbf5de3f2009-03-25 20:34:07 +00007 if(MSVC_IDE OR XCODE)
Douglas Gregorf5216f22009-06-17 18:31:02 +00008 file( GLOB_RECURSE headers *.h *.td *.def)
Cedric Venetfe2f8082008-11-02 16:28:53 +00009 set(srcs ${srcs} ${headers})
10 string( REGEX MATCHALL "/[^/]+" split_path ${CMAKE_CURRENT_SOURCE_DIR})
11 list( GET split_path -1 dir)
Douglas Gregorf5216f22009-06-17 18:31:02 +000012 file( GLOB_RECURSE headers
13 ../../include/clang${dir}/*.h
14 ../../include/clang${dir}/*.td
15 ../../include/clang${dir}/*.def)
Cedric Venetfe2f8082008-11-02 16:28:53 +000016 set(srcs ${srcs} ${headers})
Ted Kremenekbf5de3f2009-03-25 20:34:07 +000017 endif(MSVC_IDE OR XCODE)
Cedric Venetfe2f8082008-11-02 16:28:53 +000018 add_library( ${name} ${srcs} )
Oscar Fuentesd2f4e5e2008-10-26 00:56:18 +000019 if( LLVM_COMMON_DEPENDS )
20 add_dependencies( ${name} ${LLVM_COMMON_DEPENDS} )
21 endif( LLVM_COMMON_DEPENDS )
Douglas Gregora393e9e2009-03-16 23:06:59 +000022 add_dependencies(${name} ClangDiagnosticCommon)
Cedric Venet1c212a02008-12-13 11:00:04 +000023 if(MSVC)
24 get_target_property(cflag ${name} COMPILE_FLAGS)
25 if(NOT cflag)
26 set(cflag "")
27 endif(NOT cflag)
28 set(cflag "${cflag} /Za")
29 set_target_properties(${name} PROPERTIES COMPILE_FLAGS ${cflag})
30 endif(MSVC)
Oscar Fuentesd2f4e5e2008-10-26 00:56:18 +000031 install(TARGETS ${name}
32 LIBRARY DESTINATION lib
Oscar Fuentes755f3df2009-06-12 02:54:12 +000033 ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
Oscar Fuentesd2f4e5e2008-10-26 00:56:18 +000034endmacro(add_clang_library)
35
36macro(add_clang_executable name)
Cedric Venetfe2f8082008-11-02 16:28:53 +000037 set(srcs ${ARGN})
38 if(MSVC_IDE)
Douglas Gregorf5216f22009-06-17 18:31:02 +000039 file( GLOB_RECURSE headers *.h *.td *.def)
Cedric Venetfe2f8082008-11-02 16:28:53 +000040 set(srcs ${srcs} ${headers})
41 endif(MSVC_IDE)
42 add_llvm_executable( ${name} ${srcs} )
Oscar Fuentesd2f4e5e2008-10-26 00:56:18 +000043endmacro(add_clang_executable)
44
45include_directories(
46 ${CMAKE_CURRENT_SOURCE_DIR}/include
Douglas Gregora393e9e2009-03-16 23:06:59 +000047 ${CMAKE_CURRENT_BINARY_DIR}/include
Oscar Fuentesd2f4e5e2008-10-26 00:56:18 +000048 )
49
Chris Lattnerbc6ec752008-11-11 18:39:10 +000050install(DIRECTORY include
51 DESTINATION .
52 PATTERN ".svn" EXCLUDE
53 )
54
Oscar Fuentesd2f4e5e2008-10-26 00:56:18 +000055add_definitions( -D_GNU_SOURCE )
56
Douglas Gregora393e9e2009-03-16 23:06:59 +000057add_subdirectory(include)
Oscar Fuentesd2f4e5e2008-10-26 00:56:18 +000058add_subdirectory(lib)
Daniel Dunbarcbcd98b2009-03-24 02:52:57 +000059add_subdirectory(tools)
Oscar Fuentesd2f4e5e2008-10-26 00:56:18 +000060
61# TODO: docs.
Douglas Gregor291fbde2009-09-15 22:30:13 +000062add_subdirectory(test)
63