blob: 3575d883919c58b3fd842d9c766c95d022de39d1 [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})
3 if(MSVC_IDE)
4 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})
10 endif(MSVC_IDE)
11 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 )
Cedric Venet1c212a02008-12-13 11:00:04 +000015 if(MSVC)
16 get_target_property(cflag ${name} COMPILE_FLAGS)
17 if(NOT cflag)
18 set(cflag "")
19 endif(NOT cflag)
20 set(cflag "${cflag} /Za")
21 set_target_properties(${name} PROPERTIES COMPILE_FLAGS ${cflag})
22 endif(MSVC)
Oscar Fuentesd2f4e5e2008-10-26 00:56:18 +000023 install(TARGETS ${name}
24 LIBRARY DESTINATION lib
25 ARCHIVE DESTINATION lib)
26endmacro(add_clang_library)
27
28macro(add_clang_executable name)
Cedric Venetfe2f8082008-11-02 16:28:53 +000029 set(srcs ${ARGN})
30 if(MSVC_IDE)
31 file( GLOB_RECURSE headers *.h)
32 set(srcs ${srcs} ${headers})
33 endif(MSVC_IDE)
34 add_llvm_executable( ${name} ${srcs} )
Oscar Fuentesd2f4e5e2008-10-26 00:56:18 +000035 install(TARGETS ${name}
36 RUNTIME DESTINATION bin)
37endmacro(add_clang_executable)
38
39include_directories(
40 ${CMAKE_CURRENT_SOURCE_DIR}/include
41 )
42
Chris Lattnerbc6ec752008-11-11 18:39:10 +000043install(DIRECTORY include
44 DESTINATION .
45 PATTERN ".svn" EXCLUDE
46 )
47
Oscar Fuentesd2f4e5e2008-10-26 00:56:18 +000048add_definitions( -D_GNU_SOURCE )
49
Oscar Fuentesd2f4e5e2008-10-26 00:56:18 +000050add_subdirectory(lib)
51add_subdirectory(Driver)
52
53# TODO: docs.