[cmake-developers] [CMake 0011874]: If directory does not exist when use chdir command, we can auto create it.

Mantis Bug Tracker mantis at public.kitware.com
Thu Feb 17 01:35:23 EST 2011


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=11874 
====================================================================== 
Reported By:                Yuchen Deng
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   11874
Category:                   CMake
Reproducibility:            always
Severity:                   feature
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2011-02-17 01:35 EST
Last Modified:              2011-02-17 01:35 EST
====================================================================== 
Summary:                    If directory does not exist when use chdir command,
we can auto create it.
Description: 
Author: Yuchen Deng <loaden at gmail.com>  2011-02-17 14:09:41
Committer: Yuchen Deng <loaden at gmail.com>  2011-02-17 14:09:41
Parent: 8caed602080c6e052adec1d38dba8a37d3a76f58 (KWSys Nightly Date Stamp)
Child:  55846016b48bd286654ebd20d5b6f48256a2abe9 (Merge branch 'master' into
loaden-master)
Branches: loaden-master, master, remotes/loaden/loaden-master
Follows: v2.8.4
Precedes: 

    If directory does not exist when use chdir command, we can auto create it.
    This hack can support eclipse cdt best.
    In eclipse cdt, we usally use command like "cmake -E chdir
${ProjDirPath}/build cmake .." of a "Make Target".
    Then we can easy run cmake config.

------------------------------- Source/cmake.cxx -------------------------------
index bab0aaf..7fd191d 100644
@@ -1269,9 +1269,17 @@ int cmake::ExecuteCMakeCommand(std::vector<std::string>&
args)
       std::string directory = args[2];
       if(!cmSystemTools::FileExists(directory.c_str()))
         {
-        cmSystemTools::Error("Directory does not exist for chdir command: ",
+          if (cmSystemTools::MakeDirectory(directory.c_str()))
+            {
+            cmSystemTools::Message("Directory does not exist for chdir command,
so auto create now: ",
+                                   args[2].c_str());
+            }
+          else
+            {
+            cmSystemTools::Error("Directory does not exist for chdir command:
",
                              args[2].c_str());
-        return 1;
+            return 1;
+            }
         }
 
       std::string command = "\"";


Steps to Reproduce: 
Always.

Additional Information: 
None.
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2011-02-17 01:35 Yuchen Deng    New Issue                                    
======================================================================




More information about the cmake-developers mailing list