我已经使用 CMake 体验了这个问题。我需要在一个目标中使用 VS 解决方案(.sln),所以我有这样的东西:
set(SLN "${SOME_PATH}/src/exemple.sln")
get_filename_component(
VS_DIR "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0\\Setup\\VS;ProductDir]"
REALPATH CACHE)
set(BUILD_TOOL "${VS_DIR}/Common7/IDE/devenv.exe")
set(BUILD_COMMAND
"${BUILD_TOOL}" "${SLN}" "/build" "Debug"
)
add_custom_target(
${Project_OUTPUT}
COMMAND ${BUILD_COMMAND}
VERBATIM
)
有时这个目标(在编译时)会挂起。有人知道它可能是什么吗?也许它不依赖于CMake?根据日志,构建系统启动了几个项目(从此解决方案),之后什么也不做:
26>------ Build started: Project: project26, Configuration: Debug Win32 ------
27>------ Build started: Project: project27, Configuration: Debug Win32 ------
28>------ Build started: Project: project28, Configuration: Debug Win32 ------
29>------ Build started: Project: project29, Configuration: Debug Win32 ------