mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-18 12:22:12 +00:00
48 lines
1.0 KiB
CMake
48 lines
1.0 KiB
CMake
include (CheckCXXSourceCompiles)
|
|
include (CMakePushCheckState)
|
|
|
|
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
|
find_package(Threads)
|
|
|
|
cmake_push_check_state ()
|
|
|
|
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
|
# clang4 : -no-pie cause error
|
|
# clang6 : -no-pie cause warning
|
|
|
|
if (MAKE_STATIC_LIBRARIES)
|
|
set (TEST_FLAG "-Wl,-Bstatic -stdlib=libc++ -lc++ -lc++abi -Wl,-Bdynamic")
|
|
else ()
|
|
set (TEST_FLAG "-stdlib=libc++ -lc++ -lc++abi")
|
|
endif ()
|
|
|
|
set (CMAKE_REQUIRED_FLAGS "${TEST_FLAG}")
|
|
set (CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} Threads::Threads)
|
|
|
|
check_cxx_source_compiles("
|
|
#include <iostream>
|
|
int main() {
|
|
std::cerr << std::endl;
|
|
return 0;
|
|
}
|
|
" HAVE_LIBCXX)
|
|
|
|
else ()
|
|
|
|
set (TEST_FLAG "-no-pie")
|
|
set (CMAKE_REQUIRED_FLAGS "${TEST_FLAG}")
|
|
|
|
check_cxx_source_compiles("
|
|
int main() {
|
|
return 0;
|
|
}
|
|
" HAVE_NO_PIE)
|
|
|
|
if (HAVE_NO_PIE)
|
|
set (FLAG_NO_PIE ${TEST_FLAG})
|
|
endif ()
|
|
|
|
endif ()
|
|
|
|
cmake_pop_check_state ()
|