Skip to content

Commit

Permalink
[cmake] Do not issue a fatal error on version mismatch for Debug builds.
Browse files Browse the repository at this point in the history
Instead we print a warning presuming the developer knows what to do. The use
case is upgrading clad to newer llvm versions.
  • Loading branch information
vgvassilev committed Dec 23, 2024
1 parent 9f245ce commit 489c14a
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,11 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
endif()

if (LLVM_PACKAGE_VERSION VERSION_LESS LLVM_MIN_SUPPORTED OR LLVM_PACKAGE_VERSION VERSION_GREATER_EQUAL LLVM_VERSION_UPPER_BOUND)
message(FATAL_ERROR "Found unsupported version: LLVM ${LLVM_PACKAGE_VERSION};\nPlease set LLVM_DIR pointing to the llvm version ${LLVM_MIN_SUPPORTED} to ${LLVM_MAX_SUPPORTED} build or installation folder")
set(diag_kind FATAL_ERROR)
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
set(diag_kind WARNING)
endif()
message(${diag_kind} "Found unsupported version: LLVM ${LLVM_PACKAGE_VERSION};\nPlease set LLVM_DIR pointing to the llvm version ${LLVM_MIN_SUPPORTED} to ${LLVM_MAX_SUPPORTED} build or installation folder")
endif()

message(STATUS "Found supported version: LLVM ${LLVM_PACKAGE_VERSION}")
Expand Down Expand Up @@ -136,7 +140,11 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
endif()

if (LLVM_PACKAGE_VERSION VERSION_LESS CLANG_MIN_SUPPORTED OR LLVM_PACKAGE_VERSION VERSION_GREATER_EQUAL CLANG_VERSION_UPPER_BOUND)
message(FATAL_ERROR "Found unsupported version: Clang ${LLVM_PACKAGE_VERSION};\nPlease set Clang_DIR pointing to the clang version ${CLANG_MIN_SUPPORTED} to ${CLANG_MAX_SUPPORTED} build or installation folder")
set(diag_kind FATAL_ERROR)
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
set(diag_kind WARNING)
endif()
message(${diag_kind} "Found unsupported version: Clang ${LLVM_PACKAGE_VERSION};\nPlease set Clang_DIR pointing to the clang version ${CLANG_MIN_SUPPORTED} to ${CLANG_MAX_SUPPORTED} build or installation folder")
endif()

message(STATUS "Found supported version: Clang ${LLVM_PACKAGE_VERSION}")
Expand Down

0 comments on commit 489c14a

Please sign in to comment.