summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorGereon Kremer <gereon.kremer@cs.rwth-aachen.de>2021-03-05 12:37:50 +0100
committerGitHub <noreply@github.com>2021-03-05 11:37:50 +0000
commite73c81f0241a0f46a94b548dc6c2aaba338637c1 (patch)
treed5b182068a60516527bc3d9fe5f91f2a97c9ec53 /cmake
parentd09ca870bcaef2efbf4f0d5a25b16f301ef5a0df (diff)
Reimplement time limit mechanism for windows (#6049)
As noted in #5034, --tlimit is not working properly on windows. It turns out that the timer mechanism provided by the windows API are not suitable for our use case. Thus, this PR implements a generic std::thread-based timer mechanism which is used whenever the POSIX timers (setitimer) are not available. It also adds some documentation on the timer options and the reasons we ended up with this. Fixes #5034.
Diffstat (limited to 'cmake')
-rw-r--r--cmake/ConfigureCVC4.cmake7
-rw-r--r--cmake/Toolchain-mingw64.cmake4
2 files changed, 9 insertions, 2 deletions
diff --git a/cmake/ConfigureCVC4.cmake b/cmake/ConfigureCVC4.cmake
index 9c160e4fc..421fd9f4f 100644
--- a/cmake/ConfigureCVC4.cmake
+++ b/cmake/ConfigureCVC4.cmake
@@ -76,6 +76,13 @@ check_symbol_exists(optreset "getopt.h" HAVE_DECL_OPTRESET)
check_symbol_exists(sigaltstack "signal.h" HAVE_SIGALTSTACK)
check_symbol_exists(strerror_r "string.h" HAVE_STRERROR_R)
check_symbol_exists(strtok_r "string.h" HAVE_STRTOK_R)
+check_symbol_exists(setitimer "sys/time.h" HAVE_SETITIMER)
+
+# on non-POSIX systems, time limit is implemented with threads
+if(NOT HAVE_SETITIMER)
+ find_package(Threads REQUIRED)
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_THREAD_LIBS_INIT}")
+endif()
# Determine if we have the POSIX (int) or GNU (char *) variant of strerror_r.
check_c_source_compiles(
diff --git a/cmake/Toolchain-mingw64.cmake b/cmake/Toolchain-mingw64.cmake
index 604de4159..dd2367c72 100644
--- a/cmake/Toolchain-mingw64.cmake
+++ b/cmake/Toolchain-mingw64.cmake
@@ -16,8 +16,8 @@ SET(CMAKE_SYSTEM_NAME Windows)
set(TOOLCHAIN_PREFIX x86_64-w64-mingw32)
-SET(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc)
-SET(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++)
+SET(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc-posix)
+SET(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++-posix)
SET(CMAKE_RC_COMPILER ${TOOLCHAIN_PREFIX}-windres)
# Set target environment path
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback