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