OLD | NEW |
1 cmake_minimum_required(VERSION 2.8.8) | 1 cmake_minimum_required(VERSION 2.8.8) |
2 project(ChromeExtras) | 2 project(ChromeExtras) |
3 enable_testing() | 3 enable_testing() |
4 | 4 |
5 list(APPEND CMAKE_MODULE_PATH "${LLVM_BUILD_DIR}/share/llvm/cmake") | 5 list(APPEND CMAKE_MODULE_PATH "${LLVM_BUILD_DIR}/share/llvm/cmake") |
6 | 6 |
7 # These tools are built using LLVM's build system, not Chromium's. | 7 # These tools are built using LLVM's build system, not Chromium's. |
8 # The build script generates a shim CMakeLists.txt in the LLVM source tree, | 8 # The build script generates a shim CMakeLists.txt in the LLVM source tree, |
9 # which simply forwards to this file. | 9 # which simply forwards to this file. |
10 | 10 |
11 | 11 |
12 # Use rpath to find the bundled standard C++ library. | 12 # Use rpath to find the bundled standard C++ library. |
13 set(CMAKE_BUILD_WITH_INSTALL_RPATH ON) | 13 set(CMAKE_BUILD_WITH_INSTALL_RPATH ON) |
14 if (APPLE) | 14 if (APPLE) |
15 set(CMAKE_INSTALL_NAME_DIR "@rpath") | 15 set(CMAKE_INSTALL_NAME_DIR "@rpath") |
16 set(CMAKE_INSTALL_RPATH "@executable_path/../lib") | 16 set(CMAKE_INSTALL_RPATH "@executable_path/../lib") |
17 else(UNIX) | 17 else(UNIX) |
18 set(CMAKE_INSTALL_RPATH "\$ORIGIN/../lib") | 18 set(CMAKE_INSTALL_RPATH "\$ORIGIN/../lib") |
19 endif() | 19 endif() |
20 | 20 |
21 include_directories("${CMAKE_SOURCE_DIR}/include" | 21 include_directories("${CMAKE_SOURCE_DIR}/include" |
22 "${CMAKE_SOURCE_DIR}/tools/clang/include" | |
23 "${CMAKE_BINARY_DIR}/include" | 22 "${CMAKE_BINARY_DIR}/include" |
24 "${CMAKE_BINARY_DIR}/tools/clang/include") | 23 "${CMAKE_BINARY_DIR}/tools/clang/include") |
25 | 24 |
26 link_directories("${CMAKE_SOURCE_DIR}/lib" | 25 link_directories("${CMAKE_SOURCE_DIR}/lib" |
27 "${CMAKE_SOURCE_DIR}/tools/clang/lib" | |
28 "${CMAKE_BINARY_DIR}/lib" | 26 "${CMAKE_BINARY_DIR}/lib" |
29 "${CMAKE_BINARY_DIR}/tools/clang/lib") | 27 "${CMAKE_BINARY_DIR}/tools/clang/lib") |
30 | 28 |
| 29 if (DEFINED LLVM_EXTERNAL_CLANG_SOURCE_DIR) |
| 30 include_directories("${LLVM_EXTERNAL_CLANG_SOURCE_DIR}/include") |
| 31 link_directories("${LLVM_EXTERNAL_CLANG_SOURCE_DIR}/lib") |
| 32 else () |
| 33 include_directories("${CMAKE_SOURCE_DIR}/tools/clang/include") |
| 34 link_directories("${CMAKE_SOURCE_DIR}/tools/clang/lib") |
| 35 endif () |
| 36 |
31 # Tests for all enabled tools can be run by building this target. | 37 # Tests for all enabled tools can be run by building this target. |
32 add_custom_target(cr-check-all COMMAND ${CMAKE_CTEST_COMMAND} -V) | 38 add_custom_target(cr-check-all COMMAND ${CMAKE_CTEST_COMMAND} -V) |
33 | 39 |
34 # cr_add_test( | 40 # cr_add_test( |
35 # name | 41 # name |
36 # testprog | 42 # testprog |
37 # arguments... | 43 # arguments... |
38 # ) | 44 # ) |
39 function(cr_add_test name testprog) | 45 function(cr_add_test name testprog) |
40 add_custom_target( | 46 add_custom_target( |
41 ${name} COMMAND ${testprog} ${ARGN} | 47 ${name} COMMAND ${testprog} ${ARGN} |
42 WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}") | 48 WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}") |
43 add_dependencies(cr-check-all ${name}) | 49 add_dependencies(cr-check-all ${name}) |
44 endfunction(cr_add_test) | 50 endfunction(cr_add_test) |
45 | 51 |
46 function(cr_install) | 52 function(cr_install) |
47 install(${ARGN} COMPONENT chrome-tools OPTIONAL) | 53 install(${ARGN} COMPONENT chrome-tools OPTIONAL) |
48 endfunction(cr_install) | 54 endfunction(cr_install) |
49 | 55 |
50 # Custom install target, so the chrome tools can be installed without installing | 56 # Custom install target, so the chrome tools can be installed without installing |
51 # all the other LLVM targets. | 57 # all the other LLVM targets. |
52 add_custom_target(cr-install COMMAND | 58 add_custom_target(cr-install COMMAND |
53 ${CMAKE_COMMAND} -D COMPONENT=chrome-tools -P cmake_install.cmake) | 59 ${CMAKE_COMMAND} -D COMPONENT=chrome-tools -P cmake_install.cmake) |
54 | 60 |
55 foreach(tool ${CHROMIUM_TOOLS}) | 61 foreach(tool ${CHROMIUM_TOOLS}) |
56 add_subdirectory(${tool}) | 62 add_subdirectory(${tool}) |
57 endforeach(tool) | 63 endforeach(tool) |
OLD | NEW |