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

Fix no-pie with clang #340

Merged
merged 1 commit into from
Jan 16, 2017
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 6 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,9 @@ if (NOT APPLE)
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${GLIBC_COMPATIBILITY_LINK_FLAGS} ${CXX11_ABI_FLAGS}")
endif ()

if (USE_STATIC_LIBRARIES)
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -no-pie")
if (USE_STATIC_LIBRARIES AND NOT CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -no-pie")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -no-pie")
endif ()

# -fuse-ld=gold - fix linkage for gcc-5.4, gcc-6.1
Expand Down Expand Up @@ -197,7 +198,8 @@ if (EXISTS ${CLICKHOUSE_PRIVATE_DIR})
add_subdirectory (private)
endif ()

message (STATUS "C_FLAGS: =${CMAKE_C_FLAGS}")
message (STATUS "CXX_FLAGS:=${CMAKE_CXX_FLAGS}")
message (STATUS "C_FLAGS = ${CMAKE_C_FLAGS}")
message (STATUS "CXX_FLAGS = ${CMAKE_CXX_FLAGS}")
message (STATUS "LINK_FLAGS = ${CMAKE_EXE_LINKER_FLAGS}")

include (cmake/print_include_directories.cmake)
6 changes: 2 additions & 4 deletions contrib/libpoco/Net/cmake/test_anl.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,10 @@ endif ()
find_library (ANL_LIB NAMES ${ANL_LIB_NAME})

# better use Threads::Threads but incompatible with cmake < 3
set (CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
if (ANL_LIB)
set (CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${ANL_LIB})
endif ()

set (CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${CMAKE_EXE_LINKER_FLAGS}")
set (CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})

check_cxx_source_runs("
#include <netdb.h>
Expand All @@ -29,7 +27,7 @@ check_cxx_source_runs("
}
" HAVE_GETADDRINFO_A)

#message(STATUS "test_anl: USE_STATIC_LIBRARIES=${USE_STATIC_LIBRARIES} ANL_LIB_NAME=${ANL_LIB_NAME} ANL_LIB=${ANL_LIB} HAVE_GETADDRINFO_A=${HAVE_GETADDRINFO_A}")
#message(STATUS "test_anl: USE_STATIC_LIBRARIES=${USE_STATIC_LIBRARIES} ANL_LIB_NAME=${ANL_LIB_NAME} ANL_LIB=${ANL_LIB} HAVE_GETADDRINFO_A=${HAVE_GETADDRINFO_A} CMAKE_REQUIRED_LIBRARIES=${CMAKE_REQUIRED_LIBRARIES}")

if (HAVE_GETADDRINFO_A)
add_definitions (-DHAVE_GETADDRINFO_A=1)
Expand Down