Oscar Fuentes | d2f4e5e | 2008-10-26 00:56:18 +0000 | [diff] [blame] | 1 | macro(add_clang_library name) |
Cedric Venet | fe2f808 | 2008-11-02 16:28:53 +0000 | [diff] [blame] | 2 | set(srcs ${ARGN}) |
Ted Kremenek | bf5de3f | 2009-03-25 20:34:07 +0000 | [diff] [blame] | 3 | if(MSVC_IDE OR XCODE) |
Cedric Venet | fe2f808 | 2008-11-02 16:28:53 +0000 | [diff] [blame] | 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}) |
Ted Kremenek | bf5de3f | 2009-03-25 20:34:07 +0000 | [diff] [blame] | 10 | endif(MSVC_IDE OR XCODE) |
Cedric Venet | fe2f808 | 2008-11-02 16:28:53 +0000 | [diff] [blame] | 11 | add_library( ${name} ${srcs} ) |
Oscar Fuentes | d2f4e5e | 2008-10-26 00:56:18 +0000 | [diff] [blame] | 12 | if( LLVM_COMMON_DEPENDS ) |
| 13 | add_dependencies( ${name} ${LLVM_COMMON_DEPENDS} ) |
| 14 | endif( LLVM_COMMON_DEPENDS ) |
Douglas Gregor | a393e9e | 2009-03-16 23:06:59 +0000 | [diff] [blame] | 15 | add_dependencies(${name} ClangDiagnosticCommon) |
Cedric Venet | 1c212a0 | 2008-12-13 11:00:04 +0000 | [diff] [blame] | 16 | 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 Fuentes | d2f4e5e | 2008-10-26 00:56:18 +0000 | [diff] [blame] | 24 | install(TARGETS ${name} |
| 25 | LIBRARY DESTINATION lib |
| 26 | ARCHIVE DESTINATION lib) |
| 27 | endmacro(add_clang_library) |
| 28 | |
| 29 | macro(add_clang_executable name) |
Cedric Venet | fe2f808 | 2008-11-02 16:28:53 +0000 | [diff] [blame] | 30 | 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 Fuentes | d2f4e5e | 2008-10-26 00:56:18 +0000 | [diff] [blame] | 36 | install(TARGETS ${name} |
| 37 | RUNTIME DESTINATION bin) |
| 38 | endmacro(add_clang_executable) |
| 39 | |
| 40 | include_directories( |
| 41 | ${CMAKE_CURRENT_SOURCE_DIR}/include |
Douglas Gregor | a393e9e | 2009-03-16 23:06:59 +0000 | [diff] [blame] | 42 | ${CMAKE_CURRENT_BINARY_DIR}/include |
Oscar Fuentes | d2f4e5e | 2008-10-26 00:56:18 +0000 | [diff] [blame] | 43 | ) |
| 44 | |
Chris Lattner | bc6ec75 | 2008-11-11 18:39:10 +0000 | [diff] [blame] | 45 | install(DIRECTORY include |
| 46 | DESTINATION . |
| 47 | PATTERN ".svn" EXCLUDE |
| 48 | ) |
| 49 | |
Oscar Fuentes | d2f4e5e | 2008-10-26 00:56:18 +0000 | [diff] [blame] | 50 | add_definitions( -D_GNU_SOURCE ) |
| 51 | |
Douglas Gregor | a393e9e | 2009-03-16 23:06:59 +0000 | [diff] [blame] | 52 | add_subdirectory(include) |
Oscar Fuentes | d2f4e5e | 2008-10-26 00:56:18 +0000 | [diff] [blame] | 53 | add_subdirectory(lib) |
Daniel Dunbar | cbcd98b | 2009-03-24 02:52:57 +0000 | [diff] [blame] | 54 | add_subdirectory(tools) |
Oscar Fuentes | d2f4e5e | 2008-10-26 00:56:18 +0000 | [diff] [blame] | 55 | |
| 56 | # TODO: docs. |