toolchain: Add CMake options for linking (#6112)

This commit is contained in:
Teddy Reed 2020-01-16 23:09:35 -05:00 committed by GitHub
parent 2303e1bbd0
commit b8eacfa1f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View File

@ -2,9 +2,6 @@ include(CheckPIESupported)
check_pie_supported()
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_LINK_SEARCH_START_STATIC ON)
set(CMAKE_LINK_SEARCH_END_STATIC ON)
function(setupBuildFlags)
add_library(cxx_settings INTERFACE)
add_library(c_settings INTERFACE)
@ -62,6 +59,7 @@ function(setupBuildFlags)
)
set(posix_cxx_link_options
-stdlib=libc++
-ldl
)

View File

@ -4,4 +4,11 @@ if(OSQUERY_TOOLCHAIN_SYSROOT)
overwrite_cache_variable("CMAKE_C_COMPILER" "STRING" "${OSQUERY_TOOLCHAIN_SYSROOT}/usr/bin/clang")
overwrite_cache_variable("CMAKE_CXX_COMPILER" "STRING" "${OSQUERY_TOOLCHAIN_SYSROOT}/usr/bin/clang++")
overwrite_cache_variable("CMAKE_SYSROOT" "PATH" "${OSQUERY_TOOLCHAIN_SYSROOT}")
overwrite_cache_variable("CMAKE_LINK_SEARCH_START_STATIC" "BOOL" "ON")
overwrite_cache_variable("CMAKE_LINK_SEARCH_END_STATIC" "BOOL" "ON")
else()
option(OSQUERY_STATIC_BUILD "Whether to prefer linking static libraries or not")
overwrite_cache_variable("CMAKE_LINK_SEARCH_START_STATIC" "BOOL" "${OSQUERY_STATIC_BUILD}")
overwrite_cache_variable("CMAKE_LINK_SEARCH_END_STATIC" "BOOL" "${OSQUERY_STATIC_BUILD}")
endif()