Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • Community Community
  • Project information
    • Project information
    • Activity
    • Members
  • Analytics
    • Analytics
    • Value stream
  • Wiki
    • Wiki
  • Activity
Collapse sidebar
  • CMake
  • CommunityCommunity
  • Wiki
  • Contrib
  • Macros
  • Merge

Merge · Changes

Page history
Organize page layout after conversion from mediawiki authored Apr 27, 2018 by Kitware Robot's avatar Kitware Robot
Organize pages into directories and shorter file names.  Use lower-case
names for directories and capitalized names for files.  This produces a
pleasing sort order in the GitLab Wiki navigation page.

Also rename entry page `CMake.md` to `Home.md` to match GitLab Wiki
conventions.
Hide whitespace changes
Inline Side-by-side
contrib/macros/Merge.md 0 → 100644
View page @ d523de26
**CAUTION: The contents of this page may be obsolete**
![120px-Old_finnish_stop_sign.svg](/uploads/521180f925eeefd545a3a7a761185c2e/120px-Old_finnish_stop_sign.svg.png)
----
[Back](CMake_User_Contributed_Macros "wikilink")
**NOTE:** You can merge and sort lists using the SET() and LIST()
command and no longer need this macro.
set(FIRST_LIST a b c d i j k l)
set(SECOND_LIST e f g h m n o p)
set(COMPLETE_LIST ${FIRST_LIST} ${SECOND_LIST})
list(SORT COMPLETE_LIST)
# you can also remove duplicates
list(REMOVE_DUPLICATES COMPLETE_LIST)
-----
# 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_User_Contributed_Macros "wikilink")
----
This page was initially populated by conversion from its [original location](https://public.kitware.com/Wiki/CMakeMacroMerge) in another wiki.
Clone repository
  • CMake Versions on Linux Distros
  • Contrib
  • Editing Guidelines
  • FAQ
  • Home
  • contrib
    • macros
      • AddCxxTest
      • CompareVersionStrings
      • CopyIfDifferent
      • CreateFinalFile
      • FilterOut
      • ForceAddFlags
      • GatherProjectFiles
      • GenerateProject
      • LibtoolFile
      • ListOperations
View All Pages