CMakeLists.txt 2.0 KB

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