Autodetect llvm version on Ubuntu.
@@ -75,18 +75,16 @@ function(setup_vespa_default_build_settings_fedora_34)
set(DEFAULT_VESPA_LLVM_VERSION "11" PARENT_SCOPE)
endfunction()
-function(setup_vespa_default_build_settings_ubuntu_19_10)
- message("-- Setting up default build settings for ubuntu 19.10")
- set(DEFAULT_EXTRA_LINK_DIRECTORY "${VESPA_DEPS}/lib" "/usr/lib/llvm-9/lib" PARENT_SCOPE)
- set(DEFAULT_EXTRA_INCLUDE_DIRECTORY "${VESPA_DEPS}/include" "/usr/lib/llvm-9/include" PARENT_SCOPE)
- set(DEFAULT_VESPA_LLVM_VERSION "9" PARENT_SCOPE)
-endfunction()
-
-function(setup_vespa_default_build_settings_ubuntu_20_04)
- message("-- Setting up default build settings for ubuntu 20.04")
- set(DEFAULT_EXTRA_LINK_DIRECTORY "${VESPA_DEPS}/lib" "/usr/lib/llvm-10/lib" PARENT_SCOPE)
- set(DEFAULT_EXTRA_INCLUDE_DIRECTORY "${VESPA_DEPS}/include" "/usr/lib/llvm-10/include" PARENT_SCOPE)
- set(DEFAULT_VESPA_LLVM_VERSION "10" PARENT_SCOPE)
+function(setup_vespa_default_build_settings_ubuntu)
+ message("-- Setting up default build settings for ubuntu")
+ SET(CMAKE_FIND_PACKAGE_SORT_ORDER NATURAL)
+ SET(CMAKE_FIND_PACKAGE_SORT_DIRECTION DEC)
+ find_package(LLVM REQUIRED CONFIG)
+ message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}")
+ message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}")
+ set(DEFAULT_VESPA_LLVM_VERSION ${LLVM_VERSION_MAJOR} PARENT_SCOPE)
+ set(DEFAULT_EXTRA_LINK_DIRECTORY "${VESPA_DEPS}/lib" ${LLVM_LIBRARY_DIRS} PARENT_SCOPE)
+ set(DEFAULT_EXTRA_INCLUDE_DIRECTORY "${VESPA_DEPS}/include" ${LLVM_INCLUDE_DIRS} PARENT_SCOPE)
endfunction()
function(setup_vespa_default_build_settings_debian)
@@ -184,10 +182,8 @@ function(vespa_use_default_build_settings)
setup_vespa_default_build_settings_fedora_33()
elseif(VESPA_OS_DISTRO_COMBINED STREQUAL "fedora 34")
setup_vespa_default_build_settings_fedora_34()
- elseif(VESPA_OS_DISTRO_COMBINED STREQUAL "ubuntu 19.10")
- setup_vespa_default_build_settings_ubuntu_19_10()
- elseif(VESPA_OS_DISTRO_COMBINED STREQUAL "ubuntu 20.04")
- setup_vespa_default_build_settings_ubuntu_20_04()
+ elseif(VESPA_OS_DISTRO STREQUAL "ubuntu")
+ setup_vespa_default_build_settings_ubuntu()
elseif(VESPA_OS_DISTRO STREQUAL "debian")
setup_vespa_default_build_settings_debian()
else()
