Mercurial > projects > qtd
comparison cmake/FindD.cmake @ 237:62d0dce52dac
CMake: improvements && fixes
author | SokoL_SD |
---|---|
date | Mon, 20 Jul 2009 06:00:55 +0000 |
parents | b796329e8c38 |
children | 2d061b52e077 |
comparison
equal
deleted
inserted
replaced
236:fcc0ada121e1 | 237:62d0dce52dac |
---|---|
486 macro(add_d_shared_lib name) | 486 macro(add_d_shared_lib name) |
487 add_d_target(${name} TYPE SHARED SOURCES ${ARGN}) | 487 add_d_target(${name} TYPE SHARED SOURCES ${ARGN}) |
488 endmacro(add_d_shared_lib name) | 488 endmacro(add_d_shared_lib name) |
489 | 489 |
490 ## Add library target. | 490 ## Add library target. |
491 ## Library would shared if it supported. | 491 ## Library will shared if it supported. |
492 macro(add_d_lib name) | 492 macro(add_d_lib name) |
493 if(D_IS_MARS) | 493 if(D_IS_MARS) |
494 add_d_target(${name} TYPE STATIC ${ARGN}) | 494 add_d_target(${name} TYPE STATIC ${ARGN}) |
495 else(D_IS_MARS) | 495 else(D_IS_MARS) |
496 add_d_target(${name} TYPE SHARED ${ARGN}) | 496 add_d_target(${name} TYPE SHARED ${ARGN}) |
497 endif(D_IS_MARS) | 497 endif(D_IS_MARS) |
498 endmacro(add_d_lib name) | 498 endmacro(add_d_lib name) |
499 | 499 |
500 ## | 500 ## |
501 macro(get_imported_files imported) | 501 macro(get_imported_files_old imported) |
502 execute_process(COMMAND ${DC} -c -o- -v ${compile_flags_tmp} ${ARGN} | 502 execute_process(COMMAND ${DC} -c -o- -v ${compile_flags_tmp} ${ARGN} |
503 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} | 503 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} |
504 OUTPUT_VARIABLE dc_output_tmp | 504 OUTPUT_VARIABLE dc_output_tmp |
505 | 505 |
506 ) | 506 ) |
507 string(REGEX MATCHALL "import[^\\(]*([^\\)]*)" dc_output_tmp "${dc_output_tmp}") | 507 string(REGEX MATCHALL "import[^\\(]*([^\\)]*)" dc_output_tmp "${dc_output_tmp}") |
508 | |
509 ## Initial filter. | |
510 regex_safe_string(tmp ${CMAKE_CURRENT_SOURCE_DIR}) | |
511 regex_safe_string(tmp2 ${CMAKE_CURRENT_BINARY_DIR}) | |
512 set(regex_includes_tmp ${tmp}|${tmp2}) | |
513 | |
508 set(${imported}) | 514 set(${imported}) |
509 foreach(import_tmp ${dc_output_tmp}) | 515 foreach(import_tmp ${dc_output_tmp}) |
516 ## Getting a next import. | |
510 string(REGEX REPLACE "import[^\\(]*\\(([^\\)]*)" "\\1" import_tmp ${import_tmp}) | 517 string(REGEX REPLACE "import[^\\(]*\\(([^\\)]*)" "\\1" import_tmp ${import_tmp}) |
511 set(${imported} ${${imported}} ${import_tmp}) | 518 ## Filtering. |
519 file(TO_CMAKE_PATH import_tmp ${import_tmp}) | |
520 string(REGEX MATCH "(${regex_includes_tmp})[^/]*" found "${import_tmp}") | |
521 string(SUBSTRING "${import_tmp}" 0 1 first_sym_tmp) | |
522 set(full_path_tmp) | |
523 if(${first_sym_tmp} STREQUAL "/") | |
524 set(full_path_tmp 1) | |
525 endif(${first_sym_tmp} STREQUAL "/") | |
526 if(NOT found AND full_path_tmp) | |
527 else(NOT found AND full_path_tmp) | |
528 set(${imported} ${${imported}} ${import_tmp}) | |
529 endif(NOT found AND full_path_tmp) | |
512 endforeach(import_tmp ${dc_output_tmp}) | 530 endforeach(import_tmp ${dc_output_tmp}) |
513 endmacro(get_imported_files imported) | 531 endmacro(get_imported_files_old imported) |
514 | 532 |
515 macro(filter_paths result) | 533 macro(filter_paths result) |
516 set(${result}) | 534 set(${result}) |
517 set(read_now_tmp paths) | 535 set(read_now_tmp paths) |
518 set(include_tmp) | 536 set(include_tmp) |
559 endif(NOT found AND full_path_tmp) | 577 endif(NOT found AND full_path_tmp) |
560 endforeach(path_tmp ${paths_tmp}) | 578 endforeach(path_tmp ${paths_tmp}) |
561 endmacro(filter_paths ) | 579 endmacro(filter_paths ) |
562 | 580 |
563 macro(get_files_depends out) | 581 macro(get_files_depends out) |
564 get_imported_files(${out} ${ARGN}) | 582 get_imported_files_old(${out} ${ARGN}) |
565 filter_paths(${out} ${${out}} INCLUDE_CURRENT_DIR INCLUDE_PATHS ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) | 583 #filter_paths(${out} ${${out}} INCLUDE_CURRENT_DIR INCLUDE_PATHS ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) |
566 set(${out} ${ARGN} ${${out}}) | 584 set(${out} ${ARGN} ${${out}}) |
567 endmacro(get_files_depends out) | 585 endmacro(get_files_depends out) |