I want to be able to have this simple translation between full path and
filename.

For example = /very/long/path/file.py ->  file.py

So I did this quite ugly function:

function (get_filename FULLPATH)
   string(REPLACE "/" ";" p2list "${FULLPATH}")
   list(REVERSE p2list)
   list(GET p2list 0 last)
   set(RESULT_VAR ${last} PARENT_SCOPE)
endfunction()

but the problem is that it doesn't work on windows unfortunately.
Is there some library/code to do multi-platform path manipulations in
CMake maybe?

--

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

Reply via email to