@@ -25,10 +25,13 @@ function(test_append_socket_library target)
25
25
}
26
26
" )
27
27
28
- include (CheckSourceCompilesAndLinks )
28
+ include (CheckCXXSourceCompiles )
29
29
check_cxx_source_compiles ("${check_socket_source} " IFADDR_LINKS_WITHOUT_LIBSOCKET )
30
30
if (NOT IFADDR_LINKS_WITHOUT_LIBSOCKET )
31
- check_cxx_source_links_with_libs (socket "${check_socket_source} " IFADDR_NEEDS_LINK_TO_LIBSOCKET )
31
+ include (CheckSourceCompilesAndLinks )
32
+ check_cxx_source_compiles_with_flags ("${check_socket_source} " IFADDR_NEEDS_LINK_TO_LIBSOCKET
33
+ LINK_LIBRARIES socket
34
+ )
32
35
if (IFADDR_NEEDS_LINK_TO_LIBSOCKET )
33
36
target_link_libraries (${target} INTERFACE socket )
34
37
else ()
@@ -77,16 +80,17 @@ function(test_append_atomic_library target)
77
80
}
78
81
" )
79
82
80
- include (CheckSourceCompilesAndLinks )
83
+ include (CheckCXXSourceCompiles )
81
84
check_cxx_source_compiles ("${check_atomic_source} " STD_ATOMIC_LINKS_WITHOUT_LIBATOMIC )
82
- if (STD_ATOMIC_LINKS_WITHOUT_LIBATOMIC )
83
- return ()
84
- endif ()
85
-
86
- check_cxx_source_links_with_libs (atomic "${check_atomic_source} " STD_ATOMIC_NEEDS_LINK_TO_LIBATOMIC )
87
- if (STD_ATOMIC_NEEDS_LINK_TO_LIBATOMIC )
88
- target_link_libraries (${target} INTERFACE atomic )
89
- else ()
90
- message (FATAL_ERROR "Cannot figure out how to use std::atomic." )
85
+ if (NOT STD_ATOMIC_LINKS_WITHOUT_LIBATOMIC )
86
+ include (CheckSourceCompilesAndLinks )
87
+ check_cxx_source_compiles_with_flags ("${check_atomic_source} " STD_ATOMIC_NEEDS_LINK_TO_LIBATOMIC
88
+ LINK_LIBRARIES atomic
89
+ )
90
+ if (STD_ATOMIC_NEEDS_LINK_TO_LIBATOMIC )
91
+ target_link_libraries (${target} INTERFACE atomic )
92
+ else ()
93
+ message (FATAL_ERROR "Cannot figure out how to use std::atomic." )
94
+ endif ()
91
95
endif ()
92
96
endfunction ()
0 commit comments