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
doen...@mvtec.com <mailto:musterm...@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
-- 

Powered by kitware.com/cmake

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit https://cmake.org/services

Visit other Kitware open-source projects at https://www.kitware.com/platforms

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake

This mailing list is deprecated in favor of https://discourse.cmake.org

Reply via email to