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