Skip to content

Commit

Permalink
Merge pull request #11 from bahnwaerter/cmake-find-latest-packages
Browse files Browse the repository at this point in the history
Let CMake search for the latest version of installed LLVM packages
  • Loading branch information
mgehre authored Nov 14, 2023
2 parents decb1d7 + e1ab13e commit e59adae
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.7)
project(xunused)

# Let find_package(...) search for the latest version when multiple versions of
# the same library are available. Therefore ...
#
# 1) set natural sort order to compare contiguous digits as whole numbers, and
# 2) do ordering in descending mode to test latest found folder first.
#
set(CMAKE_FIND_PACKAGE_SORT_ORDER NATURAL)
set(CMAKE_FIND_PACKAGE_SORT_DIRECTION DEC)

find_package(LLVM ${LLVM_VERSION_REQUIRED} CONFIG REQUIRED)
message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}")
message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}")
Expand Down

0 comments on commit e59adae

Please sign in to comment.