[CMake] Setting target property FOLDER on target ALL_BUILD

Stuermer, Michael SP/HZA-ZSEP michael.stuermer at schaeffler.com
Fri Jan 29 10:43:02 EST 2016


>From cmGlobalVisualStudioGenerator.cxx (line 92ff):

#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

Ok, this makes it pretty clear. But "we" don't want ALL_BUILD always to be selected as default "startup project". How about something like this:

      if (this->UseFolderProperty())
        {
        const char* prop = this->GetCMakeInstance()->GetState()
          ->GetGlobalProperty("ALL_BUILD_TARGET_FOLDER");
        if(prop)
          {
          allBuild->SetProperty("FOLDER", prop);
         }
        }

This would allow relocating the ALL_BUILD target, but it must be done explicitly using a new global property ALL_BUILD_TARGET_FOLDER.

If it's acceptable I'd submit a patch for this.

best regards,
Michael


From: CMake [mailto:cmake-bounces at cmake.org] On Behalf Of Stuermer, Michael SP/HZA-ZSEP
Sent: Friday, January 29, 2016 3:43 PM
To: cmake at cmake.org
Subject: [CMake] Setting target property FOLDER on target ALL_BUILD

I would like to move the ALL_BUILD target tot he "CMakePredefinedTargets", however this seems not be possible straight away. At least even at the very end of the very last CMakeLists.txt I still cannot call

set_target_properties(ALL_BUILD
    PROPERTIES
    FOLDER " CMakePredefinedTargets ")

without getting an error that the target does not exist. Can it be done at all?

best regards,
Michael

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160129/34969a7f/attachment.html>


More information about the CMake mailing list