forked from onyx-intl/cmake_modules
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtc.cmake
31 lines (26 loc) · 983 Bytes
/
tc.cmake
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
MACRO(ENABLE_THREADS TARGET)
IF(CMAKE_THREAD_LIBS_INIT)
SET_TARGET_PROPERTIES(${TARGET}
PROPERTIES LINK_FLAGS ${CMAKE_THREAD_LIBS_INIT})
ELSE(CMAKE_THREAD_LIBS_INIT)
MESSAGE("Threading library not found!")
ENDIF(CMAKE_THREAD_LIBS_INIT)
ENDMACRO(ENABLE_THREADS)
MACRO(COMPILE_WITH_THREAD_SAFETY TARGET)
SET_TARGET_PROPERTIES(${TARGET}
PROPERTIES COMPILE_FLAGS "-DNABOO_THREAD_SAFE")
ENDMACRO(COMPILE_WITH_THREAD_SAFETY)
FIND_LIBRARY(LIB_TCMALLOC tcmalloc)
IF(LIB_TCMALLOC)
MESSAGE("Linking with tcmalloc ...")
MESSAGE("Set the environment variable HEAPCHECK=normal to enable heap check.")
ELSE(LIB_TCMALLOC)
MESSAGE("Linking without tcmalloc ...")
ENDIF(LIB_TCMALLOC)
# Try to find tcmalloc for heap checking and profiling
MACRO(MAYBE_LINK_TCMALLOC TARGET)
IF(LIB_TCMALLOC)
ENABLE_THREADS(${TARGET})
TARGET_LINK_LIBRARIES(${TARGET} ${LIB_TCMALLOC})
ENDIF(LIB_TCMALLOC)
ENDMACRO(MAYBE_LINK_TCMALLOC)