自定义cmake目标中的VS解决方案有时会挂起

时间:2013-06-14 13:43:22

标签: visual-studio-2010 cmake

我已经使用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 ------

1 个答案:

答案 0 :(得分:0)

您似乎需要指定devenv.com而不是devenv.exe。请参阅以下命令的输出:

E:\folder>devenv.exe "E:\folder\solution.sln" /build Debug

E:\folder>devenv.com "E:\folder\solution.sln" /build Debug

Microsoft (R) Visual Studio Version 10.0.40219.1.
Copyright (C) Microsoft Corp. All rights reserved.
========== Build: 0 succeeded, 0 failed, 1 up-to-date, 0 skipped ==========

E:\folder>