FOLDER
: Set the folder name. Use to organize targets in an IDE.Targets with no FOLDER property will appear as top level entities in IDEs like Visual Studio. Targets with the same FOLDER property value will appear next to each other in a folder of that name. To nest folders, use FOLDER values such as 'GUI/Dialogs' with '/' characters separating folder levels.
方法如下:
Add this to the top level CMakeLists.txt #Use solution folders. set_property(GLOBAL PROPERTY USE_FOLDERS ON) # Then in some target add this to put the target in the Development folder. set_target_properties(${PROJECT_NAME} PROPERTIES FOLDER Development)
不过VcExpress因为不支持工程目录,所以FOLDER属性无效。
因为机器上同时安装了VC和VcExpress,CMake总是判断为Express版,所以FOLDER设置总是无效。
最终打开sln文件看到了头部的这行才找到问题原因:
# Visual C++ Express
然后在CMake源码中找到了Express版本检测代码:
this->ExpressEdition = cmSystemTools::ReadRegistryValue(
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\14.0\\Setup\\VC;"
"ProductDir", vc14Express, cmSystemTools::KeyWOW64_32);
删除该注册表项就不会被判为Express版了,FOLDER设置成功。