-
Notifications
You must be signed in to change notification settings - Fork 1
/
dmake.cmake
388 lines (302 loc) · 20.6 KB
/
dmake.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
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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
# dmake is written by Dan Furse ([email protected])
# the goal of dmake is to help you stay away from wanting to rip your arms off and bleed out when you use cmake
message( STATUS "*** dmake! take it easy :-D" )
# this macro declares a project and declares some installation and structural cache variables so you can tell cmake what you want
macro( dmake_project_begin LOCAL_PROJECT_NAME LOCAL_MAJOR_VERSION LOCAL_MINOR_VERSION LOCAL_REVISION_VERSION )
# deal with satan a little
project( ${LOCAL_PROJECT_NAME} )
set( CMAKE_INSTALL_PREFIX "" CACHE INTERNAL "" FORCE )
mark_as_advanced( CMAKE_BUILD_TYPE )
# some project internal variables
set( DM_PROJECT_NAME ${LOCAL_PROJECT_NAME} )
set( ${DM_PROJECT_NAME}_DEPENDENCIES "" )
set( ${DM_PROJECT_NAME}_HEADERS "" )
set( ${DM_PROJECT_NAME}_LIBRARIES "" )
set( ${DM_PROJECT_NAME}_EXECUTABLES "" )
set( ${DM_PROJECT_NAME}_VERSION_MAJOR ${LOCAL_MAJOR_VERSION} )
set( ${DM_PROJECT_NAME}_VERSION_MINOR ${LOCAL_MINOR_VERSION} )
set( ${DM_PROJECT_NAME}_VERSION_REVISION ${LOCAL_REVISION_VERSION} )
set( ${DM_PROJECT_NAME}_VERSION_FULL "${${DM_PROJECT_NAME}_VERSION_MAJOR}.${${DM_PROJECT_NAME}_VERSION_MINOR}.${${DM_PROJECT_NAME}_VERSION_REVISION}" )
set( ${DM_PROJECT_NAME}_IDENTIFIER "${DM_PROJECT_NAME}.${${DM_PROJECT_NAME}_VERSION_FULL}" )
# some advanced project structual cache variables
set( ${DM_PROJECT_NAME}_HEADER_SUBDIRECTORY "Include" CACHE STRING "name of subdirectory in library subdirectories in which header files are kept" )
set( ${DM_PROJECT_NAME}_SOURCE_SUBDIRECTORY "Source" CACHE STRING "name of subdirectory in library subdirectories in which source are kept" )
set( ${DM_PROJECT_NAME}_VERBOSE ON CACHE BOOL "report back to the user that everything is going ok" )
mark_as_advanced( FORCE ${DM_PROJECT_NAME}_HEADER_SUBDIRECTORY ${DM_PROJECT_NAME}_SOURCE_SUBDIRECTORY ${DM_PROJECT_NAME}_VERBOSE )
# some project installation cache variables
set( ${DM_PROJECT_NAME}_ROOT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} )
set( ${DM_PROJECT_NAME}_INSTALL_PREFIX "${${DM_PROJECT_NAME}_ROOT_DIRECTORY}/Install" CACHE PATH "installation prefix (changing this will recompute other install locations)" )
if( "${${DM_PROJECT_NAME}_INSTALL_PREFIX_INTERNAL}" STREQUAL "${${DM_PROJECT_NAME}_INSTALL_PREFIX}" )
set( ${DM_PROJECT_NAME}_INSTALL_HEADERS_DIR "${${DM_PROJECT_NAME}_INSTALL_PREFIX}/include" CACHE PATH "installation directory for headers" )
set( ${DM_PROJECT_NAME}_INSTALL_LIBRARIES_DIR "${${DM_PROJECT_NAME}_INSTALL_PREFIX}/lib" CACHE PATH "installation directory for libraries" )
set( ${DM_PROJECT_NAME}_INSTALL_EXECUTABLES_DIR "${${DM_PROJECT_NAME}_INSTALL_PREFIX}/bin" CACHE PATH "installation directory for libraries" )
else( "${${DM_PROJECT_NAME}_INSTALL_PREFIX_INTERNAL}" STREQUAL "${${DM_PROJECT_NAME}_INSTALL_PREFIX}" )
set( ${DM_PROJECT_NAME}_INSTALL_PREFIX_INTERNAL "${${DM_PROJECT_NAME}_INSTALL_PREFIX}" CACHE INTERNAL "" )
set( ${DM_PROJECT_NAME}_INSTALL_HEADERS_DIR "${${DM_PROJECT_NAME}_INSTALL_PREFIX}/include" CACHE PATH "installation directory for headers" FORCE )
set( ${DM_PROJECT_NAME}_INSTALL_LIBRARIES_DIR "${${DM_PROJECT_NAME}_INSTALL_PREFIX}/lib" CACHE PATH "installation directory for libraries" FORCE )
set( ${DM_PROJECT_NAME}_INSTALL_EXECUTABLES_DIR "${${DM_PROJECT_NAME}_INSTALL_PREFIX}/bin" CACHE PATH "installation directory for libraries" FORCE )
endif( "${${DM_PROJECT_NAME}_INSTALL_PREFIX_INTERNAL}" STREQUAL "${${DM_PROJECT_NAME}_INSTALL_PREFIX}" )
if( NOT DEFINED ${DM_PROJECT_NAME}_INSTALL_PREFIX_INTERNAL )
set( ${DM_PROJECT_NAME}_INSTALL_PREFIX_INTERNAL "${${DM_PROJECT_NAME}_INSTALL_PREFIX}" CACHE INTERNAL "" )
endif( NOT DEFINED ${DM_PROJECT_NAME}_INSTALL_PREFIX_INTERNAL )
endmacro()
macro( dmake_dependency_declare LOCAL_PROJECT_NAME LOCAL_MAJOR_VERSION LOCAL_MINOR_VERSION LOCAL_REVISION_VERSION )
# import the dependency information
include( $ENV{HOME}/.dmake/${LOCAL_PROJECT_NAME}.${LOCAL_MAJOR_VERSION}.${LOCAL_MINOR_VERSION}.${LOCAL_REVISION_VERSION}.cmake )
# append the name of the dependency to the project dependency list
list( APPEND ${DM_PROJECT_NAME}_DEPENDENCIES ${LOCAL_PROJECT_NAME} )
# talk about our feelings
if( "${${DM_PROJECT_NAME}_VERBOSE}" STREQUAL "ON" )
message( STATUS "*** declared dependency called <${LOCAL_PROJECT_NAME}>" )
endif( "${${DM_PROJECT_NAME}_VERBOSE}" STREQUAL "ON" )
endmacro()
macro( dmake_dependency_foreign_declare LOCAL_PROJECT_NAME LOCAL_PROJECT_INSTALL_HEADERS_DIR LOCAL_PROJECT_INSTALL_LIBRARIES_DIR )
# append the name of the dependency to the project dependency list
list( APPEND ${DM_PROJECT_NAME}_DEPENDENCIES ${LOCAL_PROJECT_NAME} )
set( ${LOCAL_PROJECT_NAME}_INSTALL_HEADERS_DIR "/usr/local/include" CACHE PATH "path to headers for <${LOCAL_PROJECT_NAME}>" )
set( ${LOCAL_PROJECT_NAME}_INSTALL_LIBRARIES_DIR "/usr/local/lib" CACHE PATH "path to libraries for <${LOCAL_PROJECT_NAME}>" )
set( ${LOCAL_PROJECT_NAME}_LIBRARIES "" CACHE PATH "libraries for <${LOCAL_PROJECT_NAME}>" )
# talk about our feelings
if( "${${DM_PROJECT_NAME}_VERBOSE}" STREQUAL "ON" )
message( STATUS "*** declared foreign dependency called <${LOCAL_PROJECT_NAME}>" )
endif( "${${DM_PROJECT_NAME}_VERBOSE}" STREQUAL "ON" )
endmacro()
# declare the existence of a library and the root subdirectory where its source code is kept
macro( dmake_library_declare LOCAL_LIBRARY_NAME LOCAL_LIBRARY_ROOT_DIRECTORY )
# append the name of the library to the project library list
list( APPEND ${DM_PROJECT_NAME}_LIBRARIES ${LOCAL_LIBRARY_NAME} )
# record root path of the library
set( ${LOCAL_LIBRARY_NAME}_ROOT_DIRECTORY ${${DM_PROJECT_NAME}_ROOT_DIRECTORY}/${LOCAL_LIBRARY_ROOT_DIRECTORY} )
# record header path of the library
if( "${${DM_PROJECT_NAME}_HEADER_SUBDIRECTORY}" STREQUAL "" )
set( ${LOCAL_LIBRARY_NAME}_HEADER_DIRECTORY ${${LOCAL_LIBRARY_NAME}_ROOT_DIRECTORY} )
else( "${${DM_PROJECT_NAME}_HEADER_SUBDIRECTORY}" STREQUAL "" )
set( ${LOCAL_LIBRARY_NAME}_HEADER_DIRECTORY ${${LOCAL_LIBRARY_NAME}_ROOT_DIRECTORY}/${${DM_PROJECT_NAME}_HEADER_SUBDIRECTORY} )
endif( "${${DM_PROJECT_NAME}_HEADER_SUBDIRECTORY}" STREQUAL "" )
# record source path of the library
if( "${${DM_PROJECT_NAME}_SOURCE_SUBDIRECTORY}" STREQUAL "" )
set( ${LOCAL_LIBRARY_NAME}_SOURCE_DIRECTORY ${${LOCAL_LIBRARY_NAME}_ROOT_DIRECTORY} )
else( "${${DM_PROJECT_NAME}_SOURCE_SUBDIRECTORY}" STREQUAL "" )
set( ${LOCAL_LIBRARY_NAME}_SOURCE_DIRECTORY ${${LOCAL_LIBRARY_NAME}_ROOT_DIRECTORY}/${${DM_PROJECT_NAME}_SOURCE_SUBDIRECTORY} )
endif( "${${DM_PROJECT_NAME}_SOURCE_SUBDIRECTORY}" STREQUAL "" )
# add some editable cache variables controlling build behavior
set( ${LOCAL_LIBRARY_NAME}_SHARED ON CACHE BOOL "enable or disable shared nature of library <${LOCAL_LIBRARY_NAME}>" )
set( ${LOCAL_LIBRARY_NAME}_ENABLED ON CACHE BOOL "enable or disable building of library <${LOCAL_LIBRARY_NAME}>" )
mark_as_advanced( ${LOCAL_LIBRARY_NAME}_SHARED ${LOCAL_LIBRARY_NAME}_ENABLED )
# clear out headers and source lists for the library
set( ${LOCAL_LIBRARY_NAME}_HEADERS "" )
set( ${LOCAL_LIBRARY_NAME}_SOURCES "" )
set( ${LOCAL_LIBRARY_NAME}_LIBRARIES "" )
# talk about our feelings
if( "${${DM_PROJECT_NAME}_VERBOSE}" STREQUAL "ON" )
message( STATUS "*** declared a library called <${LOCAL_LIBRARY_NAME}> in subdirectory <${${LOCAL_LIBRARY_NAME}_ROOT_DIRECTORY}>" )
endif( "${${DM_PROJECT_NAME}_VERBOSE}" STREQUAL "ON" )
endmacro()
# add header content to a library (MUST be previously declared!)
macro( dmake_library_headers LOCAL_LIBRARY_NAME )
# make sure the library was defined
if( NOT DEFINED ${LOCAL_LIBRARY_NAME}_ROOT_DIRECTORY )
message( STATUS "*** library called <${LOCAL_LIBRARY_NAME} has not been defined!" )
endif( NOT DEFINED ${LOCAL_LIBRARY_NAME}_ROOT_DIRECTORY )
# add all headers given to the list of headers for this library
foreach( HEADER_FILE ${ARGN} )
list( APPEND ${LOCAL_LIBRARY_NAME}_HEADERS ${${LOCAL_LIBRARY_NAME}_HEADER_DIRECTORY}/${HEADER_FILE} )
endforeach()
# talk about our feelings
if( "${${DM_PROJECT_NAME}_VERBOSE}" STREQUAL "ON" )
message( STATUS "*** library called <${LOCAL_LIBRARY_NAME}> has headers <${${LOCAL_LIBRARY_NAME}_HEADERS}>" )
endif( "${${DM_PROJECT_NAME}_VERBOSE}" STREQUAL "ON" )
endmacro()
# add header content to a library (MUST be previously declared!)
macro( dmake_library_headers_external LOCAL_LIBRARY_NAME )
# make sure the library was defined
if( NOT DEFINED ${LOCAL_LIBRARY_NAME}_ROOT_DIRECTORY )
message( STATUS "*** library called <${LOCAL_LIBRARY_NAME} has not been defined!" )
endif( NOT DEFINED ${LOCAL_LIBRARY_NAME}_ROOT_DIRECTORY )
# add all headers given to the list of headers for this library
foreach( HEADER_FILE ${ARGN} )
list( APPEND ${LOCAL_LIBRARY_NAME}_HEADERS ${HEADER_FILE} )
endforeach()
# talk about our feelings
if( "${${DM_PROJECT_NAME}_VERBOSE}" STREQUAL "ON" )
message( STATUS "*** library called <${LOCAL_LIBRARY_NAME}> has headers <${${LOCAL_LIBRARY_NAME}_HEADERS}>" )
endif( "${${DM_PROJECT_NAME}_VERBOSE}" STREQUAL "ON" )
endmacro()
# add source content to a library (MUST be previously declared!)
macro( dmake_library_sources LOCAL_LIBRARY_NAME )
# make sure the library was defined
if( NOT DEFINED ${LOCAL_LIBRARY_NAME}_ROOT_DIRECTORY )
message( STATUS "*** library called <${LOCAL_LIBRARY_NAME} has not been defined!" )
endif( NOT DEFINED ${LOCAL_LIBRARY_NAME}_ROOT_DIRECTORY )
# add all given sources to the list of sources for this library
foreach( SOURCE_FILE ${ARGN} )
list( APPEND ${LOCAL_LIBRARY_NAME}_SOURCES ${${LOCAL_LIBRARY_NAME}_SOURCE_DIRECTORY}/${SOURCE_FILE} )
endforeach()
# talk about our feelings
if( "${${DM_PROJECT_NAME}_VERBOSE}" STREQUAL "ON" )
message( STATUS "*** library called <${LOCAL_LIBRARY_NAME}> has sources <${${LOCAL_LIBRARY_NAME}_SOURCES}>" )
endif( "${${DM_PROJECT_NAME}_VERBOSE}" STREQUAL "ON" )
endmacro()
# add source content to a library (MUST be previously declared!)
macro( dmake_library_sources_external LOCAL_LIBRARY_NAME )
# make sure the library was defined
if( NOT DEFINED ${LOCAL_LIBRARY_NAME}_ROOT_DIRECTORY )
message( STATUS "*** library called <${LOCAL_LIBRARY_NAME} has not been defined!" )
endif( NOT DEFINED ${LOCAL_LIBRARY_NAME}_ROOT_DIRECTORY )
# add all given sources to the list of sources for this library
foreach( SOURCE_FILE ${ARGN} )
list( APPEND ${LOCAL_LIBRARY_NAME}_SOURCES ${SOURCE_FILE} )
endforeach()
# talk about our feelings
if( "${${DM_PROJECT_NAME}_VERBOSE}" STREQUAL "ON" )
message( STATUS "*** library called <${LOCAL_LIBRARY_NAME}> has sources <${${LOCAL_LIBRARY_NAME}_SOURCES}>" )
endif( "${${DM_PROJECT_NAME}_VERBOSE}" STREQUAL "ON" )
endmacro()
# add ballsucking library content to a library (MUSS BE DECLARE PREVISS)
macro( dmake_library_libraries LOCAL_LIBRARY_NAME )
# make sure libarry wub define
if( NOT DEFINED ${LOCAL_LIBRARY_NAME}_ROOT_DIRECTORY )
message( STATUS "*** library called <${LOCAL_LIBRARY_NAME} has not been defined!" )
endif( NOT DEFINED ${LOCAL_LIBRARY_NAME}_ROOT_DIRECTORY )
# add all given libarry to libarry
foreach( LIBRARY ${ARGN} )
list( APPEND ${LOCAL_LIBRARY_NAME}_LIBRARIES ${LIBRARY} )
endforeach()
# prease feeling discuss
if( "${${DM_PROJECT_NAME}_VERBOSE}" STREQUAL "ON" )
message( STATUS "*** library called <${LOCAL_LIBRARY_NAME}> has libraries <${${LOCAL_LIBRARY_NAME}_LIBRARIES}>" )
endif( "${${DM_PROJECT_NAME}_VERBOSE}" STREQUAL "ON" )
endmacro()
# declare the existence of an executable and the root subdirectory where its sources are kept
macro( dmake_executable_declare LOCAL_EXECUTABLE_NAME LOCAL_EXECUTABLE_ROOT_DIRECTORY )
# append the name of the executable to the project executable list
list( APPEND ${DM_PROJECT_NAME}_EXECUTABLES ${LOCAL_EXECUTABLE_NAME} )
# record root path of the executable
set( ${LOCAL_EXECUTABLE_NAME}_ROOT_DIRECTORY ${${DM_PROJECT_NAME}_ROOT_DIRECTORY}/${LOCAL_EXECUTABLE_ROOT_DIRECTORY} )
# record source path of the executable
if( "${${DM_PROJECT_NAME}_SOURCE_SUBDIRECTORY}" STREQUAL "" )
set( ${LOCAL_EXECUTABLE_NAME}_SOURCE_DIRECTORY ${${LOCAL_EXECUTABLE_NAME}_ROOT_DIRECTORY} )
else( "${${DM_PROJECT_NAME}_SOURCE_SUBDIRECTORY}" STREQUAL "" )
set( ${LOCAL_EXECUTABLE_NAME}_SOURCE_DIRECTORY ${${LOCAL_EXECUTABLE_NAME}_ROOT_DIRECTORY}/${${DM_PROJECT_NAME}_SOURCE_SUBDIRECTORY} )
endif( "${${DM_PROJECT_NAME}_SOURCE_SUBDIRECTORY}" STREQUAL "" )
# add some editable cache variables controlling build behavior
set( ${LOCAL_EXECUTABLE_NAME}_ENABLED ON CACHE BOOL "enable or disable building of library <${LOCAL_LIBRARY_NAME}>" )
mark_as_advanced( ${LOCAL_EXECUTABLE_NAME}_ENABLED )
# clear out sources and dey libarry for the executable
set( ${LOCAL_EXECUTABLE_NAME}_SOURCES "" )
set( ${LOCAL_EXECUTABLE_NAME}_LIBRARIES "" )
# talk about our feelings
if( "${${DM_PROJECT_NAME}_VERBOSE}" STREQUAL "ON" )
message( STATUS "*** declared an executable called <${LOCAL_EXECUTABLE_NAME}> at <${${LOCAL_EXECUTABLE_NAME}_ROOT_DIRECTORY}>" )
endif( "${${DM_PROJECT_NAME}_VERBOSE}" STREQUAL "ON" )
endmacro()
# add source content to an executable (MUST be previously declared!)
macro( dmake_executable_sources LOCAL_EXECUTABLE_NAME )
# make sure the executable was defined
if( NOT DEFINED ${LOCAL_EXECUTABLE_NAME}_ROOT_DIRECTORY )
message( STATUS "*** executable called <${LOCAL_EXECUTABLE_NAME} has not been defined!" )
endif( NOT DEFINED ${LOCAL_EXECUTABLE_NAME}_ROOT_DIRECTORY )
# add all source given to the list of sources for this executable
foreach( SOURCE_FILE ${ARGN} )
list( APPEND ${LOCAL_EXECUTABLE_NAME}_SOURCES ${${LOCAL_EXECUTABLE_NAME}_SOURCE_DIRECTORY}/${SOURCE_FILE} )
endforeach()
# talk about our feelings
if( "${${DM_PROJECT_NAME}_VERBOSE}" STREQUAL "ON" )
message( STATUS "*** executable called <${LOCAL_EXECUTABLE_NAME}> has sources <${${LOCAL_EXECUTABLE_NAME}_SOURCES}>" )
endif( "${${DM_PROJECT_NAME}_VERBOSE}" STREQUAL "ON" )
endmacro()
# add source content to an executable (MUST be previously declared!)
macro( dmake_executable_sources_external LOCAL_EXECUTABLE_NAME )
# make sure the executable was defined
if( NOT DEFINED ${LOCAL_EXECUTABLE_NAME}_ROOT_DIRECTORY )
message( STATUS "*** executable called <${LOCAL_EXECUTABLE_NAME}> has not been defined!" )
endif( NOT DEFINED ${LOCAL_EXECUTABLE_NAME}_ROOT_DIRECTORY )
# add all source given to the list of sources for this executable
foreach( SOURCE_FILE ${ARGN} )
list( APPEND ${LOCAL_EXECUTABLE_NAME}_SOURCES ${SOURCE_FILE} )
endforeach()
# talk about our feelings
if( "${${DM_PROJECT_NAME}_VERBOSE}" STREQUAL "ON" )
message( STATUS "*** executable called <${LOCAL_EXECUTABLE_NAME}> has sources <${${LOCAL_EXECUTABLE_NAME}_SOURCES}>" )
endif( "${${DM_PROJECT_NAME}_VERBOSE}" STREQUAL "ON" )
endmacro()
# add ballsucking library content to a execrrt (MUSS BE DECLARE PREVISS)
macro( dmake_executable_libraries LOCAL_EXECUTABLE_NAME )
# make sure execrrt wub define
if( NOT DEFINED ${LOCAL_EXECUTABLE_NAME}_ROOT_DIRECTORY )
message( STATUS "*** executable called <${LOCAL_EXECUTABLE_NAME}> has not been defined!" )
endif( NOT DEFINED ${LOCAL_EXECUTABLE_NAME}_ROOT_DIRECTORY )
# add all given libarry to execrrt
foreach( LIBRARY ${ARGN} )
list( APPEND ${LOCAL_EXECUTABLE_NAME}_LIBRARIES ${LIBRARY} )
endforeach()
# prease feeling discuss
if( "${${DM_PROJECT_NAME}_VERBOSE}" STREQUAL "ON" )
message( STATUS "*** executable called <${LOCAL_EXECUTABLE_NAME}> has libraries <${${LOCAL_EXECUTABLE_NAME}_LIBRARIES}>" )
endif( "${${DM_PROJECT_NAME}_VERBOSE}" STREQUAL "ON" )
endmacro()
# trigger everything and finish
macro( dmake_project_end )
# add all external includes to the compiler include path
set( EXTERNAL_INCLUDES "" )
foreach( DEPENDENCY_NAME ${${DM_PROJECT_NAME}_DEPENDENCIES} )
list( APPEND EXTERNAL_INCLUDES "${${DEPENDENCY_NAME}_INSTALL_HEADERS_DIR}" )
endforeach()
message( STATUS "*** external includes are <${EXTERNAL_INCLUDES}>" )
# add all external libraries to the linker link path
foreach( DEPENDENCY_NAME ${${DM_PROJECT_NAME}_DEPENDENCIES} )
foreach( LIBRARY_NAME ${${DEPENDENCY_NAME}_LIBRARIES} )
list( APPEND EXTERNAL_LIBRARIES "${${DEPENDENCY_NAME}_INSTALL_LIBRARIES_DIR}/lib${LIBRARY_NAME}.so" )
endforeach()
endforeach()
message( STATUS "*** external libraries are <${EXTERNAL_LIBRARIES}>" )
# tell satan where the includes are
foreach( LIBRARY_NAME ${${DM_PROJECT_NAME}_LIBRARIES} )
include_directories( "${${LIBRARY_NAME}_HEADER_DIRECTORY}" )
foreach( HEADER_NAME ${${LIBRARY_NAME}_HEADERS} )
list( APPEND ${DM_PROJECT_NAME}_HEADERS ${HEADER_NAME} )
endforeach()
endforeach()
include_directories( ${EXTERNAL_INCLUDES} ${INTERNAL_INCLUDES} )
# tell satan to add all libraries to the build
foreach( LIBRARY_NAME ${${DM_PROJECT_NAME}_LIBRARIES} )
if( "${${LIBRARY_NAME}_ENABLED}" STREQUAL "ON" )
if( "${${LIBRARY_NAME}_SHARED}" STREQUAL "ON" )
add_library( ${LIBRARY_NAME} SHARED ${${LIBRARY_NAME}_SOURCES} )
else( "${${LIBRARY_NAME}_SHARED}" STREQUAL "ON" )
add_library( ${LIBRARY_NAME} STATIC ${${LIBRARY_NAME}_SOURCES} )
endif( "${${LIBRARY_NAME}_SHARED}" STREQUAL "ON" )
target_link_libraries( ${LIBRARY_NAME} ${${LIBRARY_NAME}_LIBRARIES} ${EXTERNAL_LIBRARIES} )
set_target_properties(${LIBRARY_NAME} PROPERTIES LINKER_LANGUAGE CXX)
endif( "${${LIBRARY_NAME}_ENABLED}" STREQUAL "ON" )
endforeach()
# tell satan to add all executables to the build
foreach( EXECUTABLE_NAME ${${DM_PROJECT_NAME}_EXECUTABLES} )
if( "${${EXECUTABLE_NAME}_ENABLED}" STREQUAL "ON" )
add_executable( ${EXECUTABLE_NAME} ${${EXECUTABLE_NAME}_SOURCES} )
target_link_libraries( ${EXECUTABLE_NAME} ${${EXECUTABLE_NAME}_LIBRARIES} ${EXTERNAL_LIBRARIES} )
set_target_properties(${EXECUTABLE_NAME} PROPERTIES LINKER_LANGUAGE CXX)
endif( "${${EXECUTABLE_NAME}_ENABLED}" STREQUAL "ON" )
endforeach()
# prepare the cache directory
set( PACKAGE_CACHE_DIRECTORY $ENV{HOME}/.dmake )
make_directory( ${PACKAGE_CACHE_DIRECTORY} )
# prepare the cache file
set( PACKAGE_CACHE_FILE $ENV{HOME}/.dmake/${${DM_PROJECT_NAME}_IDENTIFIER}.cmake )
file( WRITE ${PACKAGE_CACHE_FILE} "\# this file was automatically generated by dmake to describe an installation of <${DM_PROJECT_NAME}>\n" )
file( APPEND ${PACKAGE_CACHE_FILE} "set( ${DM_PROJECT_NAME}_VERSION_MAJOR ${${DM_PROJECT_NAME}_VERSION_MAJOR} )\n" )
file( APPEND ${PACKAGE_CACHE_FILE} "set( ${DM_PROJECT_NAME}_VERSION_MINOR ${${DM_PROJECT_NAME}_VERSION_MINOR} )\n" )
file( APPEND ${PACKAGE_CACHE_FILE} "set( ${DM_PROJECT_NAME}_VERSION_REVISION ${${DM_PROJECT_NAME}_VERSION_REVISION} )\n" )
file( APPEND ${PACKAGE_CACHE_FILE} "set( ${DM_PROJECT_NAME}_VERSION_FULL ${${DM_PROJECT_NAME}_VERSION_FULL} )\n" )
file( APPEND ${PACKAGE_CACHE_FILE} "set( ${DM_PROJECT_NAME}_IDENTIFIER ${${DM_PROJECT_NAME}_IDENTIFIER} )\n" )
file( APPEND ${PACKAGE_CACHE_FILE} "set( ${DM_PROJECT_NAME}_INSTALL_HEADERS_DIR ${${DM_PROJECT_NAME}_INSTALL_HEADERS_DIR} )\n" )
file( APPEND ${PACKAGE_CACHE_FILE} "set( ${DM_PROJECT_NAME}_INSTALL_LIBRARIES_DIR ${${DM_PROJECT_NAME}_INSTALL_LIBRARIES_DIR} )\n" )
file( APPEND ${PACKAGE_CACHE_FILE} "set( ${DM_PROJECT_NAME}_INSTALL_EXECUTABLES_DIR ${${DM_PROJECT_NAME}_INSTALL_EXECUTABLES_DIR} )\n" )
file( APPEND ${PACKAGE_CACHE_FILE} "set( ${DM_PROJECT_NAME}_LIBRARIES ${${DM_PROJECT_NAME}_LIBRARIES} ) \n" )
file( APPEND ${PACKAGE_CACHE_FILE} "set( ${DM_PROJECT_NAME}_EXECUTABLES ${${DM_PROJECT_NAME}_EXECUTABLES} )\n" )
#install everything
install( FILES ${${DM_PROJECT_NAME}_HEADERS} DESTINATION ${${DM_PROJECT_NAME}_INSTALL_HEADERS_DIR} )
install( TARGETS ${${DM_PROJECT_NAME}_LIBRARIES} DESTINATION ${${DM_PROJECT_NAME}_INSTALL_LIBRARIES_DIR} )
install( TARGETS ${${DM_PROJECT_NAME}_EXECUTABLES} DESTINATION ${${DM_PROJECT_NAME}_INSTALL_EXECUTABLES_DIR} )
endmacro()
# bye