How to prepend all filenames on the list with common path?

后端 未结 6 1822
孤城傲影
孤城傲影 2020-12-16 09:05

How can I prepend all filenames on the list with a common path prefix automatically? For instance having a list of files in CMakeLists.txt:

SET(SRC_FILES foo         


        
6条回答
  •  感动是毒
    2020-12-16 09:53

    I assume that you want an absolute filename as you are prepending ${CMAKE_CURRENT_SOURCE_DIR}. If you are using FILE(GLOB ), all the files will have an absolute path already:

    file(GLOB_RECURSE SOURCE_FILES src/*.cpp)
    

    See the comments CMake in documentation on why not to use GLOB to add source files.

提交回复
热议问题