How to set the global variable in a function for cmake?

后端 未结 5 1651
庸人自扰
庸人自扰 2020-12-15 19:14

I\'m writing a CMakeLists.txt to generate files and compile the generated files. I create a function to add some file path strings to a global list variable.

My CMak

5条回答
  •  自闭症患者
    2020-12-15 20:16

    You need to use set instead of list to affect the variable in the parent scope.

    So replace your list command with:

    set(source_list ${source_list} ${file_path} PARENT_SCOPE)
    

提交回复
热议问题