ENH: change CPACK_CREATE_DESKTOP_LINKS to something that can handle spaces in the name of the exectuable
This commit is contained in:
parent
c05f8aa70e
commit
87c22309b8
|
@ -2,7 +2,10 @@
|
||||||
IF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
|
IF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
|
||||||
IF(EXISTS "${CMAKE_ROOT}/Modules/InstallRequiredSystemLibraries.cmake")
|
IF(EXISTS "${CMAKE_ROOT}/Modules/InstallRequiredSystemLibraries.cmake")
|
||||||
SET(CMAKE_INSTALL_MFC_LIBRARIES 1)
|
SET(CMAKE_INSTALL_MFC_LIBRARIES 1)
|
||||||
INCLUDE(InstallRequiredSystemLibraries)
|
OPTION(CMAKE_INSTALL_DEBUG_LIBRARIES
|
||||||
|
"Install Microsoft runtime debug libraries with CMake." FALSE)
|
||||||
|
MARK_AS_ADVANCED(CMAKE_INSTALL_DEBUG_LIBRARIES)
|
||||||
|
INCLUDE(${CMake_SOURCE_DIR}/Modules/InstallRequiredSystemLibraries.cmake)
|
||||||
ENDIF(EXISTS "${CMAKE_ROOT}/Modules/InstallRequiredSystemLibraries.cmake")
|
ENDIF(EXISTS "${CMAKE_ROOT}/Modules/InstallRequiredSystemLibraries.cmake")
|
||||||
CONFIGURE_FILE("${CMake_SOURCE_DIR}/CMakeCPackOptions.cmake.in"
|
CONFIGURE_FILE("${CMake_SOURCE_DIR}/CMakeCPackOptions.cmake.in"
|
||||||
"${CMake_BINARY_DIR}/CMakeCPackOptions.cmake" @ONLY)
|
"${CMake_BINARY_DIR}/CMakeCPackOptions.cmake" @ONLY)
|
||||||
|
|
|
@ -20,7 +20,7 @@ if(CPACK_GENERATOR MATCHES "NSIS")
|
||||||
# tell cpack the executables you want in the start menu as links
|
# tell cpack the executables you want in the start menu as links
|
||||||
SET(CPACK_PACKAGE_EXECUTABLES "CMakeSetup" "CMake" )
|
SET(CPACK_PACKAGE_EXECUTABLES "CMakeSetup" "CMake" )
|
||||||
# tell cpack to create a desktop link to CMakeSetup
|
# tell cpack to create a desktop link to CMakeSetup
|
||||||
SET(CPACK_CREATE_DESKTOP_LINK_CMakeSetup ON)
|
SET(CPACK_CREATE_DESKTOP_LINKS "CMakeSetup")
|
||||||
SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\CMakeSetup.exe")
|
SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\CMakeSetup.exe")
|
||||||
SET(CPACK_NSIS_DISPLAY_NAME "@CPACK_PACKAGE_INSTALL_DIRECTORY@ a cross-platform, open-source build system")
|
SET(CPACK_NSIS_DISPLAY_NAME "@CPACK_PACKAGE_INSTALL_DIRECTORY@ a cross-platform, open-source build system")
|
||||||
SET(CPACK_NSIS_HELP_LINK "http:\\\\www.cmake.org")
|
SET(CPACK_NSIS_HELP_LINK "http:\\\\www.cmake.org")
|
||||||
|
|
|
@ -228,10 +228,34 @@ int cmCPackNSISGenerator::InitializeInternal()
|
||||||
<< nsisVersion << std::endl);
|
<< nsisVersion << std::endl);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
this->SetOptionIfNotSet("CPACK_INSTALLER_PROGRAM", nsisPath.c_str());
|
this->SetOptionIfNotSet("CPACK_INSTALLER_PROGRAM", nsisPath.c_str());
|
||||||
const char* cpackPackageExecutables
|
const char* cpackPackageExecutables
|
||||||
= this->GetOption("CPACK_PACKAGE_EXECUTABLES");
|
= this->GetOption("CPACK_PACKAGE_EXECUTABLES");
|
||||||
|
const char* cpackPackageDeskTopLinks
|
||||||
|
= this->GetOption("CPACK_CREATE_DESKTOP_LINKS");
|
||||||
|
std::vector<std::string> cpackPackageDesktopLinksVector;
|
||||||
|
if(cpackPackageDeskTopLinks)
|
||||||
|
{
|
||||||
|
cmCPackLogger(cmCPackLog::LOG_DEBUG, "CPACK_CREATE_DESKTOP_LINKS: "
|
||||||
|
<< cpackPackageDeskTopLinks << std::endl);
|
||||||
|
|
||||||
|
cmSystemTools::
|
||||||
|
ExpandListArgument(cpackPackageDeskTopLinks,
|
||||||
|
cpackPackageDesktopLinksVector);
|
||||||
|
for(std::vector<std::string>::iterator i =
|
||||||
|
cpackPackageDesktopLinksVector.begin(); i !=
|
||||||
|
cpackPackageDesktopLinksVector.end(); ++i)
|
||||||
|
{
|
||||||
|
cmCPackLogger(cmCPackLog::LOG_DEBUG, "CPACK_CREATE_DESKTOP_LINKS: "
|
||||||
|
<< *i << std::endl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cmCPackLogger(cmCPackLog::LOG_DEBUG, "CPACK_CREATE_DESKTOP_LINKS: "
|
||||||
|
<< "not set" << std::endl);
|
||||||
|
|
||||||
|
}
|
||||||
if ( cpackPackageExecutables )
|
if ( cpackPackageExecutables )
|
||||||
{
|
{
|
||||||
cmCPackLogger(cmCPackLog::LOG_DEBUG, "The cpackPackageExecutables: "
|
cmCPackLogger(cmCPackLog::LOG_DEBUG, "The cpackPackageExecutables: "
|
||||||
|
@ -263,9 +287,11 @@ int cmCPackNSISGenerator::InitializeInternal()
|
||||||
<< ".lnk\"" << std::endl;
|
<< ".lnk\"" << std::endl;
|
||||||
// see if CPACK_CREATE_DESKTOP_LINK_ExeName is on
|
// see if CPACK_CREATE_DESKTOP_LINK_ExeName is on
|
||||||
// if so add a desktop link
|
// if so add a desktop link
|
||||||
std::string desktop = "CPACK_CREATE_DESKTOP_LINK_";
|
if(cpackPackageDesktopLinksVector.size() &&
|
||||||
desktop += execName;
|
std::find(cpackPackageDesktopLinksVector.begin(),
|
||||||
if(this->IsSet(desktop.c_str()))
|
cpackPackageDesktopLinksVector.end(),
|
||||||
|
execName)
|
||||||
|
!= cpackPackageDesktopLinksVector.end())
|
||||||
{
|
{
|
||||||
str << " StrCmp \"$INSTALL_DESKTOP\" \"1\" 0 +2\n";
|
str << " StrCmp \"$INSTALL_DESKTOP\" \"1\" 0 +2\n";
|
||||||
str << " CreateShortCut \"$DESKTOP\\"
|
str << " CreateShortCut \"$DESKTOP\\"
|
||||||
|
|
Loading…
Reference in New Issue