Skip to content
This repository was archived by the owner on Mar 22, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 3 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -154,14 +154,6 @@ elseif(NOT VALGRIND_FOUND)
message(WARNING "Valgrind not found. Valgrind tests will not be performed.")
endif()

# Find Clang
find_program(CLANG NAMES clang)
if(CLANG)
message(STATUS "Found clang: ${CLANG} (version: ${CLANG_VERSION})")
else()
message(STATUS "clang not found")
endif()

if(BUILD_TESTS OR BUILD_EXAMPLES OR BUILD_BENCHMARKS)
# Find libpmem and libpmemobj (PMDK libraries)
if(PKG_CONFIG_FOUND)
Expand All @@ -174,10 +166,9 @@ if(BUILD_TESTS OR BUILD_EXAMPLES OR BUILD_BENCHMARKS)

# Some tests and examples require clang >= 8.0, because of the bug
# (https://bugs.llvm.org/show_bug.cgi?id=28280), which is fixed in clang v8.0.
set(CLANG_REQUIRED_BY_DESTRUCTOR_REFERENCE_BUG "8.0")
if(CLANG)
get_program_version_major_minor(${CLANG} CLANG_VERSION)
if(CLANG_VERSION VERSION_LESS CLANG_REQUIRED_BY_DESTRUCTOR_REFERENCE_BUG)

if("${CMAKE_C_COMPILER_ID}" MATCHES "Clang" AND "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "8.0")
set(CLANG_DESTRUCTOR_REFERENCE_BUG_PRESENT 1)
endif()
endif()
Expand Down
2 changes: 1 addition & 1 deletion tests/ctest_helpers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ endfunction()
# Function to build test with atomic
function(build_test_atomic name)
build_test(${name} ${ARGN})
if(CLANG)
if("${CMAKE_C_COMPILER_ID}" MATCHES "Clang" AND "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
target_link_libraries(${name} atomic)
endif()
endfunction()
Expand Down