The following issue has been SUBMITTED. ====================================================================== http://public.kitware.com/Bug/view.php?id=13571 ====================================================================== Reported By: rlandert Assigned To: ====================================================================== Project: CMake Issue ID: 13571 Category: CMake Reproducibility: always Severity: minor Priority: normal Status: new ====================================================================== Date Submitted: 2012-10-04 17:49 CEST Last Modified: 2012-10-04 17:49 CEST ====================================================================== Summary: Empty FOLDERs in Visual Studio Solutions shown from external targets Description: In the Visual Studio Solutions of targets which are defined in subfolders, all Visual Studio FOLDERS (target property) from previously defined targets are shown, even if these targets are not contained in the solution.
Example (see attachment): In the toplevel directory there is a project definition for project test, which includes the two subdirectories test1 and test2 via: * add_subdirectory(test1) * add_subdirectory(test2) Inside these folders the projects test1 and test2 are defined, which generate the executables test1.exe and test2.exe. For these targets the Visual Studio Folders are defined in the according CMakeLists.txt files via: * set_property(TARGET test1 PROPERTY FOLDER "test1Dir") * set_property(TARGET test2 PROPERTY FOLDER "test2Dir") In the global solution file test.sln both targets are shown in the correct folders: * test1Dir/test1 * test2Dir/test2 In the solution files for the subprojects, the (empty) folder for the other target is shown although it is not part of the solution. E.g. in solution test1.sln the empty folder test2Dir is shown. Tested with CMake 2.8.9 and Visual Studio 2008. Steps to Reproduce: 1. Unpack attached file 2. Generate Visual Studio Solutions with CMake 3. Open test.sln -> targets test1 and test2 are correctly shown in subfolder test1Dir and test2Dir 4. Open test1/test1.sln -> empty folder test2Dir is shown 5. Open test2/test2.sln -> empty folder test1Dir is shown Additional Information: The reason seems to be that the variable VisualStudioFolders in the file cmGlobalVisualStudio7Generator.cxx is not cleared between the generation of the different Solution files. My solution was to call VisualStudioFolders.clear() at the beginning of the method cmGlobalVisualStudio7Generator::WriteTargetsToSolution, although i'm not sure whether this is the correct place for this. The patch can be found in the attached file. ====================================================================== Issue History Date Modified Username Field Change ====================================================================== 2012-10-04 17:49 rlandert New Issue 2012-10-04 17:49 rlandert File Added: CMake_FolderIssue.zip ====================================================================== -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers