[CMake] target property FOLDER

James Bigler jamesbigler at gmail.com
Fri Oct 1 18:31:51 EDT 2010


On Fri, Oct 1, 2010 at 4:16 PM, James Bigler <jamesbigler at gmail.com> wrote:

> I really like the new FOLDER property for targets.
>
> I'm wondering if it could be extended to allow me to set this for a whole
> directory.  Something like:
>
> set_property(DIRECTORY PROPERTY FOLDER "Utilities/3rdParty")
> add_executable(a ...)
> add_library(b ...)
> add_subdirectory(dir) # dir also get's this property
>
> This would make it pretty speedy to add this feature without having to add
> the set_property to each target, and it would be easier to maintain.  Any
> new projects would get the property as well.
>
> James
>

I'm looking at the CL that added it:
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e6ac0aacf6c3ce17141870e252fda77d994782d3

diff --git a/Source/cmGlobalVisualStudio7Generator.cxx
b/Source/cmGlobalVisualStudio7Generator.cxx


index 9631e9a..f455810 100644 (file)
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -300,6 +300,48 @@ void
cmGlobalVisualStudio7Generator::WriteTargetsToSolution(
                             cmLocalGenerator::START_OUTPUT);
         this->WriteProject(fout, vcprojName, dir.c_str(),
                            *target);
+
+        // Create "solution folder" information from FOLDER target property
+        //
+        if (this->UseFolderProperty())
+          {
+          const char *targetFolder = target->GetProperty("FOLDER");
+          if (targetFolder)
+            {

It seems like some extra code could be added to also check the directory
properties if the target properties doesn't exit.  Is this hard to do?
Should I attempt it and submit a patch?

James
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20101001/e9a24535/attachment.htm>


More information about the CMake mailing list