CMake错误:CMake无法确定目标:myapp的链接器语言 [英] CMake Error: CMake can not determine linker language for target: myapp

查看:140
本文介绍了CMake错误:CMake无法确定目标:myapp的链接器语言的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过cmake编译vMime,但是上面出现错误,我正在使用cmake的图形界面,下面是我的makefiles.txt.它配置正确,但不会生成

I am trying to compile vMime by cmake, but I am getting error above, I am using graphical interface of cmake and my makefiles.txt is below. It configures properly but do not generate

cmake_minimum_required(VERSION 2.8)
PROJECT(CXX)#vmime
enable_language(CXX)
set(VerifyCXX VerifyCXX.cxx)
add_definitions(-DVERIFY_CXX)
set_target_properties(${TARGET} PROPERTIES LINKER_LANGUAGE Cxx)
add_executable(myapp vmime)
install(TARGETS myapp DESTINATION bin)

由于我被困几天了,我们将不胜感激.

Help will be highly appreciated as I am stuck at point for couple of days.

推荐答案

CMake可能无法确定目标 myapp 的链接器语言,因为目标不包含任何带有可识别扩展名的源文件.

CMake probably can not determine linker language for target myapp, because the target does not contain any source files with recognized extensions.

add_executable(myapp vmime)

应该替换为

add_executable(myapp ${VerifyCXX})

也是该命令

set_target_properties(${TARGET} PROPERTIES LINKER_LANGUAGE Cxx) 

不能成功使用,因为 $ {TARGET} 是预先设置的.您应该在 add_executable

cannot be succesfull, because ${TARGET} is used-before-set. You should call it after add_executable

set_target_properties(myapp PROPERTIES LINKER_LANGUAGE CXX)

请注意,通常根本不需要.

Note that usually it is not needed at all.

这篇关于CMake错误:CMake无法确定目标:myapp的链接器语言的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆