No CMakePredefinedTargets when using solution folders

When using VS solution folders in CMake with:

set_property(GLOBAL PROPERTY USE_FOLDERS ON) set_target_properties(MyProject PROPERTIES FOLDER "MyProjects") 

I also automatically CMakePredefinedTargets :

enter image description here

Is there any way to avoid this behavior?

Resetting PREDEFINED_TARGETS_FOLDER may rename the folder but not delete it. Setting the FOLDER property for INSTALL, etc. Also not true.

Thanks.

+5
source share
1 answer

Edit : PREDEFINED_TARGETS_FOLDER at the CMake code, I was sure that you can set PREDEFINED_TARGETS_FOLDER to "" . I tested it with both CMake 3.3.2 and VS2015 using

 set_property(GLOBAL PROPERTY USE_FOLDERS ON) set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER "") 

predefined goals are again at the root level.

And yes, if the global property is USE_FOLDERS , if it is ON , then the predefined goals are rigidly bound to always be grouped into PREDEFINED_TARGETS_FOLDER . Thus, setting the FOLDER property, for example. INSTALL will not help.

See cmGlobalVisualStudioGenerator.cxx a reference, where this behavior has been explicitly deactivated for the purpose of ALL_BUILD :

 #if 0 // Can't activate this code because we want ALL_BUILD // selected as the default "startup project" when first // opened in Visual Studio... And if it nested in a // folder, then that doesn't happen. // // Organize in the "predefined targets" folder: // if (this->UseFolderProperty()) { allBuild->SetProperty("FOLDER", this->GetPredefinedTargetsFolder()); } #endif 
+2
source

Source: https://habr.com/ru/post/1245535/


All Articles