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}) |
| 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 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 ) |
Cedric Venet | 1c212a0 | 2008-12-13 11:00:04 +0000 | [diff] [blame] | 15 | 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 Fuentes | d2f4e5e | 2008-10-26 00:56:18 +0000 | [diff] [blame] | 23 | install(TARGETS ${name} |
| 24 | LIBRARY DESTINATION lib |
| 25 | ARCHIVE DESTINATION lib) |
| 26 | endmacro(add_clang_library) |
| 27 | |
| 28 | macro(add_clang_executable name) |
Cedric Venet | fe2f808 | 2008-11-02 16:28:53 +0000 | [diff] [blame] | 29 | 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 Fuentes | d2f4e5e | 2008-10-26 00:56:18 +0000 | [diff] [blame] | 35 | install(TARGETS ${name} |
| 36 | RUNTIME DESTINATION bin) |
| 37 | endmacro(add_clang_executable) |
| 38 | |
| 39 | include_directories( |
| 40 | ${CMAKE_CURRENT_SOURCE_DIR}/include |
| 41 | ) |
| 42 | |
Chris Lattner | bc6ec75 | 2008-11-11 18:39:10 +0000 | [diff] [blame] | 43 | install(DIRECTORY include |
| 44 | DESTINATION . |
| 45 | PATTERN ".svn" EXCLUDE |
| 46 | ) |
| 47 | |
Oscar Fuentes | d2f4e5e | 2008-10-26 00:56:18 +0000 | [diff] [blame] | 48 | add_definitions( -D_GNU_SOURCE ) |
| 49 | |
| 50 | add_subdirectory(lib) |
| 51 | add_subdirectory(Driver) |
| 52 | |
| 53 | # TODO: docs. |