blob: 1e4196171ea4a9c68883eeea047d796a229ec76a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Ali Mohammad Pur <ali.mpfard@gmail.com>
Date: Thu, 24 Feb 2022 03:47:50 +0330
Subject: [PATCH] Explicitly link with pthread
The cmakelists was using the wrong variable to link against pthread.
---
CMakeLists.txt | 5 +++--
tests/CMakeLists.txt | 12 ++++++------
2 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c8ebd9b..e9c52f1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -52,7 +52,8 @@ IF(enable_threads)
FIND_PACKAGE(Threads REQUIRED)
MESSAGE("Thread Model: ${CMAKE_THREAD_LIBS_INIT}" )
INCLUDE_DIRECTORIES(${Threads_INCLUDE_DIR})
- SET(LIBS ${LIBS} ${Threads_LIBRARIES})
+ SET(LIBS ${LIBS} ${Threads_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
+ MESSAGE("Libs: ${LIBS}" )
ENDIF(enable_threads)
OPTION(enable_handle_fork "Attempt to ensure a usable collector after fork()" ON)
@@ -235,7 +236,7 @@ ENDIF(enable_checksums)
ADD_LIBRARY( gc-lib STATIC ${SRC})
SET_TARGET_PROPERTIES(gc-lib PROPERTIES
COMPILE_DEFINITIONS GC_NOT_DLL)
-#TODO TARGET_LINK_LIBRARIES(... ... ${LIBS})
+TARGET_LINK_LIBRARIES(gc-lib ${LIBS})
ADD_LIBRARY( gcmt-dll SHARED ${SRC})
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 3c84220..5e15727 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -23,25 +23,25 @@ SET_SOURCE_FILES_PROPERTIES(
PROPERTIES LANGUAGE CXX)
ADD_EXECUTABLE(gctest WIN32 test.c)
-TARGET_LINK_LIBRARIES(gctest gc-lib)
+TARGET_LINK_LIBRARIES(gctest gc-lib ${LIBS})
ADD_TEST(NAME gctest COMMAND gctest)
ADD_EXECUTABLE(hugetest huge_test.c)
-TARGET_LINK_LIBRARIES(hugetest gc-lib)
+TARGET_LINK_LIBRARIES(hugetest gc-lib ${LIBS})
ADD_TEST(NAME hugetest COMMAND hugetest)
ADD_EXECUTABLE(leaktest leak_test.c)
-TARGET_LINK_LIBRARIES(leaktest gc-lib)
+TARGET_LINK_LIBRARIES(leaktest gc-lib ${LIBS})
ADD_TEST(NAME leaktest COMMAND leaktest)
ADD_EXECUTABLE(middletest middle.c)
-TARGET_LINK_LIBRARIES(middletest gc-lib)
+TARGET_LINK_LIBRARIES(middletest gc-lib ${LIBS})
ADD_TEST(NAME middletest COMMAND middletest)
ADD_EXECUTABLE(realloc_test realloc_test.c)
-TARGET_LINK_LIBRARIES(realloc_test gc-lib)
+TARGET_LINK_LIBRARIES(realloc_test gc-lib ${LIBS})
ADD_TEST(NAME realloc_test COMMAND realloc_test)
ADD_EXECUTABLE(smashtest smash_test.c)
-TARGET_LINK_LIBRARIES(smashtest gc-lib)
+TARGET_LINK_LIBRARIES(smashtest gc-lib ${LIBS})
ADD_TEST(NAME smashtest COMMAND smashtest)
|