[CMake] Question about list ordering
Eric Doenges
doenges at mvtec.com
Wed Nov 13 01:37:25 EST 2019
The list <https://cmake.org/cmake/help/latest/command/list.html> command
is what you want. Specifically, list(GET ...) will return the index of a
string in the list, and list(INSERT ...) and list(REMOVE_ITEM ...) or
list(REMOVE_AT ...) to insert and remove items.
Am 13.11.19 um 00:56 schrieb Unnamed User:
> Hello everyone,
>
> i'm relative new to CMake and i need a function that does change the
> order of a list. So for example when i have a list like
>
> set(LIBS_TO_BUILD "BOOST;EIGEN;PYTHON;GLUT;GLFW;NLOHMANNJSON")
>
> i need a function to swap places like
>
> listSwapString("GLUT", "GLFW", ${LIBS_TO_BUILD}).
>
>
> The base code for the function look like this, but i don't even know how
> to get the index of a string inside of a list or how to insert a string
> at a certain position and move the other strings to the back.
>
> function(bsListInsertBefore)
> set(options)
> set(oneValueArgs SEARCH INSERT RESULT)
> set(multiValueArgs LIST)
> cmake_parse_arguments(var
> "${options}"
> "${oneValueArgs}"
> "${multiValueArgs}"
> "${ARGN}"
> )
> endfunction()
>
>
> I hope i can count on you, for me as a CMake newbie this is a great
> task, i stil have a bit of a problem with the syntax.
>
>
> best regards,
>
> Steven Truppe
>
--
*Dr. Eric Dönges*
Senior Software Engineer
MVTec Software GmbH | Arnulfstr. 205 | 80634 Munich | Germany
doenges at mvtec.com <mailto:mustermann at mvtec.com> | Tel: +49 89 457 695-0
| www.mvtec.com <http://www.mvtec.com>
Find our privacy policy here <https://www.mvtec.com/imprint>.
Sign up <https://www.mvtec.com/newsletter> for our MVTec Newsletter!
Geschäftsführer: Dr. Wolfgang Eckstein, Dr. Olaf Munkelt
Amtsgericht München HRB 114695
MVTec Software GmbH Logo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20191113/1cfe2378/attachment.html>
More information about the CMake
mailing list