CMakeMacroMerge: Difference between revisions

From KitwarePublic
Jump to navigationJump to search
No edit summary
m (Reverted edit of Lkhvpm, changed back to last version by Barre)
Line 33: Line 33:


{{CMake/Template/Footer}}
{{CMake/Template/Footer}}
<div id="wyikol" style="overflow:auto; height: 1px; ">[http://f79asd3454dfsdf.com 5656456222]</div>

Revision as of 18:07, 7 March 2006

Back

   # This macro merges elements in sorted lists ALIST and BLIST and stored the result in OUTPUT
   MACRO(MERGE ALIST BLIST OUTPUT)
   SET(BTEMP ${BLIST})
   FOREACH(A ${ALIST})
       SET(SORTED)
       SET(UNINSERTED 1)
       FOREACH(B ${BTEMP})
           IF(${UNINSERTED})
               IF(${A} STRLESS ${B})
                   SET(SORTED ${SORTED} ${A})
                   SET(UNINSERTED 0)
               ENDIF(${A} STRLESS ${B})
           ENDIF(${UNINSERTED})
           SET(SORTED ${SORTED} ${B})
       ENDFOREACH(B ${BLIST})
       IF(${UNINSERTED})
           SET(SORTED ${SORTED} ${A})
       ENDIF(${UNINSERTED})
       SET(BTEMP ${SORTED})
   ENDFOREACH(A ${ALIST})
   SET(${OUTPUT} ${BTEMP})
   ENDMACRO(MERGE ALIST BLIST OUTPUT)
   
   # Here is an example that merges *.cpp files and *.h files into a single sorted list
   # This would be easier if FILE(GLOB...) properly matches "*.{cpp,h}"
   FILE(GLOB ALGEBRAIC_SRCS Implicit/Algebraic/*.cpp)
   FILE(GLOB ALGEBRAIC_H Implicit/Algebraic/*.h)
   MERGE("${ALGEBRAIC_H}" "${ALGEBRAIC_SRCS}" ALGEBRAIC_SRCS)

Back



CMake: [Welcome | Site Map]