我不知道如何正确地将构建类型设置为使用ExternalProject_Add发行。显而易见的解决方案是在-DCMAKE_BUILD_TYPE=Release
中使用CMAKE_ARGS
,但这似乎不适用于Visual Studio生成器。即使同时使用CMAKE_ARGS -DCMAKE_BUILD_TYPE=Release
和BUILD_COMMAND cmake --build . --config Release
,Visual Studio生成器似乎也可以编译所有内容的Debug和Release版本,并且以以下错误消息结尾(尝试将LLVM编译为ExternalProject时):>
CMake Error at projects/compiler-rt/lib/builtins/cmake_install.cmake:37 (file):
file INSTALL cannot find
"E:/swan-build/compiler-prefix/src/compiler-build/$(Configuration)/lib/clang/9.0.0/lib/windows/clang_rt.builtins-x86_64.lib".
Call Stack (most recent call first):
projects/compiler-rt/lib/cmake_install.cmake:38 (include)
projects/compiler-rt/cmake_install.cmake:38 (include)
projects/cmake_install.cmake:37 (include)
cmake_install.cmake:63 (include)
那么,我该如何在CMake中使用ExternalProject正确设置构建类型?