blob: 8ca44b844574131579b8326b385263766bdb274e [file] [log] [blame]
Oscar Fuentesd2f4e5e2008-10-26 00:56:18 +00001macro(add_clang_library name)
Cedric Venetfe2f8082008-11-02 16:28:53 +00002 set(srcs ${ARGN})
Ted Kremenekbf5de3f2009-03-25 20:34:07 +00003 if(MSVC_IDE OR XCODE)
Cedric Venetfe2f8082008-11-02 16:28:53 +00004 file( GLOB_RECURSE headers *.h)
5 set(srcs ${srcs} ${headers})
6 string( REGEX MATCHALL "/[^/]+" split_path ${CMAKE_CURRENT_SOURCE_DIR})
7 list( GET split_path -1 dir)
8 file( GLOB_RECURSE headers ../../include/clang${dir}/*.h)
9 set(srcs ${srcs} ${headers})
Ted Kremenekbf5de3f2009-03-25 20:34:07 +000010 endif(MSVC_IDE OR XCODE)
Cedric Venetfe2f8082008-11-02 16:28:53 +000011 add_library( ${name} ${srcs} )
Oscar Fuentesd2f4e5e2008-10-26 00:56:18 +000012 if( LLVM_COMMON_DEPENDS )
13 add_dependencies( ${name} ${LLVM_COMMON_DEPENDS} )
14 endif( LLVM_COMMON_DEPENDS )
Douglas Gregora393e9e2009-03-16 23:06:59 +000015 add_dependencies(${name} ClangDiagnosticCommon)
Cedric Venet1c212a02008-12-13 11:00:04 +000016 if(MSVC)
17 get_target_property(cflag ${name} COMPILE_FLAGS)
18 if(NOT cflag)
19 set(cflag "")
20 endif(NOT cflag)
21 set(cflag "${cflag} /Za")
22 set_target_properties(${name} PROPERTIES COMPILE_FLAGS ${cflag})
23 endif(MSVC)
Oscar Fuentesd2f4e5e2008-10-26 00:56:18 +000024 install(TARGETS ${name}
25 LIBRARY DESTINATION lib
26 ARCHIVE DESTINATION lib)
27endmacro(add_clang_library)
28
29macro(add_clang_executable name)
Cedric Venetfe2f8082008-11-02 16:28:53 +000030 set(srcs ${ARGN})
31 if(MSVC_IDE)
32 file( GLOB_RECURSE headers *.h)
33 set(srcs ${srcs} ${headers})
34 endif(MSVC_IDE)
35 add_llvm_executable( ${name} ${srcs} )
Oscar Fuentesd2f4e5e2008-10-26 00:56:18 +000036 install(TARGETS ${name}
37 RUNTIME DESTINATION bin)
38endmacro(add_clang_executable)
39
40include_directories(
41 ${CMAKE_CURRENT_SOURCE_DIR}/include
Douglas Gregora393e9e2009-03-16 23:06:59 +000042 ${CMAKE_CURRENT_BINARY_DIR}/include
Oscar Fuentesd2f4e5e2008-10-26 00:56:18 +000043 )
44
Chris Lattnerbc6ec752008-11-11 18:39:10 +000045install(DIRECTORY include
46 DESTINATION .
47 PATTERN ".svn" EXCLUDE
48 )
49
Oscar Fuentesd2f4e5e2008-10-26 00:56:18 +000050add_definitions( -D_GNU_SOURCE )
51
Douglas Gregora393e9e2009-03-16 23:06:59 +000052add_subdirectory(include)
Oscar Fuentesd2f4e5e2008-10-26 00:56:18 +000053add_subdirectory(lib)
Daniel Dunbarcbcd98b2009-03-24 02:52:57 +000054add_subdirectory(tools)
Oscar Fuentesd2f4e5e2008-10-26 00:56:18 +000055
56# TODO: docs.