CMake可以設(shè)置FOLDER屬性,用來分目錄組織VC中的多個(gè)工程。
不過VcExpress因?yàn)椴恢С止こ棠夸洠訤OLDER屬性無效。
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)
#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因?yàn)椴恢С止こ棠夸洠訤OLDER屬性無效。
因?yàn)闄C(jī)器上同時(shí)安裝了VC和VcExpress,CMake總是判斷為Express版,所以FOLDER設(shè)置總是無效。
最終打開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);