0

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

1 回答 1

0

It seems that you need to specify devenv.com instead of devenv.exe. See the output of the following commands:

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>
于 2013-06-17T11:00:41.277 回答