-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
71 lines (57 loc) · 2.12 KB
/
CMakeLists.txt
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
71
cmake_minimum_required(VERSION 2.8)
option(static_link "Use static link" FALSE)
if(static_link)
if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static")
else()
message(WARNING "Don't know how to do static link on this compiler")
endif()
endif()
if(CMAKE_COMPILER_IS_GNUCXX)
message(STATUS "Enabling C++11 and multithreading on G++")
# Enable C++11 and multithreading in g++
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -pthread")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -std=c++11 -pthread")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -std=c++11 -pthread")
set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} -std=c++11 -pthread")
option(use_gxx_thread_workaround "Enable g++ thread bug workaround, fixes instant core dump" ON)
if (use_gxx_thread_workaround)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--no-as-needed")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--no-as-needed")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-as-needed")
set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} -Wl,--no-as-needed")
endif()
elseif(MSVC)
# Do nothing
else()
message(WARNING "Don't know how to enable C++11 and multithreading on this compiler")
endif()
add_executable(starve-check main.cpp
stress_instance.cpp
stress_instance.h
)
# Install target
install(TARGETS starve-check
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
# Packages
# Set defaults
set(CPACK_GENERATOR "DEB")
set(CPACK_PACKAGE_NAME "starve-check")
set(CPACK_PACKAGE_VENDOR "Doug Gale")
set(CPACK_PACKAGE_VERSION_MAJOR 1)
set(CPACK_PACKAGE_VERSION_MINOR 0)
set(CPACK_PACKAGE_VERSION_PATCH 0)
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Detect CPU starvation")
set(CPACK_PACKAGE_DESCRIPTION "See how much cpu time you are actually getting")
set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://github.com/doug65536/starve-check")
#set(CPACK_
########
# Debian
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libstdc++6:amd64")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "[email protected]")
# Mandaory
########
include(CPack)