comparison cmake/FindD.cmake @ 215:8aaa84d48451

Improve examples.
author SokoL_SD
date Tue, 14 Jul 2009 15:25:45 +0000
parents bc1525b955d8
children 7f150ad4cb5f
comparison
equal deleted inserted replaced
214:11f1760d1700 215:8aaa84d48451
169 set(FLAGS_tmp ) 169 set(FLAGS_tmp )
170 170
171 ## Parse parameters list. 171 ## Parse parameters list.
172 set(params_tmp SOURCES FLAGS) 172 set(params_tmp SOURCES FLAGS)
173 foreach(arg_tmp ${ARGN}) 173 foreach(arg_tmp ${ARGN})
174 set(founded_type_tmp) 174 set(found_type_tmp)
175 if(NOT founded_type_tmp) 175 if(NOT found_type_tmp)
176 foreach(param_tmp ${params_tmp}) 176 foreach(param_tmp ${params_tmp})
177 if(arg_tmp STREQUAL param_tmp) 177 if(arg_tmp STREQUAL param_tmp)
178 set(type_tmp ${param_tmp}) 178 set(type_tmp ${param_tmp})
179 set(founded_type_tmp 1) 179 set(found_type_tmp 1)
180 break(param_tmp ${params_tmp}) 180 break(param_tmp ${params_tmp})
181 endif(arg_tmp STREQUAL param_tmp) 181 endif(arg_tmp STREQUAL param_tmp)
182 endforeach(param_tmp ${params_tmp}) 182 endforeach(param_tmp ${params_tmp})
183 endif(NOT founded_type_tmp) 183 endif(NOT found_type_tmp)
184 if(NOT founded_type_tmp) 184 if(NOT found_type_tmp)
185 set(${type_tmp}_tmp ${${type_tmp}_tmp} ${arg_tmp}) 185 set(${type_tmp}_tmp ${${type_tmp}_tmp} ${arg_tmp})
186 endif(NOT founded_type_tmp) 186 endif(NOT found_type_tmp)
187 endforeach(arg_tmp ${ARGN}) 187 endforeach(arg_tmp ${ARGN})
188 188
189 if(NOT SINGLE_D_OBJECT) 189 if(NOT SINGLE_D_OBJECT)
190 set(${objects_list}) 190 set(${objects_list})
191 foreach (d_source_p_tmp ${SOURCES_tmp}) 191 foreach (d_source_p_tmp ${SOURCES_tmp})
288 set(LIB_PATHS_tmp) 288 set(LIB_PATHS_tmp)
289 set(DEPENDS_tmp) 289 set(DEPENDS_tmp)
290 set(OUTPUT_PATH_tmp ) 290 set(OUTPUT_PATH_tmp )
291 set(compile_flags_tmp ${D_FLAGS}) 291 set(compile_flags_tmp ${D_FLAGS})
292 set(additional_commands_tmp ) 292 set(additional_commands_tmp )
293 set(detect_deps_tmp 1)
293 set(link_flags_tmp ) 294 set(link_flags_tmp )
294 295
295 ## Parse parameters list. 296 ## Parse parameters list.
296 set(params_tmp TYPE INCLUDES FLAGS SOURCES NO_DEPS_SOURCES OBJECTS LIBS LIB_PATHS DEPENDS OUTPUT_PATH) 297 set(params_tmp TYPE INCLUDES FLAGS SOURCES NO_DEPS_SOURCES OBJECTS LIBS LIB_PATHS DEPENDS OUTPUT_PATH)
298
297 foreach(arg_tmp ${ARGN}) 299 foreach(arg_tmp ${ARGN})
298 set(founded_type_tmp) 300 set(found_type_tmp)
299 if(${arg_tmp} STREQUAL "DETECT_DEPENDS") 301 if(${arg_tmp} STREQUAL "NOT_DETECT_DEPENDS")
300 set(auto_detect_depentes_tmp 1) 302 set(detect_deps_tmp 0)
301 set(founded_type_tmp 1) 303 set(found_type_tmp 1)
302 endif(${arg_tmp} STREQUAL "DETECT_DEPENDS") 304 endif(${arg_tmp} STREQUAL "NOT_DETECT_DEPENDS")
303 if(NOT founded_type_tmp) 305 if(NOT found_type_tmp)
304 foreach(param_tmp ${params_tmp}) 306 foreach(param_tmp ${params_tmp})
305 if(arg_tmp STREQUAL param_tmp) 307 if(arg_tmp STREQUAL param_tmp)
306 set(type_tmp ${param_tmp}) 308 set(type_tmp ${param_tmp})
307 set(founded_type_tmp 1) 309 set(found_type_tmp 1)
308 break(param_tmp ${params_tmp}) 310 break(param_tmp ${params_tmp})
309 endif(arg_tmp STREQUAL param_tmp) 311 endif(arg_tmp STREQUAL param_tmp)
310 endforeach(param_tmp ${params_tmp}) 312 endforeach(param_tmp ${params_tmp})
311 endif(NOT founded_type_tmp) 313 endif(NOT found_type_tmp)
312 if(NOT founded_type_tmp) 314 if(NOT found_type_tmp)
313 set(${type_tmp}_tmp ${${type_tmp}_tmp} ${arg_tmp}) 315 set(${type_tmp}_tmp ${${type_tmp}_tmp} ${arg_tmp})
314 endif(NOT founded_type_tmp) 316 endif(NOT found_type_tmp)
315 endforeach(arg_tmp ${ARGN}) 317 endforeach(arg_tmp ${ARGN})
316 318
317 ## Init target type. 319 ## Init target type.
318 if (OUTPUT_PATH_tmp) 320 if (OUTPUT_PATH_tmp)
319 set(output_name_tmp "${OUTPUT_PATH_tmp}") 321 set(output_name_tmp "${OUTPUT_PATH_tmp}")
403 if(CMAKE_BUILD_TYPE) 405 if(CMAKE_BUILD_TYPE)
404 string(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_UPPER) 406 string(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_UPPER)
405 set(compile_flags_tmp ${compile_flags_tmp} ${D_${CMAKE_BUILD_TYPE_UPPER}_FLAGS}) 407 set(compile_flags_tmp ${compile_flags_tmp} ${D_${CMAKE_BUILD_TYPE_UPPER}_FLAGS})
406 endif(CMAKE_BUILD_TYPE) 408 endif(CMAKE_BUILD_TYPE)
407 409
408 if(auto_detect_depentes_tmp) 410 if(detect_deps_tmp)
411 message(STATUS "Getting dependencies for ${name}")
409 get_files_depends(tmp ${SOURCES_tmp}) 412 get_files_depends(tmp ${SOURCES_tmp})
410 set(SOURCES_tmp ${tmp}) 413 set(SOURCES_tmp ${tmp})
411 endif(auto_detect_depentes_tmp) 414 endif(detect_deps_tmp)
412 set(SOURCES_tmp ${SOURCES_tmp} ${NO_DEPS_SOURCES_tmp}) 415 set(SOURCES_tmp ${SOURCES_tmp} ${NO_DEPS_SOURCES_tmp})
413 416
414 set(used_ar_tmp) 417 set(used_ar_tmp)
415 get_filename_component(output_path_tmp ${output_name_tmp} PATH) 418 get_filename_component(output_path_tmp ${output_name_tmp} PATH)
416 if (NOT not_obj_tmp) 419 if (NOT not_obj_tmp)
498 ## 501 ##
499 macro(get_imported_files imported) 502 macro(get_imported_files imported)
500 execute_process(COMMAND ${DC} -c -o- -v ${compile_flags_tmp} ${ARGN} 503 execute_process(COMMAND ${DC} -c -o- -v ${compile_flags_tmp} ${ARGN}
501 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} 504 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
502 OUTPUT_VARIABLE dc_output_tmp 505 OUTPUT_VARIABLE dc_output_tmp
506
503 ) 507 )
504 string(REGEX MATCHALL "import[^\\(]*([^\\)]*)" dc_output_tmp "${dc_output_tmp}") 508 string(REGEX MATCHALL "import[^\\(]*([^\\)]*)" dc_output_tmp "${dc_output_tmp}")
505 set(${imported}) 509 set(${imported})
506 foreach(import_tmp ${dc_output_tmp}) 510 foreach(import_tmp ${dc_output_tmp})
507 string(REGEX REPLACE "import[^\\(]*\\(([^\\)]*)" "\\1" import_tmp ${import_tmp}) 511 string(REGEX REPLACE "import[^\\(]*\\(([^\\)]*)" "\\1" import_tmp ${import_tmp})