无法打开输入文件“optimized.lib” 编译osgEarth2.8+VS2013+CMake3.4.0在Release版本的问题

1>LINK : fatal error LNK1181: 无法打开输入文件“optimized.lib”

可以到http://forum.osgearth.org搜索相关帖子,gwaldron说这很可能是CMake3.0以上版本的问题:

gwaldron gwaldron
Reply | Threaded | More    

Re: Build error

 

 
I solved this problem like this: 

CMake (3+) comes with a built-in FindZLIB.cmake library for locating the ZLib dependency. But it is introducing this problem. So I copied the old FindZLIB.cmake from the OSG distribution into osgEarth/CMakeModules, and the problem disappeared. 

 

从OpenSceneGraph-3.4.0\CMakeModules拷贝一份FindZLIB.cmake放到D:\APICenter\OSG\osgEarth2.8.0\CMakeModules

并修改,将红框中的部分删除,即不使用CMake自带的FindZLIB.cmake。

 

对于OSG也可以这么操作,由于涉及到此问题的项目较少,所以可以手动删除,找到编译出问题的项目(osgdb_freetype,osgdb_png和osgdb_tiff)属性,顺便删除debug.lib

 

 

出现这个问题的根源是:FREETYPE,PNG和TIFF插件在CMake配置的时候,他们_LIBRARY后面带了_DEBUG

而OpenSceneGraph-3.4.0\CMakeModules\OsgMacroUtils.cmake的MACRO(LINK_WITH_VARIABLES TRGTNAME)对此加以判断

通过打印输出可以看到PNG_LIBRARY的内容有错误

 

 

 

 

 

 

 

 

posted @ 2016-10-13 15:19  酷熊  阅读(3310)  评论(1编辑  收藏  举报