如何使用 CMake 安装非标准构建目标输出文件?

How to install non-standard build target output file using CMake?

我有一个 CMake 库目标,它在构建目录中输出 foo.js 和 foo.wasm 文件。但是,当我安装()目标时,只有 foo.js 出现在安装目录中。我怎样才能让 CMake 也安装 foo.wasm?我正在使用 Emscripten 工具链生成 WebAssembly。

像这样安装 foo.wasm:

install(FILES foo.wasm DESTINATION {your-destination})