visual studio express 2012 and cmake

4

我正在寻找一种方法来编译一些通过cmake准备好供使用的库,问题是我想使用VC++ Express 2012(第一个允许x64开发的Express版本),但是当我运行cmake时,我一直得到这个错误:

CMake Error: CMake was unable to find a build program corresponding to "Visual Studio 11".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
CMake Error: Could not find cmake module file:C:/Users/Alexander Rojas/workspace/jthread-1.3.1/build/CMakeFiles/CMakeCCompiler.cmake
CMake Error: Could not find cmake module file:C:/Users/Alexander Rojas/workspace/jthread-1.3.1/build/CMakeFiles/CMakeCXXCompiler.cmake
Configuring incomplete, errors occurred!

我发现这个路径是devenv.exe的路径,但是这个全新的vc没有这个程序。有什么解决方法吗?


1
http://public.kitware.com/Bug/view.php?id=13348 - stijn
是的,我看到了,然而他们并没有提供解决方法。 - Sambatyon
你不能让cmake为VS2012或VC Express 2010生成vcxproj文件,然后手动构建它(使用devenv、msbuild或IDE)吗? - stijn
在付费的Visual Studio应用程序中,CMAKE_MAKE_PROGRAM是devenv.com或MSbuild.exe。我相信MSBuild.exe不能与Express版本一起使用,因此如果这是导致构建停止的原因,您可能需要等待修复。 - drescherjm
5个回答

8

因此,在文件CMakeVS11FindMake.cmake中,我必须更改所有对注册表键的引用。

HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\11.0

到关键位置

HKEY_CURRENT_USER\\Software\\Microsoft\\WDExpress\\11.0_Config

(just adding them as an extra hint will work)


5
Visual Studio 2012 Express Edition目前在任何已发布的CMake版本(2.8.9)中均不受支持。但是,CMake开发人员刚刚检查了代码以修复问题。该修复程序应该在发布CMake 2.8.10时包含。
如果您真的需要更早的版本,您应该可以获取夜间版CMake安装程序,但您可能需要等到20120919安装程序发布之后,因为我不确定这个修复程序是否已经包含在20120918安装程序中。
(为了今天测试它,我从他们的git存储库中检出了源代码,切换到“next”分支,使用旧版CMake进行配置,自己构建了一个新的CMake,并确认它可以与VS 2012 Express正常工作。)

它是否也支持构建ARM架构? - Raman Sharma

2

我仍需要应用Sambatyon的修复方法到CMakeVS11FindMake.cmake文件中,我正在使用CMake 2.8.10.2版本。


0

其他的解决方案已经不再适用了;在最新版本(截至撰写本文时的express 2012 for desktop)中,您可能需要进行修改:

C:\Program Files (x86)\CMake 2.8\share\cmake-2.8\Modules\CMakeVS12FindMake.cmake

阅读类似以下内容:

#=============================================================================
# Copyright 2007-2013 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
#  License text for the above reference.)

# Always use MSBuild because:
# - devenv treats command-line builds as recently-loaded projects in the IDE
# - devenv does not appear to support non-standard platform toolsets
# If we need devenv for Intel Fortran in the future we should add
# a special case when Fortran is enabled.
find_program(CMAKE_MAKE_PROGRAM
  NAMES MSBuild
  HINTS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\MSBuild\\ToolsVersions\\4.0;MSBuildToolsPath]" <--- Change this line.
  )
message("Found: ${CMAKE_MAKE_PROGRAM}")

mark_as_advanced(CMAKE_MAKE_PROGRAM)
set(MSVC12 1)
set(MSVC_VERSION 1800)

这是针对cmake 2.8.11.2的。

编辑:特别注意,这是针对VS2012捆绑包,而不是VS2013预览版或未来版本的VS2013,其中正确的ToolsVersions为\12.0。


-1

我的解决方法:生成2010年的项目,在VS2012中执行“全部重新加载”,然后在解决方案资源管理器中对解决方案执行“更新VC++项目”。

但是:我的安装包括活动的VS 2010,过期的VS 2012试用版和活动的VS 2012 Express。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接