Douglas Gregor | 7f7b748 | 2009-08-23 05:28:29 +0000 | [diff] [blame] | 1 | # Clang version information |
| 2 | set(CLANG_VERSION 1.0) |
| 3 | |
Oscar Fuentes | d2f4e5e | 2008-10-26 00:56:18 +0000 | [diff] [blame] | 4 | macro(add_clang_library name) |
Cedric Venet | fe2f808 | 2008-11-02 16:28:53 +0000 | [diff] [blame] | 5 | set(srcs ${ARGN}) |
Ted Kremenek | bf5de3f | 2009-03-25 20:34:07 +0000 | [diff] [blame] | 6 | if(MSVC_IDE OR XCODE) |
Douglas Gregor | f5216f2 | 2009-06-17 18:31:02 +0000 | [diff] [blame] | 7 | file( GLOB_RECURSE headers *.h *.td *.def) |
Cedric Venet | fe2f808 | 2008-11-02 16:28:53 +0000 | [diff] [blame] | 8 | set(srcs ${srcs} ${headers}) |
| 9 | string( REGEX MATCHALL "/[^/]+" split_path ${CMAKE_CURRENT_SOURCE_DIR}) |
| 10 | list( GET split_path -1 dir) |
Douglas Gregor | f5216f2 | 2009-06-17 18:31:02 +0000 | [diff] [blame] | 11 | file( GLOB_RECURSE headers |
| 12 | ../../include/clang${dir}/*.h |
| 13 | ../../include/clang${dir}/*.td |
| 14 | ../../include/clang${dir}/*.def) |
Cedric Venet | fe2f808 | 2008-11-02 16:28:53 +0000 | [diff] [blame] | 15 | set(srcs ${srcs} ${headers}) |
Ted Kremenek | bf5de3f | 2009-03-25 20:34:07 +0000 | [diff] [blame] | 16 | endif(MSVC_IDE OR XCODE) |
Cedric Venet | fe2f808 | 2008-11-02 16:28:53 +0000 | [diff] [blame] | 17 | add_library( ${name} ${srcs} ) |
Oscar Fuentes | d2f4e5e | 2008-10-26 00:56:18 +0000 | [diff] [blame] | 18 | if( LLVM_COMMON_DEPENDS ) |
| 19 | add_dependencies( ${name} ${LLVM_COMMON_DEPENDS} ) |
| 20 | endif( LLVM_COMMON_DEPENDS ) |
Douglas Gregor | a393e9e | 2009-03-16 23:06:59 +0000 | [diff] [blame] | 21 | add_dependencies(${name} ClangDiagnosticCommon) |
Cedric Venet | 1c212a0 | 2008-12-13 11:00:04 +0000 | [diff] [blame] | 22 | if(MSVC) |
| 23 | get_target_property(cflag ${name} COMPILE_FLAGS) |
| 24 | if(NOT cflag) |
| 25 | set(cflag "") |
| 26 | endif(NOT cflag) |
| 27 | set(cflag "${cflag} /Za") |
| 28 | set_target_properties(${name} PROPERTIES COMPILE_FLAGS ${cflag}) |
| 29 | endif(MSVC) |
Oscar Fuentes | d2f4e5e | 2008-10-26 00:56:18 +0000 | [diff] [blame] | 30 | install(TARGETS ${name} |
| 31 | LIBRARY DESTINATION lib |
Oscar Fuentes | 755f3df | 2009-06-12 02:54:12 +0000 | [diff] [blame] | 32 | ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}) |
Oscar Fuentes | d2f4e5e | 2008-10-26 00:56:18 +0000 | [diff] [blame] | 33 | endmacro(add_clang_library) |
| 34 | |
| 35 | macro(add_clang_executable name) |
Cedric Venet | fe2f808 | 2008-11-02 16:28:53 +0000 | [diff] [blame] | 36 | set(srcs ${ARGN}) |
| 37 | if(MSVC_IDE) |
Douglas Gregor | f5216f2 | 2009-06-17 18:31:02 +0000 | [diff] [blame] | 38 | file( GLOB_RECURSE headers *.h *.td *.def) |
Cedric Venet | fe2f808 | 2008-11-02 16:28:53 +0000 | [diff] [blame] | 39 | set(srcs ${srcs} ${headers}) |
| 40 | endif(MSVC_IDE) |
| 41 | add_llvm_executable( ${name} ${srcs} ) |
Oscar Fuentes | d2f4e5e | 2008-10-26 00:56:18 +0000 | [diff] [blame] | 42 | endmacro(add_clang_executable) |
| 43 | |
| 44 | include_directories( |
| 45 | ${CMAKE_CURRENT_SOURCE_DIR}/include |
Douglas Gregor | a393e9e | 2009-03-16 23:06:59 +0000 | [diff] [blame] | 46 | ${CMAKE_CURRENT_BINARY_DIR}/include |
Oscar Fuentes | d2f4e5e | 2008-10-26 00:56:18 +0000 | [diff] [blame] | 47 | ) |
| 48 | |
Chris Lattner | bc6ec75 | 2008-11-11 18:39:10 +0000 | [diff] [blame] | 49 | install(DIRECTORY include |
| 50 | DESTINATION . |
| 51 | PATTERN ".svn" EXCLUDE |
| 52 | ) |
| 53 | |
Oscar Fuentes | d2f4e5e | 2008-10-26 00:56:18 +0000 | [diff] [blame] | 54 | add_definitions( -D_GNU_SOURCE ) |
| 55 | |
Douglas Gregor | a393e9e | 2009-03-16 23:06:59 +0000 | [diff] [blame] | 56 | add_subdirectory(include) |
Oscar Fuentes | d2f4e5e | 2008-10-26 00:56:18 +0000 | [diff] [blame] | 57 | add_subdirectory(lib) |
Daniel Dunbar | cbcd98b | 2009-03-24 02:52:57 +0000 | [diff] [blame] | 58 | add_subdirectory(tools) |
Oscar Fuentes | d2f4e5e | 2008-10-26 00:56:18 +0000 | [diff] [blame] | 59 | |
| 60 | # TODO: docs. |
Douglas Gregor | eb357b6 | 2009-06-05 16:00:31 +0000 | [diff] [blame] | 61 | add_subdirectory(test) |