summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2006-02-14 15:28:40 (GMT)
committerAndy Cedilnik <andy.cedilnik@kitware.com>2006-02-14 15:28:40 (GMT)
commit3bce601c41b8487a18417e32b75c0e22f0750bbc (patch)
tree8dc47a279806741f6fa4ab14a702614e364c4684
parent2d29e48726235b71db6e38481dd537fb9eb75876 (diff)
downloadCMake-3bce601c41b8487a18417e32b75c0e22f0750bbc.zip
CMake-3bce601c41b8487a18417e32b75c0e22f0750bbc.tar.gz
CMake-3bce601c41b8487a18417e32b75c0e22f0750bbc.tar.bz2
ENH: Improved support for icons, random directories, etc...
-rw-r--r--CMakeLists.txt6
-rw-r--r--Modules/CPack.cmake1
-rw-r--r--Source/CPack/cmCPackGenericGenerator.cxx55
-rw-r--r--Source/CPack/cmCPackSTGZGenerator.cxx2
-rw-r--r--Source/CPack/cpack.cxx14
-rw-r--r--Templates/CPackConfig.cmake.in2
6 files changed, 63 insertions, 17 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5651f4c..71214f1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -230,12 +230,14 @@ IF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
SET(CPACK_PACKAGE_VERSION_MAJOR "${CMake_VERSION_MAJOR}")
SET(CPACK_PACKAGE_VERSION_MINOR "${CMake_VERSION_MINOR}")
SET(CPACK_PACKAGE_VERSION_PATCH "${CMake_VERSION_PATCH}")
- SET(CPACK_PACKAGE_EXECUTABLE "CMakeSetup")
- SET(CPACK_PACKAGE_EXECUTABLE_LABEL "CMake")
+
IF(WIN32 AND NOT UNIX)
# There is a bug in NSI that does not handle full unix paths properly. Make
# sure there is at least one set of four (4) backlasshes.
SET(CPACK_PACKAGE_ICON "${CMake_SOURCE_DIR}/Utilities/Release\\\\CMakeInstall.bmp")
+ SET(CPACK_PACKAGE_EXECUTABLE "CMakeSetup" "CMake")
+ ELSE(WIN32 AND NOT UNIX)
+ SET(CPACK_PACKAGE_EXECUTABLE "ccmake" "CMake")
ENDIF(WIN32 AND NOT UNIX)
INCLUDE(CPack)
ENDIF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake
index 819f0c1..a320ce7 100644
--- a/Modules/CPack.cmake
+++ b/Modules/CPack.cmake
@@ -44,7 +44,6 @@ IF(NOT CPACK_GENERATOR)
ENDIF(NOT CPACK_GENERATOR)
# Set some other variables
-SET(CPACK_SOURCE_DIR "${CMAKE_SOURCE_DIR}")
SET(CPACK_BINARY_DIR "${CMAKE_BINARY_DIR}")
# Hack for Visual Studio support
diff --git a/Source/CPack/cmCPackGenericGenerator.cxx b/Source/CPack/cmCPackGenericGenerator.cxx
index 60af6eb..b203563 100644
--- a/Source/CPack/cmCPackGenericGenerator.cxx
+++ b/Source/CPack/cmCPackGenericGenerator.cxx
@@ -56,9 +56,6 @@ int cmCPackGenericGenerator::PrepareNames()
outName += ".";
outName += this->GetOutputExtension();
- std::string installFile = this->GetOption("CPACK_PACKAGE_DIRECTORY");
- installFile += "/cmake_install.cmake";
-
std::string destFile = this->GetOption("CPACK_PACKAGE_DIRECTORY");
destFile += "/" + outName;
@@ -67,7 +64,6 @@ int cmCPackGenericGenerator::PrepareNames()
this->SetOption("CPACK_TOPLEVEL_DIRECTORY", topDirectory.c_str());
this->SetOption("CPACK_TEMPORARY_DIRECTORY", tempDirectory.c_str());
- this->SetOption("CPACK_INSTALL_FILE_NAME", installFile.c_str());
this->SetOption("CPACK_OUTPUT_FILE_NAME", outName.c_str());
this->SetOption("CPACK_OUTPUT_FILE_PATH", destFile.c_str());
this->SetOption("CPACK_TEMPORARY_PACKAGE_FILE_NAME", outFile.c_str());
@@ -118,7 +114,6 @@ int cmCPackGenericGenerator::InstallProject()
{
cmCPackLogger(cmCPackLog::LOG_OUTPUT, "Install project" << std::endl);
const char* tempInstallDirectory = this->GetOption("CPACK_TEMPORARY_INSTALL_DIRECTORY");
- const char* installFile = this->GetOption("CPACK_INSTALL_FILE_NAME");
int res = 1;
if ( !cmsys::SystemTools::MakeDirectory(tempInstallDirectory))
{
@@ -165,8 +160,54 @@ int cmCPackGenericGenerator::InstallProject()
}
}
}
- else
+ const char* installDirectories = this->GetOption("CPACK_INSTALLED_DIRECTORIES");
+ if ( installDirectories )
+ {
+ std::vector<std::string> installDirectoriesVector;
+ cmSystemTools::ExpandListArgument(installDirectories,installDirectoriesVector);
+ if ( installDirectoriesVector.size() % 2 != 0 )
+ {
+ cmCPackLogger(cmCPackLog::LOG_ERROR, "CPACK_INSTALLED_DIRECTORIES should contain pairs of <directory> and <subdirectory>. The <subdirectory> can be '.' to be installed in the toplevel directory of installation." << std::endl);
+ return 0;
+ }
+ std::vector<std::string>::iterator it;
+ const char* tempDir = this->GetOption("CPACK_TEMPORARY_DIRECTORY");
+ for ( it = installDirectoriesVector.begin(); it != installDirectoriesVector.end();
+ ++it )
+ {
+ cmCPackLogger(cmCPackLog::LOG_DEBUG, "Find files" << std::endl);
+ cmsys::Glob gl;
+ std::string toplevel = it->c_str();
+ it ++;
+ std::string subdir = it->c_str();
+ std::string findExpr = toplevel;
+ findExpr += "/*";
+ gl.RecurseOn();
+ if ( !gl.FindFiles(findExpr) )
+ {
+ cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find any files in the installed directory" << std::endl);
+ return 0;
+ }
+ std::vector<std::string>& files = gl.GetFiles();
+ std::vector<std::string>::iterator gfit;
+ for ( gfit = files.begin(); gfit != files.end(); ++ gfit )
+ {
+ std::string filePath = tempDir;
+ filePath += "/" + subdir + "/" + cmSystemTools::RelativePath(toplevel.c_str(), gfit->c_str());
+ std::string &inFile = *gfit;
+ cmCPackLogger(cmCPackLog::LOG_DEBUG, "Copy file: " << inFile.c_str() << " -> " << filePath.c_str() << std::endl);
+ if ( !cmSystemTools::CopyFileIfDifferent(inFile.c_str(), filePath.c_str()) )
+ {
+ cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem copying file: " << inFile.c_str() << " -> " << filePath.c_str() << std::endl);
+ }
+ }
+ }
+ }
+ const char* binaryDir = this->GetOption("CPACK_BINARY_DIR");
+ if ( binaryDir )
{
+ std::string installFile = binaryDir;
+ installFile += "/cmake_install.cmake";
cmake cm;
cmGlobalGenerator gg;
gg.SetCMakeInstance(&cm);
@@ -183,7 +224,7 @@ int cmCPackGenericGenerator::InstallProject()
mf->AddDefinition("BUILD_TYPE", buildConfig);
}
- res = mf->ReadListFile(0, installFile);
+ res = mf->ReadListFile(0, installFile.c_str());
if ( cmSystemTools::GetErrorOccuredFlag() )
{
res = 0;
diff --git a/Source/CPack/cmCPackSTGZGenerator.cxx b/Source/CPack/cmCPackSTGZGenerator.cxx
index 64e4b76..4cce556 100644
--- a/Source/CPack/cmCPackSTGZGenerator.cxx
+++ b/Source/CPack/cmCPackSTGZGenerator.cxx
@@ -51,7 +51,7 @@ int cmCPackSTGZGenerator::GenerateHeader(std::ostream* os)
<< "# take the archive portion of this file and pipe it to tar" << std::endl
<< "# the NUMERIC parameter in this command should be one more" << std::endl
<< "# than the number of lines in this header file" << std::endl
- << "tail +18 $0 | gunzip | tar xf -" << std::endl
+ << "tail +18 \"$0\" | gunzip | tar xf -" << std::endl
<< "" << std::endl
<< "exit 0" << std::endl
<< "echo \"\"" << std::endl
diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx
index 4b850e8..c35efbe 100644
--- a/Source/CPack/cpack.cxx
+++ b/Source/CPack/cpack.cxx
@@ -295,12 +295,16 @@ int main (int argc, char *argv[])
parsed = 0;
}
- cmsys::SystemTools::ConvertToUnixSlashes(cpackProjectDirectory);
- std::string makeInstallFile = cpackProjectDirectory + "/cmake_install.cmake";
- if ( !cmsys::SystemTools::FileExists(makeInstallFile.c_str()) )
+ if ( !mf->GetDefinition("CPACK_INSTALL_COMMANDS") && !mf->GetDefinition("CPACK_INSTALLED_DIRECTORIES") )
{
- cmCPack_Log(&log, cmCPackLog::LOG_ERROR, "Cannot find installation file: " << makeInstallFile.c_str() << std::endl);
- parsed = 0;
+ cmsys::SystemTools::ConvertToUnixSlashes(cpackProjectDirectory);
+ std::string makeInstallFile = cpackProjectDirectory + "/cmake_install.cmake";
+ if ( !cmsys::SystemTools::FileExists(makeInstallFile.c_str()) )
+ {
+ cmCPack_Log(&log, cmCPackLog::LOG_ERROR, "Cannot find installation file: " << makeInstallFile.c_str() << std::endl);
+ cmCPack_Log(&log, cmCPackLog::LOG_ERROR, "Please specify build tree of the project that uses CMake, specify CPACK_INSTALL_COMMANDS, or specify CPACK_INSTALLED_DIRECTORIES." << std::endl);
+ parsed = 0;
+ }
}
}
}
diff --git a/Templates/CPackConfig.cmake.in b/Templates/CPackConfig.cmake.in
index 0476ba0..6bef2e2 100644
--- a/Templates/CPackConfig.cmake.in
+++ b/Templates/CPackConfig.cmake.in
@@ -17,7 +17,7 @@ SET(CPACK_PACKAGE_EXECUTABLE_LABEL "@CPACK_PACKAGE_EXECUTABLE_LABEL@")
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "@CPACK_PACKAGE_DESCRIPTION_SUMMARY@")
SET(CPACK_PACKAGE_DESCRIPTION_FILE "@CPACK_PACKAGE_DESCRIPTION_FILE@")
-SET(CPACK_SOURCE_DIR "@CPACK_SOURCE_DIR@")
+# It is a CMake project, so we need a binary directory
SET(CPACK_BINARY_DIR "@CPACK_BINARY_DIR@")
SET(CPACK_PACKAGE_ICON "@CPACK_PACKAGE_ICON@")