[CMake] AW: [CPACK]: How to put release and debug files in _one_ package?

wedekind wedekind at caesar.de
Mon Nov 20 05:03:13 EST 2006


Hello all,

I have modified the current CVS-version of CMake form me to be able to put
release- _and_ debug-version of a build in one package using CPack. Maybe it
is not an optimal solution and since I am not very familiar with
CMake-development I would like to ask for your opinion on it. After that I
could add a feature request.

I have implemented the simplest solution that works for me: I have added a
new "build configuration" string "Release_and_Debug". This string is
interpreted in 

int cmCPackGenericGenerator::ProcessGenerator()
{
...
  if (strcmp(this->GetOption("CPACK_BUILD_CONFIG"), "Release_and_Debug") ==
0)
  {
      this->SetOption("CPACK_BUILD_CONFIG", "Release");
      if ( !this->InstallProject() )
       {
       return 0;
       }

      this->SetOption("CPACK_BUILD_CONFIG", "Debug");
      if ( !this->InstallProject(false) )
       {
       return 0;
       }
  }
  else
  {
      if ( !this->InstallProject() )
       {
       return 0;
       }
  }
...
}

This will simply install a project twice into CPack's temporary directory.
CPack will then process the content of its temporary dir to create an
installer package.

To prevent cmCPackGenericGenerator::InstallProject() from deleting the
content of this temporary dir every time it is called I have introduced a
Boolean flag to InstallProject():

class cmCPackGenericGenerator : public cmObject { ...
protected:
  int InstallProject(bool bCleanTempDir = true); ...
}

int cmCPackGenericGenerator::InstallProject(bool bCleanTempDir) {
  cmCPackLogger(cmCPackLog::LOG_OUTPUT, "Install projects" << std::endl);
  if (bCleanTempDir)
  {   
     this->CleanTemporaryDirectory();
  }
...
}

Do you think that this is a viable solution?

I would appreciate seeing this feature in a future CMake/CPack release.

Thanks for your comments

Marco

>-----Ursprüngliche Nachricht-----
>Von: wedekind [mailto:wedekind at caesar.de]
>Gesendet: Mittwoch, 15. November 2006 17:56
>An: 'cmake at cmake.org'
>Betreff: [CPACK]: How to put release and debug files in _one_ package?
>
>Hello all,
>
>is it possible to create an installer package with CPack that contains 
>both release and debug installations of a software?
>
>I have seen from the CVS' source code that currently there is an option 
>CPACK_BUILD_CONFIG, which seems to default to "Release". Can I set this 
>to another value (All?) to build a debug-and-release package? Or is 
>there another way?
>
>Cheers
>
>Marco




More information about the CMake mailing list