GCC 4.8 build fixes: ensure all extern template declarations are in fact extern'ed...
[dyninst.git] / common / CMakeLists.txt
1 # CMake configuration for common directory
2
3
4 if(NOT WIN32)
5 include_directories (
6     ${PROJECT_SOURCE_DIR}/common/h 
7     ${PROJECT_SOURCE_DIR}/common/src
8   )
9 else()
10 include_directories (
11     ${PROJECT_SOURCE_DIR}/common/h # don't include common/src; anything from there can still collide with default includes.
12         # stupid Windows case-insensitive naming.
13   )
14 endif()
15
16
17 set (SRC_LIST
18     src/Ident.C
19     src/string-regex.C 
20     src/Timer.C 
21     src/Types.C 
22     src/debugOstream.C 
23     src/lprintf.C 
24     src/pathName.C 
25     src/Time.C 
26     src/fraction.C 
27     src/timing.C 
28     src/stats.C 
29     src/Annotatable.C 
30     src/MappedFile.C 
31     src/sha1.C 
32     src/serialize-bin.C 
33     src/serialize-xml.C 
34     src/util.C 
35     src/Node.C 
36     src/Graph.C 
37     src/Edge.C 
38     src/DOT.C 
39     src/dyn_regs.C 
40     src/AST.C 
41     src/addrtranslate.C 
42     src/arch-x86.C 
43     src/arch-power.C 
44         src/arch-aarch64.C
45     src/debug_common.C 
46     src/VariableLocation.C 
47     src/Buffer.C
48     src/MachSyscall.C
49   )
50
51 if (PLATFORM MATCHES freebsd)
52   set (SRC_LIST ${SRC_LIST} 
53     src/timing-freebsd.C
54     src/freebsdKludges.C
55     src/addrtranslate-sysv.C
56     src/addrtranslate-freebsd.C
57   )
58 endif()
59
60 if (PLATFORM MATCHES linux)
61   set (SRC_LIST ${SRC_LIST}
62     src/linuxKludges.C
63     src/timing-linux.C
64     src/parseauxv.C
65     src/addrtranslate-sysv.C
66     src/addrtranslate-auxv.C
67     src/addrtranslate-linux.C
68   )
69 endif()
70
71 if (PLATFORM MATCHES bgq)
72   set (SRC_LIST ${SRC_LIST}
73     src/bluegeneKludges.C
74     src/timing-linux.C
75     src/parseauxv.C
76     src/addrtranslate-sysv.C
77     src/addrtranslate-auxv.C
78     src/addrtranslate-bluegene.C
79   )
80 endif()
81
82 if (PLATFORM MATCHES cnl)
83   set (SRC_LIST ${SRC_LIST}
84     src/linuxKludges.C
85     src/timing-linux.C
86     src/parseauxv.C
87     src/addrtranslate-sysv.C
88     src/addrtranslate-auxv.C
89     src/addrtranslate-linux.C
90   )
91 endif()  
92
93 if (PLATFORM MATCHES nt OR PLATFORM MATCHES windows)
94   set (SRC_LIST ${SRC_LIST}
95     src/ntKludges.C
96     src/timing-nt.C
97 #    src/dthread-win.C
98 #       src/dthread.C
99     src/addrtranslate-win.C
100   )
101   if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 19)
102     add_definitions(-DWIN32 -D_WIN32_WINNT=0x500)
103   else()
104     add_definitions(-DWIN32 -D_WIN32_WINNT=0x500 -Dsnprintf=_snprintf)
105   endif()
106 endif()  
107
108
109 SET_SOURCE_FILES_PROPERTIES(${SRC_LIST} PROPERTIES LANGUAGE CXX)
110
111 ADD_DEFINITIONS(-DCOMMON_LIB)
112
113 set (DEPS "")
114 if (IBERTY_FOUND)
115 set(DEPS "${DEPS};${IBERTY_LIBRARIES}")
116 endif()
117
118 dyninst_library(common ${DEPS})
119 if (UNIX)
120   # Boost auto-links on Windows; don't double-link
121   target_link_private_libraries(common ${Boost_LIBRARIES})
122 endif()
123
124 if(PLATFORM MATCHES nt OR PLATFORM MATCHES windows)
125   target_link_libraries(common Psapi WS2_32 dbghelp)
126 endif()
127