Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PS-9379 Fix problem with "-latomic" on some platforms in uuid_vx (8.0) #5407

Merged
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
24 changes: 22 additions & 2 deletions components/uuid_vx_udf/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,26 @@ MYSQL_ADD_COMPONENT(uuid_vx_udf

target_include_directories(component_uuid_vx_udf SYSTEM PRIVATE ${BOOST_PATCHES_DIR} ${BOOST_INCLUDE_DIR})

if(NOT APPLE)
target_link_libraries(component_uuid_vx_udf PRIVATE atomic)
# Check if -latomic is required or not
lukin-oleksiy marked this conversation as resolved.
Show resolved Hide resolved
if (NOT MSVC)
include(CheckCXXSourceCompiles)
set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
# Adding "-w" compiler option to suppres all possible warnings
set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} -std=c++17 -w)
check_cxx_source_compiles("
#include <atomic>
std::atomic<uint64_t> x(0);
int main() {
uint64_t i = x.load(std::memory_order_relaxed);
bool b = x.is_lock_free();
return 0;
}
" uuid_vx_HAVE_BUILTIN_ATOMICS)
set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
if (uuid_vx_HAVE_BUILTIN_ATOMICS)
message(STATUS "Building UUID_VX UDF component without libatomic")
else()
message(STATUS "Building UUID_VX UDF component with libatomic")
target_link_libraries(component_uuid_vx_udf PRIVATE atomic)
endif()
endif()
Loading