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. 8 # It expects LLVM_SRC_DIR and LLVM_BUILD_DIR to be set. 9 # For example: 10 # 11 # cmake -GNinja \ 12 # -DLLVM_BUILD_DIR=$CHROMIUM_SRC_DIR/third_party/llvm-build/Release+Asserts \ 13 # -DLLVM_SRC_DIR=$CHROMIUM_SRC_DIR/third_party/llvm \ 14 # -DCHROMIUM_TOOLS=blink_gc_plugin;plugin \ 15 # $CHROMIUM_SRC_DIR/tools/clang/ 16 # ninja 17 18 19 include(LLVMConfig) 20 include(AddLLVM) 21 include(HandleLLVMOptions) 22 23 # Use rpath to find the bundled standard C++ library. 24 set(CMAKE_BUILD_WITH_INSTALL_RPATH ON) 25 if (APPLE) 26 set(CMAKE_INSTALL_NAME_DIR "@rpath") 27 set(CMAKE_INSTALL_RPATH "@executable_path/../lib") 28 else(UNIX) 29 set(CMAKE_INSTALL_RPATH "\$ORIGIN/../lib") 30 endif() 31 32 set(LLVM_RUNTIME_OUTPUT_INTDIR "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin") 33 set(LLVM_LIBRARY_OUTPUT_INTDIR "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib") 34 35 include_directories("${LLVM_SRC_DIR}/include" 36 "${LLVM_SRC_DIR}/tools/clang/include" 37 "${LLVM_BUILD_DIR}/include" 38 "${LLVM_BUILD_DIR}/tools/clang/include") 39 40 link_directories("${LLVM_SRC_DIR}/lib" 41 "${LLVM_SRC_DIR}/tools/clang/lib" 42 "${LLVM_BUILD_DIR}/lib" 43 "${LLVM_BUILD_DIR}/tools/clang/lib") 44 45 # cr_add_test( 46 # name 47 # testprog 48 # arguments... 49 # ) 50 function(cr_add_test name testprog) 51 add_test(NAME ${name} COMMAND ${testprog} ${ARGN}) 52 add_dependencies(check-all ${name}) 53 endfunction(cr_add_test) 54 55 # Tests for all enabled tools can be run by building this target. 56 add_custom_target(check-all COMMAND ${CMAKE_CTEST_COMMAND} -V) 57 58 foreach(tool ${CHROMIUM_TOOLS}) 59 add_subdirectory(${tool}) 60 endforeach(tool) 61