CMakeMacroFilterOut: Difference between revisions

From KitwarePublic
Jump to navigationJump to search
mNo edit summary
(Replace content with link to new CMake community wiki)
 
(12 intermediate revisions by 5 users not shown)
Line 1: Line 1:
    MACRO(FILTER_OUT FILTERS INPUTS OUTPUT)
{{CMake/Template/Moved}}
    #
 
    # Mimicks Gnu Make's $(filter-out) which removes elements
This page has moved [https://gitlab.kitware.com/cmake/community/wikis/contrib/macros/FilterOut here].
    # from a list that match the pattern.
    # Arguments:
    #  FILTERS - list of patterns that need to be removed
    #  INPUTS  - list of inputs that will be worked on
    #  OUTPUT  - the filtered list to be returned
    #
    # Example:
    #  SET(MYLIST this that and the other)
    #  SET(FILTS this that)
    #
    #  FILTER_OUT("${FILTS}" "${MYLIST}" OUT)
    #  MESSAGE("OUTPUT = ${OUT}")
    #
    # The output -
    #  OUTPUT = and;the;other
    #
    SET(FOUT "")
    FOREACH(INP ${INPUTS})
        SET(FILTERED 0)
        FOREACH(FILT ${FILTERS})
            IF(${FILTERED} EQUAL 0)
                IF("${FILT}" STREQUAL "${INP}")
                    SET(FILTERED 1)
                ENDIF("${FILT}" STREQUAL "${INP}")
            ENDIF(${FILTERED} EQUAL 0)
        ENDFOREACH(FILT ${FILTERS})
       
        IF(${FILTERED} EQUAL 0)
            SET(FOUT ${FOUT} ${INP})
        ENDIF(${FILTERED} EQUAL 0)
    ENDFOREACH(INP ${INPUTS})
    SET(${OUTPUT} ${FOUT})
    ENDMACRO(FILTER_OUT FILTERS INPUTS OUTPUT)

Latest revision as of 15:41, 30 April 2018


The CMake community Wiki has moved to the Kitware GitLab Instance.

This page has moved here.