mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-12 18:44:59 +01:00
build: Don't override CMake's default try_compile target
CMake assumes the default value internally, so overriding this causes problems. The minimal speedup of skipping the linker isn't worth the complexity of setting it to static.
This commit is contained in:
parent
a5b0a441f8
commit
09e8fd25b1
2 changed files with 4 additions and 13 deletions
|
@ -6,15 +6,6 @@ include_guard(GLOBAL)
|
|||
include(CheckCXXSourceCompiles)
|
||||
include(CMakePushCheckState)
|
||||
|
||||
# This avoids running the linker.
|
||||
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
|
||||
|
||||
macro(check_cxx_source_links source)
|
||||
set(CMAKE_TRY_COMPILE_TARGET_TYPE EXECUTABLE)
|
||||
check_cxx_source_compiles("${source}" ${ARGN})
|
||||
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
|
||||
endmacro()
|
||||
|
||||
macro(check_cxx_source_compiles_with_flags flags source)
|
||||
cmake_push_check_state(RESET)
|
||||
set(CMAKE_REQUIRED_FLAGS ${flags})
|
||||
|
@ -27,13 +18,13 @@ macro(check_cxx_source_links_with_flags flags source)
|
|||
cmake_push_check_state(RESET)
|
||||
set(CMAKE_REQUIRED_FLAGS ${flags})
|
||||
list(JOIN CMAKE_REQUIRED_FLAGS " " CMAKE_REQUIRED_FLAGS)
|
||||
check_cxx_source_links("${source}" ${ARGN})
|
||||
check_cxx_source_compiles("${source}" ${ARGN})
|
||||
cmake_pop_check_state()
|
||||
endmacro()
|
||||
|
||||
macro(check_cxx_source_links_with_libs libs source)
|
||||
cmake_push_check_state(RESET)
|
||||
set(CMAKE_REQUIRED_LIBRARIES "${libs}")
|
||||
check_cxx_source_links("${source}" ${ARGN})
|
||||
check_cxx_source_compiles("${source}" ${ARGN})
|
||||
cmake_pop_check_state()
|
||||
endmacro()
|
||||
|
|
|
@ -26,7 +26,7 @@ function(test_append_socket_library target)
|
|||
")
|
||||
|
||||
include(CheckSourceCompilesAndLinks)
|
||||
check_cxx_source_links("${check_socket_source}" IFADDR_LINKS_WITHOUT_LIBSOCKET)
|
||||
check_cxx_source_compiles("${check_socket_source}" IFADDR_LINKS_WITHOUT_LIBSOCKET)
|
||||
if(NOT IFADDR_LINKS_WITHOUT_LIBSOCKET)
|
||||
check_cxx_source_links_with_libs(socket "${check_socket_source}" IFADDR_NEEDS_LINK_TO_LIBSOCKET)
|
||||
if(IFADDR_NEEDS_LINK_TO_LIBSOCKET)
|
||||
|
@ -78,7 +78,7 @@ function(test_append_atomic_library target)
|
|||
")
|
||||
|
||||
include(CheckSourceCompilesAndLinks)
|
||||
check_cxx_source_links("${check_atomic_source}" STD_ATOMIC_LINKS_WITHOUT_LIBATOMIC)
|
||||
check_cxx_source_compiles("${check_atomic_source}" STD_ATOMIC_LINKS_WITHOUT_LIBATOMIC)
|
||||
if(STD_ATOMIC_LINKS_WITHOUT_LIBATOMIC)
|
||||
return()
|
||||
endif()
|
||||
|
|
Loading…
Add table
Reference in a new issue