问题描述
我正在尝试使用cmake设置一个旧项目,并且我希望所有标志都保持与以前相同.旧的项目生成器具有链接器标记/SUBSYSTEM
,其最小子系统版本号 5.01
设置如下:
I am trying to set up an old project using cmake and I would like to keep all flags the same as before.The old project generator has the linker flag /SUBSYSTEM
with minimum subystem version number 5.01
set like this:
/SUBSYSTEM:WINDOWS,"5.01"
我通过添加以下内容在cmake中进行了尝试:
I tried the same in cmake by adding this:
set_target_properties(mytarget PROPERTIES LINK_FLAGS_RELEASE "/SUBSYSTEM:WINDOWS,\"5.01\"")
但是结果是错误的.Cmake似乎删除了(转义的)双引号,并将链接器标志放在Visual Studio项目中的添加选项"中:/SUBSYSTEM:WINDOWS,5.01
However the result is wrong. Cmake seems to remove the (escaped) double quotes and places the linker flag to "Addition Options" in the Visual Studio project: /SUBSYSTEM:WINDOWS,5.01
这种方式不能识别子系统标志并将其设置为 CONSOLE
.
This way the subsystem flag is not recognized and set to CONSOLE
.
我尝试了几种组合,如何将最小版本,"5.01"
添加到子系统标志,但是没有成功.
I tried several combinations how to add the min version ,"5.01"
to the subsystem flag but without success.
还有其他方法可以将最小子系统版本号添加到/SUBSYSTEM标志吗?
Is there any other way to add the minimum subsystem version number to the /SUBSYSTEM flag?
推荐答案
您可以在 add_executable 函数:
add_executable(${PROJECT_NAME} WIN32 main.cpp)
这篇关于在CMAKE中正确设置Visual Studio链接器标志/SUBSYSTEM的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!