Changeset 50 in pacpusframework for trunk/cmake/PacpusUtilities.cmake


Ignore:
Timestamp:
Jan 9, 2013, 9:06:15 AM (12 years ago)
Author:
Marek Kurdej
Message:

CMake: updated to conform to the coding style.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/cmake/PacpusUtilities.cmake

    r40 r50  
    7979# ========================================
    8080macro(pacpus_purge_backslash var)
    81   string(REGEX REPLACE "\\\\" "/" ${var} "${${var}}")
     81    string(REGEX REPLACE "\\\\" "/" ${var} "${${var}}")
    8282endmacro()
    8383
     
    8686# ========================================
    8787macro(pacpus_get_msvc output)
    88   # By default, unknown
    89   set(${output} "unknown")
    90   if (MSVC9)
    91     set(${output} "msvc2008")
    92   elseif (MSVC10)
    93     set(${output} "msvc2010")
    94   else (MSVC11)
    95     set(${output} "msvc2012")
    96   endif()
     88    # By default, unknown
     89    set(${output} "unknown")
     90    if(MSVC9)
     91        set(${output} "msvc2008")
     92    elseif(MSVC10)
     93        set(${output} "msvc2010")
     94    else(MSVC11)
     95        set(${output} "msvc2012")
     96    endif()
    9797endmacro()
    9898
     
    101101# ========================================
    102102function(pacpus_output_status msg)
    103   message(STATUS "${msg}")
    104   string(REPLACE "\\" "\\\\" msg "${msg}")
    105   string(REPLACE "\"" "\\\"" msg "${msg}")
     103    message(STATUS "${msg}")
     104    string(REPLACE "\\" "\\\\" msg "${msg}")
     105    string(REPLACE "\"" "\\\"" msg "${msg}")
    106106endfunction()
    107107
     
    110110# ========================================
    111111function(pacpus_info text)
    112   set(status_cond)
    113   set(status_then)
    114   set(status_else)
    115 
    116   set(status_current_name "cond")
    117   foreach(arg ${ARGN})
    118     if(arg STREQUAL "THEN")
    119       set(status_current_name "then")
    120     elseif(arg STREQUAL "ELSE")
    121       set(status_current_name "else")
     112    set(status_cond)
     113    set(status_then)
     114    set(status_else)
     115
     116    set(status_current_name "cond")
     117    foreach(arg ${ARGN})
     118        if(arg STREQUAL "THEN")
     119            set(status_current_name "then")
     120        elseif(arg STREQUAL "ELSE")
     121            set(status_current_name "else")
     122        else()
     123            list(APPEND status_${status_current_name} ${arg})
     124        endif()
     125    endforeach()
     126
     127    if(DEFINED status_cond)
     128        set(status_placeholder_length 32)
     129        string(RANDOM LENGTH ${status_placeholder_length} ALPHABET " " status_placeholder)
     130        string(LENGTH "${text}" status_text_length)
     131        if(status_text_length LESS status_placeholder_length)
     132            string(SUBSTRING "${text}${status_placeholder}" 0 ${status_placeholder_length} status_text)
     133        elseif(DEFINED status_then OR DEFINED status_else)
     134            pacpus_output_status("${text}")
     135            set(status_text "${status_placeholder}")
     136        else()
     137            set(status_text "${text}")
     138        endif()
     139
     140        if(DEFINED status_then OR DEFINED status_else)
     141            if(${status_cond})
     142                string(REPLACE ";" " " status_then "${status_then}")
     143                string(REGEX REPLACE "^[ \t]+" "" status_then "${status_then}")
     144                pacpus_output_status("${status_text} ${status_then}")
     145            else()
     146                string(REPLACE ";" " " status_else "${status_else}")
     147                string(REGEX REPLACE "^[ \t]+" "" status_else "${status_else}")
     148                pacpus_output_status("${status_text} ${status_else}")
     149            endif()
     150        else()
     151            string(REPLACE ";" " " status_cond "${status_cond}")
     152            string(REGEX REPLACE "^[ \t]+" "" status_cond "${status_cond}")
     153            pacpus_output_status("${status_text} ${status_cond}")
     154        endif()
    122155    else()
    123       list(APPEND status_${status_current_name} ${arg})
     156        pacpus_output_status("${text}")
    124157    endif()
    125   endforeach()
    126 
    127   if(DEFINED status_cond)
    128     set(status_placeholder_length 32)
    129     string(RANDOM LENGTH ${status_placeholder_length} ALPHABET " " status_placeholder)
    130     string(LENGTH "${text}" status_text_length)
    131     if(status_text_length LESS status_placeholder_length)
    132       string(SUBSTRING "${text}${status_placeholder}" 0 ${status_placeholder_length} status_text)
    133     elseif(DEFINED status_then OR DEFINED status_else)
    134       pacpus_output_status("${text}")
    135       set(status_text "${status_placeholder}")
    136     else()
    137       set(status_text "${text}")
    138     endif()
    139 
    140     if(DEFINED status_then OR DEFINED status_else)
    141       if(${status_cond})
    142         string(REPLACE ";" " " status_then "${status_then}")
    143         string(REGEX REPLACE "^[ \t]+" "" status_then "${status_then}")
    144         pacpus_output_status("${status_text} ${status_then}")
    145       else()
    146         string(REPLACE ";" " " status_else "${status_else}")
    147         string(REGEX REPLACE "^[ \t]+" "" status_else "${status_else}")
    148         pacpus_output_status("${status_text} ${status_else}")
    149       endif()
    150     else()
    151       string(REPLACE ";" " " status_cond "${status_cond}")
    152       string(REGEX REPLACE "^[ \t]+" "" status_cond "${status_cond}")
    153       pacpus_output_status("${status_text} ${status_cond}")
    154     endif()
    155   else()
    156     pacpus_output_status("${text}")
    157   endif()
    158158endfunction()
    159159
Note: See TracChangeset for help on using the changeset viewer.