[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnurl] 39/219: cmake: avoid linking executable for some te
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnurl] 39/219: cmake: avoid linking executable for some tests with cmake 3.6+ |
Date: |
Wed, 22 May 2019 19:16:18 +0200 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to branch master
in repository gnurl.
commit be17f298ff508d62d493d4a8d43e56a1e2861a50
Author: Jakub Zakrzewski <address@hidden>
AuthorDate: Sun Apr 7 12:43:38 2019 +0200
cmake: avoid linking executable for some tests with cmake 3.6+
With CMAKE_TRY_COMPILE_TARGET_TYPE set to STATIC_LIBRARY, the try_compile()
(which is used by check_c_source_compiles()) will build static library
instead of executable. This avoids linking additional libraries in and thus
speeds up those checks a little.
This commit also avoids #3743 (GSSAPI build errors) on itself with cmake
3.6 or above. That issue was fixed separately for all versions.
Ref: #3744
---
CMake/OtherTests.cmake | 75 +++++++++++++++++++++++++++-----------------------
1 file changed, 40 insertions(+), 35 deletions(-)
diff --git a/CMake/OtherTests.cmake b/CMake/OtherTests.cmake
index c180a5888..c1c9aa32a 100644
--- a/CMake/OtherTests.cmake
+++ b/CMake/OtherTests.cmake
@@ -24,6 +24,8 @@ else()
add_header_include(HAVE_SYS_SOCKET_H "sys/socket.h")
endif()
+set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
+
check_c_source_compiles("${_source_epilogue}
int main(void) {
recv(0, 0, 0, 0);
@@ -177,6 +179,44 @@ int main(void) {
return 0;
}" HAVE_STRUCT_TIMEVAL)
+set(HAVE_SIG_ATOMIC_T 1)
+set(CMAKE_REQUIRED_FLAGS)
+if(HAVE_SIGNAL_H)
+ set(CMAKE_REQUIRED_FLAGS "-DHAVE_SIGNAL_H")
+ set(CMAKE_EXTRA_INCLUDE_FILES "signal.h")
+endif()
+check_type_size("sig_atomic_t" SIZEOF_SIG_ATOMIC_T)
+if(HAVE_SIZEOF_SIG_ATOMIC_T)
+ check_c_source_compiles("
+ #ifdef HAVE_SIGNAL_H
+ # include <signal.h>
+ #endif
+ int main(void) {
+ static volatile sig_atomic_t dummy = 0;
+ (void)dummy;
+ return 0;
+ }" HAVE_SIG_ATOMIC_T_NOT_VOLATILE)
+ if(NOT HAVE_SIG_ATOMIC_T_NOT_VOLATILE)
+ set(HAVE_SIG_ATOMIC_T_VOLATILE 1)
+ endif()
+endif()
+
+if(HAVE_WINDOWS_H)
+ set(CMAKE_EXTRA_INCLUDE_FILES winsock2.h)
+else()
+ set(CMAKE_EXTRA_INCLUDE_FILES)
+ if(HAVE_SYS_SOCKET_H)
+ set(CMAKE_EXTRA_INCLUDE_FILES sys/socket.h)
+ endif()
+endif()
+
+check_type_size("struct sockaddr_storage" SIZEOF_STRUCT_SOCKADDR_STORAGE)
+if(HAVE_SIZEOF_STRUCT_SOCKADDR_STORAGE)
+ set(HAVE_STRUCT_SOCKADDR_STORAGE 1)
+endif()
+
+unset(CMAKE_TRY_COMPILE_TARGET_TYPE)
+
if(NOT DEFINED CMAKE_TOOLCHAIN_FILE)
# if not cross-compilation...
include(CheckCSourceRuns)
@@ -222,38 +262,3 @@ if(NOT DEFINED CMAKE_TOOLCHAIN_FILE)
}" HAVE_POLL_FINE)
endif()
-set(HAVE_SIG_ATOMIC_T 1)
-set(CMAKE_REQUIRED_FLAGS)
-if(HAVE_SIGNAL_H)
- set(CMAKE_REQUIRED_FLAGS "-DHAVE_SIGNAL_H")
- set(CMAKE_EXTRA_INCLUDE_FILES "signal.h")
-endif()
-check_type_size("sig_atomic_t" SIZEOF_SIG_ATOMIC_T)
-if(HAVE_SIZEOF_SIG_ATOMIC_T)
- check_c_source_compiles("
- #ifdef HAVE_SIGNAL_H
- # include <signal.h>
- #endif
- int main(void) {
- static volatile sig_atomic_t dummy = 0;
- (void)dummy;
- return 0;
- }" HAVE_SIG_ATOMIC_T_NOT_VOLATILE)
- if(NOT HAVE_SIG_ATOMIC_T_NOT_VOLATILE)
- set(HAVE_SIG_ATOMIC_T_VOLATILE 1)
- endif()
-endif()
-
-if(HAVE_WINDOWS_H)
- set(CMAKE_EXTRA_INCLUDE_FILES winsock2.h)
-else()
- set(CMAKE_EXTRA_INCLUDE_FILES)
- if(HAVE_SYS_SOCKET_H)
- set(CMAKE_EXTRA_INCLUDE_FILES sys/socket.h)
- endif()
-endif()
-
-check_type_size("struct sockaddr_storage" SIZEOF_STRUCT_SOCKADDR_STORAGE)
-if(HAVE_SIZEOF_STRUCT_SOCKADDR_STORAGE)
- set(HAVE_STRUCT_SOCKADDR_STORAGE 1)
-endif()
--
To stop receiving notification emails like this one, please contact
address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] [gnurl] 39/219: cmake: avoid linking executable for some tests with cmake 3.6+,
gnunet <=