UNITY_BUILD_FILENAME_PREFIX

版本 4.2 中添加。

默认情况下,当启用 UNITY_BUILD 时生成的 unity 文件格式为 unity_<index>_<suffix>,其中 <suffix> 是特定于语言的。

如果有多个目标使用 unity 构建,构建输出可能无法指示 unity 文件属于哪个目标。此属性允许自定义生成的 unity 文件名的前缀。如果未设置,则使用默认前缀 unity_

用法示例

add_library(example_library
            source1.cxx
            source2.cxx
            source3.cxx)

set_target_properties(example_library PROPERTIES
                      UNITY_BUILD True
                      UNITY_BUILD_FILENAME_PREFIX "example_")