aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2018-03-21 11:37:28 +0100
committerThomas White <taw@physics.org>2018-03-21 11:37:28 +0100
commit12e5aaa14841a7b6b8b80a1e32a2512354801f10 (patch)
treecb3d357f736d8c2a585f5b776828159621e82c43 /CMakeLists.txt
parentf686ee8e039b6145b12bff3420d02784e95d2621 (diff)
Improve/fix tests for clock_gettime and sched_setaffinity
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt8
1 files changed, 7 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3401a6be..124f17d9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -71,7 +71,13 @@ if(OpenCL_FOUND)
check_include_file(CL/cl.h HAVE_CL_CL_H "-I${OpenCL_INCLUDE_DIRS}")
endif(OpenCL_FOUND)
-check_library_exists(rt clock_gettime "time.h" HAVE_CLOCK_GETTIME)
+# Check for nice clock function
+check_symbol_exists(clock_gettime "time.h" HAVE_CLOCK_GETTIME)
+
+# Check for CPU affinity functions (Linux-specific)
+set(CMAKE_REQUIRED_DEFINITIONS "-D_GNU_SOURCE")
+check_symbol_exists(sched_setaffinity "sched.h" HAVE_CPU_AFFINITY)
+unset(CMAKE_REQUIRED_DEFINITIONS)
configure_file(config.h.cmake.in config.h)
include_directories(${CMAKE_CURRENT_BINARY_DIR})