File: CMakeLists.txt

package info (click to toggle)
dwarfutils 20180809-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 8,228 kB
  • sloc: ansic: 63,382; sh: 5,222; cpp: 4,041; makefile: 548; python: 445; awk: 11
file content (171 lines) | stat: -rw-r--r-- 5,933 bytes parent folder | download
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
include(configure.cmake)

add_library(esb_and_tsearchbal OBJECT esb.c dwarf_tsearchbal.c)

set_folder(esb_and_tsearchbal dwarfdump)

target_include_directories(esb_and_tsearchbal PRIVATE
    $<TARGET_PROPERTY:${dwarf-target},INTERFACE_INCLUDE_DIRECTORIES>)

msvc_posix(esb_and_tsearchbal)

set_source_group(SOURCES "Source Files" addrmap.c checkutil.c dwarfdump.c dwconf.c helpertree.c 
	glflags.c command_options.c compiler_info.c
	macrocheck.c print_abbrevs.c print_aranges.c print_debugfission.c print_die.c 
	print_dnames.c print_frames.c  print_gdbindex.c
	print_lines.c print_locs.c print_macro.c print_macros.c print_pubnames.c print_ranges.c print_reloc.c 
	print_str_offsets.c
	print_sections.c  print_section_groups.c print_static_funcs.c  print_static_vars.c print_strings.c print_types.c print_weaknames.c  
	sanitized.c section_bitmaps.c strstrnocase.c uri.c dwgetopt.c makename.c naming.c common.c $<TARGET_OBJECTS:esb_and_tsearchbal>)
	
set_source_group(HEADERS "Header Files" checkutil.h common.h dwconf.h
  command_options.h compiler_info.h
	dwgetopt.h esb.h glflags.h globals.h macrocheck.h defined_types.h
	makename.h dwarf_tsearch.h print_frames.h section_bitmaps.h uri.h)

set_source_group(CONFIGURATION_FILES "Configuration Files" configure.cmake config.h.in.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
	
set_source_group(TAG_GENERATED "Generated Files" tmp-tt-table.c tmp-ta-table.c tmp-ta-ext-table.c tmp-tt-ext-table.c)

add_executable(dwarfdump ${SOURCES} ${HEADERS} ${TAG_GENERATED} ${CONFIGURATION_FILES})

set_folder(dwarfdump dwarfdump)

target_compile_options(dwarfdump PRIVATE ${dwfwall})

target_compile_definitions(dwarfdump PRIVATE "CONFPREFIX=${CMAKE_INSTALL_PREFIX}/lib")

target_link_libraries(dwarfdump PRIVATE ${dwarf-target} ${dwfzlib}) 

# We need this as naming.o has external references we cannot have
# in the tree builds.
configure_file(naming.c trivial_naming.c COPYONLY)

set_source_files_properties(trivial_naming.c PROPERTIES COMPILE_DEFINITIONS TRIVIAL_NAMING)

set(TAG_TREE_SOURCES tag_tree.c tag_common.c common.c makename.c trivial_naming.c dwgetopt.c dwarf_tsearchbal.c sanitized.c esb.c)

add_executable(tag_tree_build ${TAG_TREE_SOURCES})

set_folder(tag_tree_build dwarfdump/generators)

target_link_libraries(tag_tree_build PRIVATE ${dwarf-target})

set(TAG_ATTR_SOURCES tag_attr.c tag_common.c common.c makename.c trivial_naming.c dwgetopt.c dwarf_tsearchbal.c sanitized.c esb.c)
 
add_executable(tag_attr_build ${TAG_ATTR_SOURCES}) 

set_folder(tag_attr_build dwarfdump/generators)

target_link_libraries(tag_attr_build PRIVATE ${dwarf-target})

# Plain GNU C dash E does not work on a .list, 
# so copy to a .c name to run
# the following four table creations.
set(TAG_LIST_FILES tag_tree.list tag_attr.list tag_attr_ext.list tag_tree_ext.list)
set(TAG_SWITCH -s -s -e -e)
set(TAG_TOOL tag_tree_build tag_attr_build tag_attr_build tag_tree_build)
foreach(i RANGE 0 3)
    list(GET TAG_GENERATED ${i} generatedFile)
    list(GET TAG_LIST_FILES ${i} listFile)
    list(GET TAG_SWITCH ${i} tagSwitch)
    list(GET TAG_TOOL ${i} tagTool)
    
    math(EXPR j "${i} + 1")
    
    set(tmpSouce tmp-t${j})
	set(tmpDest tmp-tag-build${j}.tmp)
    
    configure_file(${listFile} ${tmpSouce}.c COPYONLY)
    
    add_custom_command(OUTPUT ${generatedFile}
		COMMAND ${CMAKE_C_COMPILER} -E -I${CMAKE_CURRENT_SOURCE_DIR}/../libdwarf -DCONFPREFIX=${CMAKE_INSTALL_PREFIX}/lib ${tmpSouce}.c > ${tmpDest}
        COMMAND ${tagTool} ${tagSwitch} -i ${tmpDest} -o ${generatedFile}
        DEPENDS ${tagTool} ${listFile})
endforeach()
	
set_source_group(TESTESB_SOURCES "Source Files" esb.c testesb.c)

add_executable(testesb ${TESTESB_SOURCES})

set_folder(testesb dwarfdump/tests)

target_include_directories(testesb PRIVATE
    $<TARGET_PROPERTY:${dwarf-target},INTERFACE_INCLUDE_DIRECTORIES>)

add_test(NAME test COMMAND testesb)

set_source_group(GETOPTEST_SOURCES "Source Files" getopttest.c dwgetopt.c)

add_executable(getopttest ${GETOPTEST_SOURCES})

set_folder(getopttest dwarfdump/tests)

add_test(NAME getopttest COMMAND getopttest)

add_executable(getopttestnat ${GETOPTEST_SOURCES})

set_folder(getopttestnat dwarfdump/tests)

if(UNIX)
	target_compile_definitions(getopttestnat PRIVATE GETOPT_FROM_SYSTEM)
endif()

foreach(i 1 2 3 5 6 7 8)
	add_test(NAME getopttestnat${i} COMMAND getopttestnat -c ${i})
endforeach()
	
set_source_group(SELFHELPERTREE_SOURCES "Source Files" helpertree.c)

add_executable(selfhelpertree ${SELFHELPERTREE_SOURCES} $<TARGET_OBJECTS:esb_and_tsearchbal>)

set_folder(selfhelpertree dwarfdump/tests)

target_compile_definitions(selfhelpertree PRIVATE SELFTEST)

target_include_directories(selfhelpertree PRIVATE
    $<TARGET_PROPERTY:${dwarf-target},INTERFACE_INCLUDE_DIRECTORIES>)

add_test(NAME selfhelpertree COMMAND selfhelpertree)

#doesn't compile	
#set_source_group(SELFMC_SOURCES "Source Files" macrocheck.c $<TARGET_OBJECTS:esb_and_tsearchbal>)
#
#add_executable(selfmc ${SELFMC_SOURCES})
#
# set_folder(selfmc dwarfdump/tests)
#
#target_compile_definitions(selfmc PRIVATE SELFTEST)
#
#target_include_directories(selfmc PRIVATE
#    $<TARGET_PROPERTY:${dwarf-target},INTERFACE_INCLUDE_DIRECTORIES>)
#
#add_test(NAME selfmc COMMAND selfmc)
	
set_source_group(SELFESB_SOURCES "Source Files" esb.c)

add_executable(selfesb ${SELFESB_SOURCES})

set_folder(selfesb dwarfdump/tests)

target_compile_definitions(selfesb PRIVATE SELFTEST)

target_include_directories(selfesb PRIVATE
    $<TARGET_PROPERTY:${dwarf-target},INTERFACE_INCLUDE_DIRECTORIES>)

add_test(NAME selfesb COMMAND selfesb)

if(${CMAKE_SIZEOF_VOID_P} EQUAL 8)
	set(SUFFIX 64)
endif()
set(LIBDIR lib${SUFFIX})
set(BINDIR bin${SUFFIX})

install(TARGETS dwarfdump DESTINATION
	RUNTIME DESTINATION ${BINDIR}		
	LIBRARY DESTINATION ${LIBDIR}
	ARCHIVE DESTINATION ${LIBDIR})

install(FILES dwarfdump.conf DESTINATION ${LIBDIR})

install(FILES dwarfdump.1 DESTINATION share/man/man1)