[Cmake-commits] [cmake-commits] alex committed cmExtraCodeBlocksGenerator.cxx 1.28 1.29

cmake-commits at cmake.org cmake-commits at cmake.org
Sat Sep 26 04:26:30 EDT 2009


Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv10434

Modified Files:
	cmExtraCodeBlocksGenerator.cxx 
Log Message:
Fix bug #9529.

Set the working_dir entry in the codeblocks project file of executable
targets to the directory where the executable is created. Then when running
CB, executing the target (not building), will run it from that directory.

Alex


Index: cmExtraCodeBlocksGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmExtraCodeBlocksGenerator.cxx,v
retrieving revision 1.28
retrieving revision 1.29
diff -C 2 -d -r1.28 -r1.29
*** cmExtraCodeBlocksGenerator.cxx	10 Sep 2009 17:44:02 -0000	1.28
--- cmExtraCodeBlocksGenerator.cxx	26 Sep 2009 08:26:28 -0000	1.29
***************
*** 545,553 ****
      {
      int cbTargetType = this->GetCBTargetType(target);
      const char* buildType = makefile->GetDefinition("CMAKE_BUILD_TYPE");
      fout<<"         <Option output=\"" << target->GetLocation(buildType)
                              << "\" prefix_auto=\"0\" extension_auto=\"0\" />\n"
!           "         <Option working_dir=\"" 
!                             << makefile->GetStartOutputDirectory() << "\" />\n"
            "         <Option object_output=\"./\" />\n"
            "         <Option type=\"" << cbTargetType << "\" />\n"
--- 545,574 ----
      {
      int cbTargetType = this->GetCBTargetType(target);
+     std::string workingDir = makefile->GetStartOutputDirectory();
+     if ( target->GetType()==cmTarget::EXECUTABLE)
+       {
+       // Determine the directory where the executable target is created, and
+       // set the working directory to this dir.
+       const char* runtimeOutputDir = makefile->GetDefinition(
+                                              "CMAKE_RUNTIME_OUTPUT_DIRECTORY");
+       if (runtimeOutputDir != 0)
+         {
+         workingDir = runtimeOutputDir;
+         }
+       else
+         {
+         const char* executableOutputDir = makefile->GetDefinition(
+                                                      "EXECUTABLE_OUTPUT_PATH");
+         if (executableOutputDir != 0)
+           {
+           workingDir = executableOutputDir;
+           }
+         }
+       }
+ 
      const char* buildType = makefile->GetDefinition("CMAKE_BUILD_TYPE");
      fout<<"         <Option output=\"" << target->GetLocation(buildType)
                              << "\" prefix_auto=\"0\" extension_auto=\"0\" />\n"
!           "         <Option working_dir=\"" << workingDir << "\" />\n"
            "         <Option object_output=\"./\" />\n"
            "         <Option type=\"" << cbTargetType << "\" />\n"



More information about the Cmake-commits mailing list