Skip to content

Commit b93c43f

Browse files
committed
fix: don't test 64-bit time when not available
1 parent 3a46724 commit b93c43f

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

CMakeLists.txt

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,11 @@ if(CMakePythonDistributions_SUPERBUILD)
189189
#
190190
if(NOT DEFINED CMakeProject_BINARY_DIR)
191191

192-
# glibc check
192+
# cmake cache arguments
193+
set(_cmake_cache_args)
194+
193195
if(UNIX AND NOT APPLE)
196+
# glibc check
194197
# as of CMake 3.23.0, the minimum supported version of libuv is 1.28.0.
195198
# this implies that the minimum supported glibc version is 2.12
196199
# https://github.com/libuv/libuv/blob/v1.x/SUPPORTED_PLATFORMS.md
@@ -206,10 +209,25 @@ if(CMakePythonDistributions_SUPERBUILD)
206209
message(FATAL_ERROR "GLIBC ${GLIBC_MAJOR}.${GLIBC_MINOR} not supported")
207210
endif()
208211
endif()
212+
213+
# Y2K38 support
214+
include(CMakePushCheckState)
215+
cmake_push_check_state(RESET)
216+
set(CMAKE_REQUIRED_DEFINITIONS -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64)
217+
set(CMAKE_EXTRA_INCLUDE_FILES "time.h")
218+
include(CheckTypeSize)
219+
check_type_size(time_t SIZEOF_TIME_T LANGUAGE CXX)
220+
cmake_pop_check_state()
221+
if(HAVE_SIZEOF_TIME_T)
222+
if(SIZEOF_TIME_T LESS 8)
223+
list(APPEND _cmake_cache_args
224+
-DCMake_TEST_NO_64BIT_TIME:BOOL=TRUE
225+
)
226+
message(STATUS "SuperBuild - CMakeProject-build - 64-bit time tests disabled")
227+
endif()
228+
endif()
209229
endif()
210230

211-
# cmake cache arguments
212-
set(_cmake_cache_args)
213231
if(DEFINED CMAKE_BUILD_TYPE)
214232
list(APPEND _cmake_cache_args
215233
-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}

0 commit comments

Comments
 (0)