cgal4.4编译vs2005版本

在尝试编译CGAL4.4版本时遇到错误,CMake无法找到配置文件。用户试图为C++项目更改CMAKE_CXX_COMPILER和CXX_FLAGS,以便使用DevPartner编译器进行内存和运行时错误检测。讨论了如何通过修改CMAKE_MAKE_PROGRAM和环境变量来实现这一目标,以及如何在CMakeLists.txt文件中添加编译器标志。
摘要由CSDN通过智能技术生成

cgal4.4编译vs2005版本,不支持,不知道能不能自己修改配置文件,记录一下,以后解决!!

== CMake setup ==
CMake Error: cmListFileCache: error can not open file D:/Cgal/cgal-releases-CGAL-4.42023
CMake Error at out/CMakeFiles/CMakeSystem.cmake:1 (INCLUDE):
  include could not find load file:

    
Call Stack (most recent call first):
  CMakeLists.txt:3 (project)


Check for working CXX compiler using: Visual Studio 8 2005
CMake Error: cmListFileCache: error can not open file D:/Cgal/cgal-releases-CGAL-4.42023/out/CMakeFiles/CMakeTmp
CMake Error at D:/Cgal/cgal-releases-CGAL-4.42023/out/CMakeFiles/CMakeSystem.cmake:1 (INCLUDE):
  include could not find load file:
    
Call Stack (most recent call first):
  CMakeLists.txt:2 (PROJECT)

CMake Error: Internal CMake error, TryCompile configure of cmake failed
Check for working CXX compiler using: Visual Studio 8 2005 -- broken
CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/CMakeTestCXXCompiler.cmake:45 (MESSAGE):
  The C++ compiler "cl" is not able to compile a simple test program.
  It fails with the following output:
  
  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:3 (project)

Configuring incomplete, errors occurred!

如何为C++项目的CMAKE更改编译器和CXX_FLAGS?
modit 发布于 2019-02-05 • 在 c++ • 最后更新 2019-02-05 19:38 • 195 浏览

I’m currently working on an unmanaged Windows C++ application.
I’m new to the world of CMAKE and C++.
I’m also new to the world of this current unmanaged C++ application.
I’m trying to integrate DevPartner into my build to instrument the build
for memory errors and runtime errors.
为了构建工具,我需要更改为使用DevPartner编译器(nmcl.exe)。 此外,我需要将编译器设置添加到现有的CXX_FLAGS以进行检测。 我该如何去做这件事? 谢谢, JohnB
3 个回复
dquia 2019-02-05

对于VS版本2008及更早版本…(VS6除外,它使用msdev) 更好地挖掘cmake我会说这个有更多知识的人将能够接受它并运行它。 我确实发现CL和LINK命令实际上什么也没做,因为这只是Devenv for VS2003到2008和MSBuild for VS2010。将CL更改为NMCL无关紧要,因为MSBuild使用目标文件,这就是我的其他答案需要修改用户文件的原因。为什么我们需要在这里使用另一种工具。 Devenv调用/ Build内部使用项目文件来了解需要构建哪些源文件。然后它将在内部调用createprocess以根据需要生成CL和LINK。这就是为什么在cmake文件中将CL更改为NMCL是无用的。 幸运的是,我们有另一种工具可以在这里使用… 我们需要改变 //制作节目 CMAKE_MAKE_PROGRAM:FILEPATH = C:/ Program Files(x86)/ Common Files / Micro Focus / NMShared / CTI / 11.1 / NMdevenv.EXE 和 CMAKE_BUILD_TOOL:INTERNAL = E:/PROGRA1/MICROS2.0/Common7/IDE/devenv.com 到C:/ Program Files(x86)/ Common Files / Micro Focus / NMShared / CTI / 11.1 / NMdevenv.EXE 现在,这是需要更多知识的人。我们还需要将仪器类型传递给nmdevenv作为第一个参数。 我相信它可以做到这样的事情 set(CMAKE_MAKE_PROGRAM“$ {CMAKE_MAKE_PROGRAM}”/ nmon“) 这里的另一个问题是我们需要devenv也在路径中,所以Path env变量也需要正确设置。这可以通过运行正确的vscvars bat文件来完成。 希望这会有所帮助,如果您使用的是vs2008和之前的版本,请添加我在此处开始所需的步骤。我相信从长远来看它会帮助其他用户。如果我有更多的时间来调查这个,我会找到方法来做到这一点。 编辑 好吧,我确实设法使用VS2008。我确实需要对我们的nmdevenv包装器进行更改,因为cmake正在破坏我们的SearchPath功能。 这就是我做的。 如上所述替换make程序 跑VCVars32 Ran cmake --build mytestproj 在BounsChecker下运行程序 现在我切换到传入/ nmtxon进行性能分析 这让我有点难过,因为它一直在编译错误检测 那是我在转换后的项目文件中找到它的时候







        <Tool
            Name="VCCLCompilerTool"
            AdditionalOptions=" /NMbcon /Zm1000"
改成了 一切都很好。我有我的性能编译选项。 所以我回去并在CMakeCache.txt文件中修改了这一行,打开了GUI,configue,generate //所有构建类型中编译器使用的标志。 CMAKE_CXX_FLAGS:STRING = / NMbcon / DWIN32 / D_WINDOWS / W3 / Zm1000 / EHsc / GR 然后项目切换回使用/ NMbcon。如果你想和我们一起编译,那么这就是放置开关的正确位置。否则使用适当的Debug或release行。
Cmake输出的一部分 注意在输出中检测
Microsoft (R) Visual Studio Version 9.0.30729.1.
Copyright (C) Microsoft Corp. All rights reserved.
1>------ Build started: Project: Test, Configuration: Debug Win32 ------
1>Compiling...
New Command line nmcl.exe /NMtxon  @e:\cust\Test3\Test\Test.dir\Debug\RSP0000011
2568792.rsp /nologo /errorReport:queue
1>Test3.cpp
1>Instrumenting ..\Test3\Test3.cpp
1>Compiling manifest to resources...
1>Microsoft (R) Windows (R) Resource Compiler Version 6.1.7600.16385
1>Copyright (C) Microsoft Corporation.  All rights reserved.
1>Linking...
综上所述 使用Cmake生成CMakeCache.txt和目录 修改CmakeCahe     使用NMDevenv作为MAKE程序     添加/ NMon切换到标志 运行CmakeGui并再次生成 运行VCVars32 运行cmake --build文件 在devpartner下运行程序
dsit 2019-02-05

对于cmake文件不是100%肯定,但这是来自为Devpartner修改的旧VS 6 makefile。也许您可以发布makefile的相关部分供我查看。 / nmbcon是一个编译标志,表示使用BC instrumentation / nmtxon将用于覆盖率分析 CPP = cl.exe时 CPP_PROJ = / nologo / MD / W3 / Gm / GX / Zi / Od / D“WIN32”/ D“NDEBUG”/ D“_WINDOWS”/ D“_WINDLL”/ D“_AFXDLL”/ D“_MBCS”/ D“_AFXEXT “/Fp"$(INTDIR)\main.pch"/Yu"stdafx.h”/ Fo“$(INTDIR)\”/ Fd"..\bin\Debug\MAIN.pdb“/ FD / GZ / c 会成为 CPP = nmcl.exe CPP_PROJ = / nmbcon / nologo / MD / W3 / Gm / GX / Zi / Od / D“WIN32”/ D“NDEBUG”/ D“_WINDOWS”/ D“_WINDLL”/ D“_AFXDLL”/ D“_MBCS”/ D “_AFXEXT”/Fp"$(INTDIR)\main.pch“/Yu"stdafx.h”/ Fo“$(INTDIR)\”/ Fd"..\bin\Debug\MAIN.pdb“/ FD / GZ / C 哦,另一张海报是正确的东西已经由Visual Studio的版本大大改变。 VS2010改变了使用MSBuild的构建过程,这使我们完全修改了VS2010和2012的拦截和编程方式。 *编辑 好吧,我今天早上下载并经历了Cmake实习的痛苦。对于VS2010,这似乎是一个非常简单的修改,就像我们的一个用户从命令行使用MSBuild所需要的那样。 在第一次构建之后的“在哪里构建二进制文件”中,将有.vcxproj.user文件。这是您需要添加检测标志的位置

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
    <DevPartner_IsInstrumented>1</DevPartner_IsInstrumented>
    <DevPartner_Instrumented_Type> /NMbcOn</DevPartner_Instrumented_Type>
  </PropertyGroup>
</Project>
这可以是每个的重复部分 你想建立的。 下一个密钥DevPartner_IsInstrumented告诉我们仪器(1)与否(0)。 最后一个密钥DevPartner_Instrumented_Type>是传递的instrumetnt / nmbcon(Boundschecker)/ nmtxon(性能或覆盖范围)或两种密钥的类型。 所以它看起来像
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
    <DevPartner_IsInstrumented>1</DevPartner_IsInstrumented>
    <DevPartner_Instrumented_Type> /NMbcOn</DevPartner_Instrumented_Type>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
    <DevPartner_IsInstrumented>0</DevPartner_IsInstrumented>
    <DevPartner_Instrumented_Type> /NMbcOn</DevPartner_Instrumented_Type>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
    <DevPartner_IsInstrumented>0</DevPartner_IsInstrumented>
    <DevPartner_Instrumented_Type> /NMbcOn</DevPartner_Instrumented_Type>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
    <DevPartner_IsInstrumented>1</DevPartner_IsInstrumented>
    <DevPartner_Instrumented_Type> /NtxcOn</DevPartner_Instrumented_Type>
  </PropertyGroup>
</Project>

这将是Boundschecker for Debug win32,没有什么适用于Release win32,没有用于调试x64和性能/覆盖范围用于发布x64 如果IsInstrumented 0该类型中的任何内容都无关紧要,因为它不会被传递。 仅供参考,如果您在VS2010中打开解决方案并对其进行检测,则会将其添加到vcxproj.user文件中。仪表设置也是通过project / config进行的。 如果不使用VS2010,我的下面的注释可能对这些版本是正确的。 为了完全公开,我是DevPartner仪表引擎的首席开发人员。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

lst0426

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值