File tree Expand file tree Collapse file tree 3 files changed +11
-19
lines changed Expand file tree Collapse file tree 3 files changed +11
-19
lines changed Original file line number Diff line number Diff line change @@ -16,12 +16,13 @@ MESSAGE(STATUS "CMake v${CMAKE_VERSION}")
16
16
17
17
IF (CMAKE_SYSTEM_NAME STREQUAL "Linux" )
18
18
# If using older glibc, need to link with -lrt. See clock_getres(2).
19
- EXECUTE_PROCESS (
20
- COMMAND ${PROJECT_SOURCE_DIR} /print-glibc-version.sh ${CMAKE_C_COMPILER}
21
- OUTPUT_VARIABLE GLIBC_VERSION )
22
- IF (NOT GLIBC_VERSION EQUAL "" AND GLIBC_VERSION VERSION_LESS 2.17 )
23
- SET (LIBS ${LIBS} rt )
24
- ENDIF ()
19
+ include (CheckSymbolExists )
20
+ check_symbol_exists (clock_getres "time.h" HAS_clock_getres_WITHOUT_LIBRT )
21
+
22
+ if (NOT HAS_clock_getres_WITHOUT_LIBRT )
23
+ find_library (RT_LIBRARY rt )
24
+ set (NEED_LIBRT_FOR_clock_getres ON )
25
+ endif ()
25
26
ELSEIF (CMAKE_SYSTEM_NAME STREQUAL "Android" )
26
27
# for android-ndk >= r19b
27
28
set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY "BOTH" )
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -119,6 +119,10 @@ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DXXH_HEADER_NAME=\\\"lsquic_xxhash.h\\\"")
119
119
SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DLSQPACK_ENC_LOGGER_HEADER=\\\" lsquic_qpack_enc_logger.h\\\" " )
120
120
SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DLSQPACK_DEC_LOGGER_HEADER=\\\" lsquic_qpack_dec_logger.h\\\" " )
121
121
122
+ if (NEED_LIBRT_FOR_clock_getres )
123
+ target_link_libraries (lsquic PRIVATE ${RT_LIBRARY} )
124
+ endif ()
125
+
122
126
IF (LSQUIC_SHARED_LIB )
123
127
add_library (lsquic SHARED ${lsquic_STAT_SRCS} )
124
128
TARGET_LINK_LIBRARIES (lsquic PRIVATE ${BORINGSSL_LIB_ssl} ${BORINGSSL_LIB_crypto} ${ZLIB_LIB} )
You can’t perform that action at this time.
0 commit comments