When using VS solution folders in CMake using:
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set_target_properties(MyProject PROPERTIES FOLDER "MyProjects")
I'm also automatically enabling a
CMakePredefinedTargets
folder:
Is there a way to avoid this behaviour?
Resetting PREDEFINED_TARGETS_FOLDER
can rename the folder but not remove it. Setting the FOLDER
property for INSTALL, etc. does not seem to be valid either.
Thanks.
Edit: After looking into the CMake code I was pretty sure you could set PREDEFINED_TARGETS_FOLDER
to ""
. I've tested it and with CMake 3.3.2 and VS2015 using
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER "")
the predefined targets are at root level again.
And, yes if the global USE_FOLDERS
property if ON
then the predefined targets are hard-wired to always be grouped in the PREDEFINED_TARGETS_FOLDER
folder. So setting the FOLDER
property of e.g. INSTALL
won't help.
As a reference see cmGlobalVisualStudioGenerator.cxx
where this behavior was explicitly deactivated for the ALL_BUILD
target:
#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's nested in a // folder, then that doesn't happen. // // Organize in the "predefined targets" folder: // if (this->UseFolderProperty()) { allBuild->SetProperty("FOLDER", this->GetPredefinedTargetsFolder()); } #endif
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With