View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0011874CMakeCMakepublic2011-02-17 01:352016-06-10 14:31
ReporterYuchen Deng 
Assigned ToKitware Robot 
PrioritynormalSeverityfeatureReproducibilityalways
StatusclosedResolutionmoved 
PlatformWindows/UnixOSWindows XP SP3 / ArchLinuxOS Version
Product Version 
Target VersionFixed in Version 
Summary0011874: If directory does not exist when use chdir command, we can auto create it.
DescriptionAuthor: Yuchen Deng <loaden@gmail.com> 2011-02-17 14:09:41
Committer: Yuchen Deng <loaden@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 ReproduceAlways.
Additional InformationNone.
TagsNo tags attached.
Attached Filespng file icon 2.png [^] (22,323 bytes) 2011-04-04 19:53

 Relationships

  Notes
(0025962)
Yuchen Deng (reporter)
2011-03-30 01:34
edited on: 2011-03-30 01:36

[code]
      if(!cmSystemTools::FileExists(directory.c_str()))
        {
        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;
         }
       }
[/code]

(0026030)
Yuchen Deng (reporter)
2011-04-04 03:37

OR, Changed:
if(!cmSystemTools::FileExists(directory.c_str()))
TO:
if(!cmSystemTools::FileExists(directory.c_str()) && !cmSystemTools::MakeDirectory(directory.c_str()))

??
(0026082)
David Cole (manager)
2011-04-04 12:57

We *could* do this, but should we?

I'm not convinced this is necessarily a good idea.

Do you have a use case for this, which is a compelling argument for auto-creating directories via the "cd" command...?
(0026090)
Yuchen Deng (reporter)
2011-04-04 19:53

I am using 'Make Target' to control everything.

e.g.
----
Build = cmake -E chdir ${ProjDirPath}/Build nmake
CMake_Debug = cmake -E chdir ${ProjDirPath}/Build cmake -DCMAKE_BUILD_TYPE=Debug ..
----

When using 'cmake -E chdir ${ProjDirPath}/Build', I can using 'Out-of-source' build in Eclipse CDT.

But, If don't use chdir, It's seems no way to implemention 'Out-of-source' build.
(0026099)
David Cole (manager)
2011-04-05 15:25

Can you use...

    CMake_Debug = cmake -E make_directory ${ProjDirPath}/Build && cmake -E chdir ${ProjDirPath}/Build cmake -DCMAKE_BUILD_TYPE=Debug ..

...instead?
(0026100)
David Cole (manager)
2011-04-05 15:27

Are you aware that there are already Eclipse specific generators for CMake projects?

On Windows, the bottom of the cmake --help output is this:

  Eclipse CDT4 - MinGW Makefiles
                              = Generates Eclipse CDT 4.0 project files.
  Eclipse CDT4 - NMake Makefiles
                              = Generates Eclipse CDT 4.0 project files.
  Eclipse CDT4 - Unix Makefiles
                              = Generates Eclipse CDT 4.0 project files.
(0026111)
Yuchen Deng (reporter)
2011-04-05 21:40
edited on: 2011-04-05 21:41

Can you use...
    CMake_Debug = cmake -E make_directory ${ProjDirPath}/Build && cmake -E chdir ${ProjDirPath}/Build cmake -DCMAKE_BUILD_TYPE=Debug ..
...instead?
-------------
Thanks! This command can not work with CDT.

I found a way to solved it *ONLY* in Windows OS.
But it is no cross-platform.
--------
cmd /C "if not exist Build (mkdir Build && chdir Build && cmake -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=Debug .. && nmake) else chdir Build && cmake -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=Debug .. && nmake"

(0026112)
Yuchen Deng (reporter)
2011-04-05 21:40

Are you aware that there are already Eclipse specific generators for CMake projects?
------------
Yes, I noticed it.
But it can not support MSVC in Windows.
(0026122)
David Cole (manager)
2011-04-06 11:22

Doesn't "Eclipse CDT4 - NMake Makefiles" mean that it will use "nmake" and "cl" ... ?
(0026128)
Yuchen Deng (reporter)
2011-04-07 01:26

Doesn't "Eclipse CDT4 - NMake Makefiles" mean that it will use "nmake" and "cl" ... ?
--------
Oh, I don't noticed this option.
But after test and find there have some issue about this.
e.g. cl.exe can't support "Discovery Options" of CDT.
And I am using CDT8 now, seems not compatible from CDT4 to CDT8.
And seems does not look flexible.

So, I am using "NMake Makefiles" generator still.
Many thanks!
(0030248)
David Cole (manager)
2012-08-11 11:09

Sending old, never assigned issues to the backlog.

(The age of the bug, plus the fact that it's never been assigned to anyone means that nobody is actively working on it...)

If an issue you care about is sent to the backlog when you feel it should have been addressed in a different manner, please bring it up on the CMake mailing list for discussion. Sign up for the mailing list here, if you're not already on it: http://www.cmake.org/mailman/listinfo/cmake [^]

It's easy to re-activate a bug here if you can find a CMake developer who has the bandwidth to take it on, and ferry a fix through to our 'next' branch for dashboard testing.
(0041802)
Kitware Robot (administrator)
2016-06-10 14:28

Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.

 Issue History
Date Modified Username Field Change
2011-02-17 01:35 Yuchen Deng New Issue
2011-03-30 01:34 Yuchen Deng Note Added: 0025962
2011-03-30 01:36 Yuchen Deng Note Edited: 0025962
2011-04-04 03:37 Yuchen Deng Note Added: 0026030
2011-04-04 12:57 David Cole Note Added: 0026082
2011-04-04 19:53 Yuchen Deng Note Added: 0026090
2011-04-04 19:53 Yuchen Deng File Added: 2.png
2011-04-05 15:25 David Cole Note Added: 0026099
2011-04-05 15:27 David Cole Note Added: 0026100
2011-04-05 21:40 Yuchen Deng Note Added: 0026111
2011-04-05 21:40 Yuchen Deng Note Added: 0026112
2011-04-05 21:41 Yuchen Deng Note Edited: 0026111
2011-04-06 11:22 David Cole Note Added: 0026122
2011-04-07 01:26 Yuchen Deng Note Added: 0026128
2012-08-11 11:09 David Cole Status new => backlog
2012-08-11 11:09 David Cole Note Added: 0030248
2016-06-10 14:28 Kitware Robot Note Added: 0041802
2016-06-10 14:28 Kitware Robot Status backlog => resolved
2016-06-10 14:28 Kitware Robot Resolution open => moved
2016-06-10 14:28 Kitware Robot Assigned To => Kitware Robot
2016-06-10 14:31 Kitware Robot Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team