string(REGEX REPLACE "/+$" "" dname "${dname}")
Strips all trailing slashes. But honestly, "man cmake" would have been way faster and less embarrassing... HTH Michael On 03/02/2011 01:41 PM, Pablo Zurita wrote: > Yes, that works. > > Now I just need to remove the last character if it is a forward slash. > How can I do that? > > Thanks, > Pablo Zurita. > > Sent from my iPhone > > On Mar 2, 2011, at 1:47 AM, Yuri Timenkov <y...@timenkov.ru > <mailto:y...@timenkov.ru>> wrote: > >> Does get_filename_component help? >> >> On Wed, Mar 2, 2011 at 6:17 AM, Pablo Zurita >> <<mailto:pzur...@gmail.com>pzur...@gmail.com >> <mailto:pzur...@gmail.com>> wrote: >> >> Hello everybody, >> >> I'm just getting started and I need some help dealing with strings in >> CMake. Basically what I have a bunch of strings such as the ones >> below: >> >> "Main.cpp" >> "Window/Example/Example.cpp" >> "Window/Window.cpp" >> >> What I need to do is create two strings for each, one is going to be >> the directory, so the output in order for the list above is: >> >> "" >> "Window/Example" >> "Window" >> >> And the other string I need is the file itself. So the output for >> that would be >> >> "Main.cpp" >> "Example.cpp" >> "Window.cpp" >> >> Since I'm processing each one by one it doesn't matter if there >> are collisions. >> >> As you can see all I need to is find the first forward slash on the >> string reading from right to left, and then put what's on the left of >> that string on one variable, and what is to the right in another. >> >> Does anybody know how I can do that? >> >> Thanks, >> Pablo Zurita. _______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake