mirror of
				https://gitea.invidious.io/iv-org/litespeed-quic.git
				synced 2024-08-15 00:53:43 +00:00 
			
		
		
		
	CMake-only computation of whether librt is needed. (#374)
This commit is contained in:
		
							parent
							
								
									c4854d203f
								
							
						
					
					
						commit
						d755d26ed2
					
				
					 3 changed files with 11 additions and 19 deletions
				
			
		| 
						 | 
				
			
			@ -16,12 +16,13 @@ MESSAGE(STATUS "CMake v${CMAKE_VERSION}")
 | 
			
		|||
 | 
			
		||||
IF (CMAKE_SYSTEM_NAME STREQUAL "Linux")
 | 
			
		||||
    # If using older glibc, need to link with -lrt.  See clock_getres(2).
 | 
			
		||||
    EXECUTE_PROCESS(
 | 
			
		||||
        COMMAND ${PROJECT_SOURCE_DIR}/print-glibc-version.sh ${CMAKE_C_COMPILER}
 | 
			
		||||
        OUTPUT_VARIABLE GLIBC_VERSION)
 | 
			
		||||
    IF(NOT GLIBC_VERSION EQUAL "" AND GLIBC_VERSION VERSION_LESS 2.17)
 | 
			
		||||
        SET(LIBS ${LIBS} rt)
 | 
			
		||||
    ENDIF()
 | 
			
		||||
    include(CheckSymbolExists)
 | 
			
		||||
    check_symbol_exists(clock_getres "time.h" HAS_clock_getres_WITHOUT_LIBRT)
 | 
			
		||||
 | 
			
		||||
    if(NOT HAS_clock_getres_WITHOUT_LIBRT)
 | 
			
		||||
        find_library(RT_LIBRARY rt)
 | 
			
		||||
        set(NEED_LIBRT_FOR_clock_getres ON)
 | 
			
		||||
    endif()
 | 
			
		||||
ELSEIF (CMAKE_SYSTEM_NAME STREQUAL "Android")
 | 
			
		||||
    # for android-ndk >= r19b
 | 
			
		||||
    set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY "BOTH")
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,13 +0,0 @@
 | 
			
		|||
#!/bin/sh
 | 
			
		||||
#
 | 
			
		||||
# Determine glibc version and print it to stdout.  I have to resort to
 | 
			
		||||
# using a shell script because it is taking too long to figure out how
 | 
			
		||||
# to do this properly in cmake.
 | 
			
		||||
 | 
			
		||||
CC=$1
 | 
			
		||||
if [ "" = "$CC" ]; then
 | 
			
		||||
    CC=gcc
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
$CC -print-file-name=libc.so.6 \
 | 
			
		||||
    | perl -plne '$_ = readlink if -H; s/\.so$// && s/.*-//'
 | 
			
		||||
| 
						 | 
				
			
			@ -119,6 +119,10 @@ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DXXH_HEADER_NAME=\\\"lsquic_xxhash.h\\\"")
 | 
			
		|||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DLSQPACK_ENC_LOGGER_HEADER=\\\"lsquic_qpack_enc_logger.h\\\"")
 | 
			
		||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DLSQPACK_DEC_LOGGER_HEADER=\\\"lsquic_qpack_dec_logger.h\\\"")
 | 
			
		||||
 | 
			
		||||
if(NEED_LIBRT_FOR_clock_getres)
 | 
			
		||||
    target_link_libraries(lsquic PRIVATE ${RT_LIBRARY})
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
IF(LSQUIC_SHARED_LIB)
 | 
			
		||||
  add_library(lsquic SHARED ${lsquic_STAT_SRCS})
 | 
			
		||||
  TARGET_LINK_LIBRARIES(lsquic PRIVATE ${BORINGSSL_LIB_ssl} ${BORINGSSL_LIB_crypto} ${ZLIB_LIB})
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue