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