Oscar Fuentes | 67410b3 | 2011-02-03 20:57:53 +0000 | [diff] [blame] | 1 | # If we are not building as a part of LLVM, build Clang as an |
| 2 | # standalone project, using LLVM as an external library: |
| 3 | if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR ) |
| 4 | project(Clang) |
| 5 | cmake_minimum_required(VERSION 2.8) |
| 6 | |
| 7 | set(CLANG_PATH_TO_LLVM_SOURCE "" CACHE PATH |
| 8 | "Path to LLVM source code. Not necessary if using an installed LLVM.") |
| 9 | set(CLANG_PATH_TO_LLVM_BUILD "" CACHE PATH |
| 10 | "Path to the directory where LLVM was built or installed.") |
| 11 | |
| 12 | if( CLANG_PATH_TO_LLVM_SOURCE ) |
| 13 | if( NOT EXISTS "${CLANG_PATH_TO_LLVM_SOURCE}/cmake/config-ix.cmake" ) |
| 14 | message(FATAL_ERROR "Please set CLANG_PATH_TO_LLVM_SOURCE to the root directory of LLVM source code.") |
| 15 | else() |
| 16 | get_filename_component(LLVM_MAIN_SRC_DIR ${CLANG_PATH_TO_LLVM_SOURCE} |
| 17 | ABSOLUTE) |
| 18 | list(APPEND CMAKE_MODULE_PATH "${LLVM_MAIN_SRC_DIR}/cmake/modules") |
| 19 | endif() |
| 20 | endif() |
| 21 | |
Peter Collingbourne | 6ee5b93 | 2011-10-06 01:52:10 +0000 | [diff] [blame] | 22 | if( NOT EXISTS "${CLANG_PATH_TO_LLVM_BUILD}/bin/llvm-tblgen${CMAKE_EXECUTABLE_SUFFIX}" ) |
| 23 | # Looking for bin/Debug/llvm-tblgen is a complete hack. How can we get |
Douglas Gregor | 17031a2 | 2011-07-14 23:42:32 +0000 | [diff] [blame] | 24 | # around this? |
Peter Collingbourne | 6ee5b93 | 2011-10-06 01:52:10 +0000 | [diff] [blame] | 25 | if( NOT EXISTS "${CLANG_PATH_TO_LLVM_BUILD}/bin/Debug/llvm-tblgen${CMAKE_EXECUTABLE_SUFFIX}" ) |
Douglas Gregor | 17031a2 | 2011-07-14 23:42:32 +0000 | [diff] [blame] | 26 | message(FATAL_ERROR "Please set CLANG_PATH_TO_LLVM_BUILD to a directory containing a LLVM build.") |
| 27 | endif() |
Oscar Fuentes | 67410b3 | 2011-02-03 20:57:53 +0000 | [diff] [blame] | 28 | endif() |
| 29 | |
| 30 | list(APPEND CMAKE_MODULE_PATH "${CLANG_PATH_TO_LLVM_BUILD}/share/llvm/cmake") |
| 31 | |
| 32 | get_filename_component(PATH_TO_LLVM_BUILD ${CLANG_PATH_TO_LLVM_BUILD} |
| 33 | ABSOLUTE) |
| 34 | |
| 35 | include(AddLLVM) |
| 36 | include(TableGen) |
Oscar Fuentes | 5ec8a4d | 2011-04-10 16:17:31 +0000 | [diff] [blame] | 37 | include("${CLANG_PATH_TO_LLVM_BUILD}/share/llvm/cmake/LLVMConfig.cmake") |
Oscar Fuentes | 67410b3 | 2011-02-03 20:57:53 +0000 | [diff] [blame] | 38 | include(HandleLLVMOptions) |
| 39 | |
| 40 | set(PACKAGE_VERSION "${LLVM_PACKAGE_VERSION}") |
| 41 | |
| 42 | set(LLVM_MAIN_INCLUDE_DIR "${LLVM_MAIN_SRC_DIR}/include") |
| 43 | set(LLVM_BINARY_DIR ${CMAKE_BINARY_DIR}) |
| 44 | |
Oscar Fuentes | b641f08 | 2011-02-14 20:14:11 +0000 | [diff] [blame] | 45 | set(CMAKE_INCLUDE_CURRENT_DIR ON) |
Oscar Fuentes | 67410b3 | 2011-02-03 20:57:53 +0000 | [diff] [blame] | 46 | include_directories("${PATH_TO_LLVM_BUILD}/include" "${LLVM_MAIN_INCLUDE_DIR}") |
Oscar Fuentes | 67410b3 | 2011-02-03 20:57:53 +0000 | [diff] [blame] | 47 | link_directories("${PATH_TO_LLVM_BUILD}/lib") |
| 48 | |
Peter Collingbourne | 6ee5b93 | 2011-10-06 01:52:10 +0000 | [diff] [blame] | 49 | if( EXISTS "${CLANG_PATH_TO_LLVM_BUILD}/bin/llvm-tblgen${CMAKE_EXECUTABLE_SUFFIX}" ) |
| 50 | set(LLVM_TABLEGEN_EXE "${PATH_TO_LLVM_BUILD}/bin/llvm-tblgen${CMAKE_EXECUTABLE_SUFFIX}") |
Douglas Gregor | 17031a2 | 2011-07-14 23:42:32 +0000 | [diff] [blame] | 51 | else() |
| 52 | # FIXME: This is an utter hack. |
Peter Collingbourne | 6ee5b93 | 2011-10-06 01:52:10 +0000 | [diff] [blame] | 53 | set(LLVM_TABLEGEN_EXE "${PATH_TO_LLVM_BUILD}/bin/Debug/llvm-tblgen${CMAKE_EXECUTABLE_SUFFIX}") |
Douglas Gregor | 17031a2 | 2011-07-14 23:42:32 +0000 | [diff] [blame] | 54 | endif() |
Oscar Fuentes | 67410b3 | 2011-02-03 20:57:53 +0000 | [diff] [blame] | 55 | |
Chandler Carruth | 9224fb8 | 2012-07-02 20:52:55 +0000 | [diff] [blame] | 56 | # Define the default arguments to use with 'lit', and an option for the user |
| 57 | # to override. |
| 58 | set(LIT_ARGS_DEFAULT "-sv") |
| 59 | if (MSVC OR XCODE) |
| 60 | set(LIT_ARGS_DEFAULT "${LIT_ARGS_DEFAULT} --no-progress-bar") |
| 61 | endif() |
| 62 | set(LLVM_LIT_ARGS "${LIT_ARGS_DEFAULT}" CACHE STRING "Default options for lit") |
| 63 | |
Oscar Fuentes | 67410b3 | 2011-02-03 20:57:53 +0000 | [diff] [blame] | 64 | set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin ) |
| 65 | set( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib ) |
| 66 | set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib ) |
| 67 | |
Jeffrey Yasskin | 718b01d | 2011-02-15 07:54:28 +0000 | [diff] [blame] | 68 | set( CLANG_BUILT_STANDALONE 1 ) |
Douglas Gregor | a34173e | 2012-12-18 19:39:40 +0000 | [diff] [blame] | 69 | |
| 70 | find_package(LibXml2) |
| 71 | if (LIBXML2_FOUND) |
| 72 | set(CLANG_HAVE_LIBXML 1) |
| 73 | endif () |
Oscar Fuentes | 67410b3 | 2011-02-03 20:57:53 +0000 | [diff] [blame] | 74 | endif() |
Douglas Gregor | 34d9ffa | 2009-09-16 21:59:05 +0000 | [diff] [blame] | 75 | |
Oscar Fuentes | 2100fe9 | 2011-02-03 22:48:20 +0000 | [diff] [blame] | 76 | set(CLANG_RESOURCE_DIR "" CACHE STRING |
| 77 | "Relative directory from the Clang binary to its resource files.") |
| 78 | |
| 79 | set(C_INCLUDE_DIRS "" CACHE STRING |
| 80 | "Colon separated list of directories clang will search for headers.") |
| 81 | |
Sebastian Pop | 4762a2d | 2012-04-16 04:16:43 +0000 | [diff] [blame] | 82 | set(GCC_INSTALL_PREFIX "" CACHE PATH "Directory where gcc is installed." ) |
| 83 | set(DEFAULT_SYSROOT "" CACHE PATH |
| 84 | "Default <path> to all compiler invocations for --sysroot=<path>." ) |
| 85 | |
Oscar Fuentes | f752d5b | 2011-05-20 15:57:59 +0000 | [diff] [blame] | 86 | set(CLANG_VENDOR "" CACHE STRING |
| 87 | "Vendor-specific text for showing with version information.") |
| 88 | |
| 89 | if( CLANG_VENDOR ) |
| 90 | add_definitions( -DCLANG_VENDOR="${CLANG_VENDOR} " ) |
| 91 | endif() |
| 92 | |
Daniel Dunbar | 91ee77a | 2009-09-17 00:07:10 +0000 | [diff] [blame] | 93 | set(CLANG_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) |
| 94 | set(CLANG_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) |
| 95 | |
Chandler Carruth | 63e9c0d | 2010-04-17 20:12:02 +0000 | [diff] [blame] | 96 | if( CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR AND NOT MSVC_IDE ) |
| 97 | message(FATAL_ERROR "In-source builds are not allowed. CMake would overwrite " |
| 98 | "the makefiles distributed with LLVM. Please create a directory and run cmake " |
| 99 | "from there, passing the path to this source directory as the last argument. " |
| 100 | "This process created the file `CMakeCache.txt' and the directory " |
| 101 | "`CMakeFiles'. Please delete them.") |
| 102 | endif() |
| 103 | |
| 104 | if( NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR ) |
| 105 | file(GLOB_RECURSE |
| 106 | tablegenned_files_on_include_dir |
| 107 | "${CLANG_SOURCE_DIR}/include/clang/*.inc") |
| 108 | if( tablegenned_files_on_include_dir ) |
| 109 | message(FATAL_ERROR "Apparently there is a previous in-source build, " |
| 110 | "probably as the result of running `configure' and `make' on " |
| 111 | "${CLANG_SOURCE_DIR}. This may cause problems. The suspicious files are:\n" |
| 112 | "${tablegenned_files_on_include_dir}\nPlease clean the source directory.") |
| 113 | endif() |
| 114 | endif() |
| 115 | |
Daniel Dunbar | c4b8e92 | 2010-06-25 23:34:47 +0000 | [diff] [blame] | 116 | # Compute the Clang version from the LLVM version. |
Michael J. Spencer | 5a7f349 | 2010-09-10 21:13:16 +0000 | [diff] [blame] | 117 | string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION |
Daniel Dunbar | c4b8e92 | 2010-06-25 23:34:47 +0000 | [diff] [blame] | 118 | ${PACKAGE_VERSION}) |
Douglas Gregor | 34d9ffa | 2009-09-16 21:59:05 +0000 | [diff] [blame] | 119 | message(STATUS "Clang version: ${CLANG_VERSION}") |
Douglas Gregor | 7f7b748 | 2009-08-23 05:28:29 +0000 | [diff] [blame] | 120 | |
Daniel Dunbar | a510767 | 2010-06-25 17:33:46 +0000 | [diff] [blame] | 121 | string(REGEX REPLACE "([0-9]+)\\.[0-9]+(\\.[0-9]+)?" "\\1" CLANG_VERSION_MAJOR |
| 122 | ${CLANG_VERSION}) |
| 123 | string(REGEX REPLACE "[0-9]+\\.([0-9]+)(\\.[0-9]+)?" "\\1" CLANG_VERSION_MINOR |
| 124 | ${CLANG_VERSION}) |
| 125 | if (${CLANG_VERSION} MATCHES "[0-9]+\\.[0-9]+\\.[0-9]+") |
| 126 | set(CLANG_HAS_VERSION_PATCHLEVEL 1) |
| 127 | string(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" CLANG_VERSION_PATCHLEVEL |
| 128 | ${CLANG_VERSION}) |
| 129 | else() |
| 130 | set(CLANG_HAS_VERSION_PATCHLEVEL 0) |
| 131 | endif() |
| 132 | |
| 133 | # Configure the Version.inc file. |
| 134 | configure_file( |
| 135 | ${CMAKE_CURRENT_SOURCE_DIR}/include/clang/Basic/Version.inc.in |
| 136 | ${CMAKE_CURRENT_BINARY_DIR}/include/clang/Basic/Version.inc) |
| 137 | |
Douglas Gregor | 9df3faf | 2009-09-18 14:47:57 +0000 | [diff] [blame] | 138 | # Add appropriate flags for GCC |
Oscar Fuentes | c5cd252 | 2011-05-11 13:53:30 +0000 | [diff] [blame] | 139 | if (LLVM_COMPILER_IS_GCC_COMPATIBLE) |
Oscar Fuentes | 827c573 | 2010-10-15 00:16:22 +0000 | [diff] [blame] | 140 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-common -Woverloaded-virtual -Wcast-qual -fno-strict-aliasing -pedantic -Wno-long-long -Wall -W -Wno-unused-parameter -Wwrite-strings") |
Jordan Rose | 549a292 | 2013-03-02 00:49:47 +0000 | [diff] [blame] | 141 | |
| 142 | check_cxx_compiler_flag("-Werror -Wnested-anon-types" CXX_SUPPORTS_NO_NESTED_ANON_TYPES_FLAG) |
| 143 | if( CXX_SUPPORTS_NO_NESTED_ANON_TYPES_FLAG ) |
| 144 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-nested-anon-types" ) |
| 145 | endif() |
Douglas Gregor | 9df3faf | 2009-09-18 14:47:57 +0000 | [diff] [blame] | 146 | endif () |
| 147 | |
Douglas Gregor | eb5dc49 | 2010-06-08 19:23:49 +0000 | [diff] [blame] | 148 | if (APPLE) |
| 149 | set(CMAKE_MODULE_LINKER_FLAGS "-Wl,-flat_namespace -Wl,-undefined -Wl,suppress") |
| 150 | endif () |
| 151 | |
Oscar Fuentes | 2100fe9 | 2011-02-03 22:48:20 +0000 | [diff] [blame] | 152 | configure_file( |
| 153 | ${CLANG_SOURCE_DIR}/include/clang/Config/config.h.cmake |
| 154 | ${CLANG_BINARY_DIR}/include/clang/Config/config.h) |
| 155 | |
Oscar Fuentes | c8da1ec | 2011-02-20 22:06:32 +0000 | [diff] [blame] | 156 | include(LLVMParseArguments) |
| 157 | |
| 158 | function(clang_tablegen) |
| 159 | # Syntax: |
| 160 | # clang_tablegen output-file [tablegen-arg ...] SOURCE source-file |
| 161 | # [[TARGET cmake-target-name] [DEPENDS extra-dependency ...]] |
| 162 | # |
| 163 | # Generates a custom command for invoking tblgen as |
| 164 | # |
| 165 | # tblgen source-file -o=output-file tablegen-arg ... |
| 166 | # |
| 167 | # and, if cmake-target-name is provided, creates a custom target for |
| 168 | # executing the custom command depending on output-file. It is |
| 169 | # possible to list more files to depend after DEPENDS. |
| 170 | |
| 171 | parse_arguments( CTG "SOURCE;TARGET;DEPENDS" "" ${ARGN} ) |
| 172 | |
| 173 | if( NOT CTG_SOURCE ) |
| 174 | message(FATAL_ERROR "SOURCE source-file required by clang_tablegen") |
| 175 | endif() |
| 176 | |
| 177 | set( LLVM_TARGET_DEFINITIONS ${CTG_SOURCE} ) |
Peter Collingbourne | 51d7777 | 2011-10-06 13:03:08 +0000 | [diff] [blame] | 178 | tablegen( CLANG ${CTG_DEFAULT_ARGS} ) |
Oscar Fuentes | c8da1ec | 2011-02-20 22:06:32 +0000 | [diff] [blame] | 179 | |
| 180 | list( GET CTG_DEFAULT_ARGS 0 output_file ) |
| 181 | if( CTG_TARGET ) |
| 182 | add_custom_target( ${CTG_TARGET} DEPENDS ${output_file} ${CTG_DEPENDS} ) |
Oscar Fuentes | a3f787c | 2011-02-20 22:06:44 +0000 | [diff] [blame] | 183 | set_target_properties( ${CTG_TARGET} PROPERTIES FOLDER "Clang tablegenning") |
Oscar Fuentes | c8da1ec | 2011-02-20 22:06:32 +0000 | [diff] [blame] | 184 | endif() |
| 185 | endfunction(clang_tablegen) |
| 186 | |
Oscar Fuentes | d2f4e5e | 2008-10-26 00:56:18 +0000 | [diff] [blame] | 187 | macro(add_clang_library name) |
Oscar Fuentes | 9917401 | 2011-01-03 17:00:02 +0000 | [diff] [blame] | 188 | llvm_process_sources(srcs ${ARGN}) |
Ted Kremenek | bf5de3f | 2009-03-25 20:34:07 +0000 | [diff] [blame] | 189 | if(MSVC_IDE OR XCODE) |
Jordan Rose | 340d0d3 | 2012-10-23 21:54:03 +0000 | [diff] [blame] | 190 | # Add public headers |
| 191 | file(RELATIVE_PATH lib_path |
| 192 | ${CLANG_SOURCE_DIR}/lib/ |
| 193 | ${CMAKE_CURRENT_SOURCE_DIR} |
| 194 | ) |
| 195 | if(NOT lib_path MATCHES "^[.][.]") |
| 196 | file( GLOB_RECURSE headers |
| 197 | ${CLANG_SOURCE_DIR}/include/clang/${lib_path}/*.h |
| 198 | ${CLANG_SOURCE_DIR}/include/clang/${lib_path}/*.def |
| 199 | ) |
| 200 | set_source_files_properties(${headers} PROPERTIES HEADER_FILE_ONLY ON) |
| 201 | |
| 202 | file( GLOB_RECURSE tds |
| 203 | ${CLANG_SOURCE_DIR}/include/clang/${lib_path}/*.td |
| 204 | ) |
| 205 | source_group("TableGen descriptions" FILES ${tds}) |
| 206 | set_source_files_properties(${tds}} PROPERTIES HEADER_FILE_ONLY ON) |
| 207 | |
| 208 | set(srcs ${srcs} ${headers} ${tds}) |
| 209 | endif() |
Ted Kremenek | bf5de3f | 2009-03-25 20:34:07 +0000 | [diff] [blame] | 210 | endif(MSVC_IDE OR XCODE) |
Douglas Gregor | eb5dc49 | 2010-06-08 19:23:49 +0000 | [diff] [blame] | 211 | if (MODULE) |
| 212 | set(libkind MODULE) |
| 213 | elseif (SHARED_LIBRARY) |
Douglas Gregor | ac47bc7 | 2009-09-25 06:35:15 +0000 | [diff] [blame] | 214 | set(libkind SHARED) |
| 215 | else() |
| 216 | set(libkind) |
| 217 | endif() |
| 218 | add_library( ${name} ${libkind} ${srcs} ) |
Oscar Fuentes | d2f4e5e | 2008-10-26 00:56:18 +0000 | [diff] [blame] | 219 | if( LLVM_COMMON_DEPENDS ) |
| 220 | add_dependencies( ${name} ${LLVM_COMMON_DEPENDS} ) |
| 221 | endif( LLVM_COMMON_DEPENDS ) |
Oscar Fuentes | fb767c8 | 2011-03-29 20:51:00 +0000 | [diff] [blame] | 222 | |
Oscar Fuentes | fb767c8 | 2011-03-29 20:51:00 +0000 | [diff] [blame] | 223 | llvm_config( ${name} ${LLVM_LINK_COMPONENTS} ) |
| 224 | target_link_libraries( ${name} ${LLVM_COMMON_LIBS} ) |
| 225 | link_system_libs( ${name} ) |
| 226 | |
Oscar Fuentes | d2f4e5e | 2008-10-26 00:56:18 +0000 | [diff] [blame] | 227 | install(TARGETS ${name} |
Oscar Fuentes | bfb06ea | 2009-10-27 19:42:21 +0000 | [diff] [blame] | 228 | LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX} |
NAKAMURA Takumi | ee7a198 | 2012-02-25 16:46:50 +0000 | [diff] [blame] | 229 | ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX} |
| 230 | RUNTIME DESTINATION bin) |
Oscar Fuentes | a3f787c | 2011-02-20 22:06:44 +0000 | [diff] [blame] | 231 | set_target_properties(${name} PROPERTIES FOLDER "Clang libraries") |
Oscar Fuentes | d2f4e5e | 2008-10-26 00:56:18 +0000 | [diff] [blame] | 232 | endmacro(add_clang_library) |
| 233 | |
| 234 | macro(add_clang_executable name) |
Oscar Fuentes | 9917401 | 2011-01-03 17:00:02 +0000 | [diff] [blame] | 235 | add_llvm_executable( ${name} ${ARGN} ) |
Oscar Fuentes | a3f787c | 2011-02-20 22:06:44 +0000 | [diff] [blame] | 236 | set_target_properties(${name} PROPERTIES FOLDER "Clang executables") |
Oscar Fuentes | d2f4e5e | 2008-10-26 00:56:18 +0000 | [diff] [blame] | 237 | endmacro(add_clang_executable) |
| 238 | |
Oscar Fuentes | 617508f | 2011-03-17 19:03:04 +0000 | [diff] [blame] | 239 | include_directories(BEFORE |
Douglas Gregor | a393e9e | 2009-03-16 23:06:59 +0000 | [diff] [blame] | 240 | ${CMAKE_CURRENT_BINARY_DIR}/include |
Oscar Fuentes | 617508f | 2011-03-17 19:03:04 +0000 | [diff] [blame] | 241 | ${CMAKE_CURRENT_SOURCE_DIR}/include |
Oscar Fuentes | d2f4e5e | 2008-10-26 00:56:18 +0000 | [diff] [blame] | 242 | ) |
| 243 | |
Oscar Fuentes | 82cac29 | 2009-10-27 19:59:34 +0000 | [diff] [blame] | 244 | install(DIRECTORY include/ |
| 245 | DESTINATION include |
| 246 | FILES_MATCHING |
| 247 | PATTERN "*.def" |
| 248 | PATTERN "*.h" |
Dylan Noblesmith | eafa50b | 2012-02-01 22:22:37 +0000 | [diff] [blame] | 249 | PATTERN "config.h" EXCLUDE |
Chris Lattner | bc6ec75 | 2008-11-11 18:39:10 +0000 | [diff] [blame] | 250 | PATTERN ".svn" EXCLUDE |
| 251 | ) |
| 252 | |
Kovarththanan Rajaratnam | ec700a6 | 2010-04-01 14:24:41 +0000 | [diff] [blame] | 253 | install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/ |
| 254 | DESTINATION include |
| 255 | FILES_MATCHING |
Chris Lattner | d7d5bb1 | 2010-04-25 04:59:35 +0000 | [diff] [blame] | 256 | PATTERN "CMakeFiles" EXCLUDE |
Kovarththanan Rajaratnam | ec700a6 | 2010-04-01 14:24:41 +0000 | [diff] [blame] | 257 | PATTERN "*.inc" |
| 258 | ) |
| 259 | |
Dylan Noblesmith | cc8a945 | 2012-02-14 15:54:49 +0000 | [diff] [blame] | 260 | add_definitions( -D_GNU_SOURCE ) |
Oscar Fuentes | d2f4e5e | 2008-10-26 00:56:18 +0000 | [diff] [blame] | 261 | |
NAKAMURA Takumi | 68f22af | 2012-12-13 16:24:59 +0000 | [diff] [blame] | 262 | # FIXME: They should be options. |
| 263 | add_definitions(-DCLANG_ENABLE_ARCMT -DCLANG_ENABLE_REWRITER -DCLANG_ENABLE_STATIC_ANALYZER) |
| 264 | |
Douglas Gregor | 8435bf9 | 2011-02-25 19:24:02 +0000 | [diff] [blame] | 265 | # Clang version information |
| 266 | set(CLANG_EXECUTABLE_VERSION |
| 267 | "${CLANG_VERSION_MAJOR}.${CLANG_VERSION_MINOR}" CACHE STRING |
| 268 | "Version number that will be placed into the clang executable, in the form XX.YY") |
| 269 | set(LIBCLANG_LIBRARY_VERSION |
| 270 | "${CLANG_VERSION_MAJOR}.${CLANG_VERSION_MINOR}" CACHE STRING |
| 271 | "Version number that will be placed into the libclang library , in the form XX.YY") |
| 272 | mark_as_advanced(CLANG_EXECUTABLE_VERSION LIBCLANG_LIBRARY_VERSION) |
| 273 | |
Peter Collingbourne | 51d7777 | 2011-10-06 13:03:08 +0000 | [diff] [blame] | 274 | add_subdirectory(utils/TableGen) |
Douglas Gregor | 8435bf9 | 2011-02-25 19:24:02 +0000 | [diff] [blame] | 275 | |
Douglas Gregor | a393e9e | 2009-03-16 23:06:59 +0000 | [diff] [blame] | 276 | add_subdirectory(include) |
Oscar Fuentes | d2f4e5e | 2008-10-26 00:56:18 +0000 | [diff] [blame] | 277 | add_subdirectory(lib) |
Daniel Dunbar | cbcd98b | 2009-03-24 02:52:57 +0000 | [diff] [blame] | 278 | add_subdirectory(tools) |
Michael J. Spencer | 48263ba | 2010-12-16 03:28:42 +0000 | [diff] [blame] | 279 | add_subdirectory(runtime) |
Oscar Fuentes | d2f4e5e | 2008-10-26 00:56:18 +0000 | [diff] [blame] | 280 | |
NAKAMURA Takumi | e3120ae | 2012-07-27 06:17:48 +0000 | [diff] [blame] | 281 | option(CLANG_BUILD_EXAMPLES "Build CLANG example programs by default." OFF) |
| 282 | add_subdirectory(examples) |
| 283 | |
Jordan Rose | 3092d9d | 2013-02-08 01:42:37 +0000 | [diff] [blame] | 284 | option(CLANG_INCLUDE_TESTS |
| 285 | "Generate build targets for the Clang unit tests." |
Jordan Rose | 6bbaa77 | 2013-02-08 07:28:25 +0000 | [diff] [blame] | 286 | ${LLVM_INCLUDE_TESTS}) |
Jordan Rose | 3092d9d | 2013-02-08 01:42:37 +0000 | [diff] [blame] | 287 | |
Alexey Samsonov | 863fb35 | 2013-02-26 09:43:27 +0000 | [diff] [blame] | 288 | # TODO: docs. |
| 289 | add_subdirectory(test) |
| 290 | |
Jordan Rose | 3092d9d | 2013-02-08 01:42:37 +0000 | [diff] [blame] | 291 | if( CLANG_INCLUDE_TESTS ) |
| 292 | add_subdirectory(unittests) |
Jeffrey Yasskin | 718b01d | 2011-02-15 07:54:28 +0000 | [diff] [blame] | 293 | endif() |
NAKAMURA Takumi | 792f975 | 2011-02-16 03:07:15 +0000 | [diff] [blame] | 294 | |
| 295 | # Workaround for MSVS10 to avoid the Dialog Hell |
| 296 | # FIXME: This could be removed with future version of CMake. |
| 297 | if( CLANG_BUILT_STANDALONE AND MSVC_VERSION EQUAL 1600 ) |
| 298 | set(CLANG_SLN_FILENAME "${CMAKE_CURRENT_BINARY_DIR}/Clang.sln") |
| 299 | if( EXISTS "${CLANG_SLN_FILENAME}" ) |
| 300 | file(APPEND "${CLANG_SLN_FILENAME}" "\n# This should be regenerated!\n") |
| 301 | endif() |
| 302 | endif() |
Chad Rosier | fc61427 | 2011-08-02 20:44:34 +0000 | [diff] [blame] | 303 | |
| 304 | set(BUG_REPORT_URL "http://llvm.org/bugs/" CACHE STRING |
| 305 | "Default URL where bug reports are to be submitted.") |
Dmitri Gribenko | f303d4c | 2012-08-07 17:54:38 +0000 | [diff] [blame] | 306 | |