diff --git a/cmake/FindLLVM.cmake b/cmake/FindLLVM.cmake index e1a22d3354a..4709d0cf9df 100644 --- a/cmake/FindLLVM.cmake +++ b/cmake/FindLLVM.cmake @@ -23,3 +23,24 @@ endif() add_library(LLVMHeaders INTERFACE IMPORTED) target_include_directories(LLVMHeaders INTERFACE ${LLVM_INCLUDE_DIRS}) + +function(find_llvm_libs REQUIRED_LLVM_LIBS) + find_library(LLVM_SHARED_LIB LLVM NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH PATHS ${LLVM_LIBRARY_DIR}) + set(LLVM_LIBS_TMP "" PARENT_SCOPE) + foreach(LIB IN LISTS REQUIRED_LLVM_LIBS) + find_library(LLVM_LIB ${LIB} NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH PATHS ${LLVM_LIBRARY_DIR}) + if(LLVM_LIB OR TARGET ${LIB}) + message(VERBOSE "Adding ${LIB}") + list(APPEND LLVM_LIBS_TMP ${LIB}) + elseif(LLVM_SHARED_LIB) + set(LLVM_LIBS ${LLVM_SHARED_LIB} PARENT_SCOPE) + message(STATUS "Using shared LLVM library.") + return() + else() + message(FATAL_ERROR "Can't find necessary LLVM libraries") + endif() + endforeach() + + set(LLVM_LIBS ${LLVM_LIBS_TMP} PARENT_SCOPE) + message(STATUS "Using static LLVM libraries.") +endfunction() diff --git a/cmake/Findabsl.cmake b/cmake/Findabsl.cmake index e66134b1fbc..7a1f5726676 100644 --- a/cmake/Findabsl.cmake +++ b/cmake/Findabsl.cmake @@ -12,7 +12,11 @@ if(absl_FOUND) return() endif() -message("Abseil not found via find_package. Probably not a Conan build. Using the copy from third_party/") +message(WARNING "To ensure Abseil is built with C++17 support, + it will be built from third_party folder. + If your system already has Abseil installed with C++17 support, + you can specify the Abseil configuration directory + by setting the absl_DIR variable as a cmake argument.") set(ABSL_PROPAGATE_CXX_STD ON) add_subdirectory(${CMAKE_SOURCE_DIR}/third_party/abseil-cpp) diff --git a/cmake/Findlibprocinfo.cmake b/cmake/Findlibprocinfo.cmake index d54d70184ae..5a9fe5fe87a 100644 --- a/cmake/Findlibprocinfo.cmake +++ b/cmake/Findlibprocinfo.cmake @@ -19,5 +19,6 @@ if(NOT MSVC) target_compile_options(libprocinfo PRIVATE -Wno-error=format= -Wno-error=unknown-pragmas + -Wno-error=ignored-attributes ) endif() \ No newline at end of file diff --git a/src/ObjectUtils/CMakeLists.txt b/src/ObjectUtils/CMakeLists.txt index 4102545747f..2fcea6fac27 100644 --- a/src/ObjectUtils/CMakeLists.txt +++ b/src/ObjectUtils/CMakeLists.txt @@ -4,6 +4,14 @@ cmake_minimum_required(VERSION 3.15) +set(REQUIRED_LLVM_LIBS LLVMDebugInfoCodeView + LLVMDebugInfoDWARF + LLVMDebugInfoPDB + LLVMObject + LLVMSymbolize) + +find_llvm_libs("${REQUIRED_LLVM_LIBS}") + project(ObjectUtils) add_library(ObjectUtils STATIC) @@ -55,12 +63,9 @@ target_link_libraries( absl::synchronization absl::time absl::span - LLVMDebugInfoCodeView - LLVMDebugInfoDWARF - LLVMDebugInfoPDB LLVMHeaders - LLVMObject - LLVMSymbolize) + ${LLVM_LIBS} + ) if (WIN32) target_link_libraries(ObjectUtils PUBLIC DIASDK::DIASDK) diff --git a/third_party/Outcome/include/outcome.hpp b/third_party/Outcome/include/outcome.hpp index af316618f67..6cf3d086a99 100644 --- a/third_party/Outcome/include/outcome.hpp +++ b/third_party/Outcome/include/outcome.hpp @@ -20,6 +20,7 @@ #include // IWYU pragma: export #include // IWYU pragma: export #include // IWYU pragma: export +#include // IWYU pragma: export #include #include