MantisBT - CMake
View Issue Details
0012351CMakeCPackpublic2011-07-19 22:572016-06-10 14:31
Mikhail Titov 
Kitware Robot 
normalminoralways
closedmoved 
Win32MS WindowsXP
CMake 2.8.5 
 
0012351: CPack fails to find package baked by NSIS if CPACK_OUTPUT_FILE_NAME is used
If CPACK_OUTPUT_FILE_NAME is used to override output file name like
set( CPACK_OUTPUT_FILE_NAME "mysoftware_mod_2.3.2-qgis_1.7-win32.exe" )
as in NSIS.template.in .
NSIS produces correct file, however CPack fails to copy it back in binary folder with an error like:

CPack Error: Problem copying the package: C:/workspace/mysoftware/rel/_CPack_Packages/win32/NSIS/mysoftware-2.3.2-win32.exe to C:/workspace/mysoftware/rel/mysoftware-2.3.2-win32.exe
CPack Error: Error when generating package: mysoftware
NMAKE : fatal error U1077: 'echo' : return code '0x1'
Stop.
Set up simple project for use with nmake.
Define CPACK_OUTPUT_FILE_NAME such that output file will be different from default name.
Execute nmake package
No tags attached.
related to 0012997closed Kitware Robot Provide a more flexible way to name package produced by CPack 
Issue History
2011-07-19 22:57Mikhail TitovNew Issue
2011-07-27 15:50Mikhail TitovNote Added: 0027084
2011-07-27 15:54Mikhail TitovNote Added: 0027085
2011-07-27 15:55Mikhail TitovNote Edited: 0027085bug_revision_view_page.php?bugnote_id=27085#r387
2011-07-27 17:09Eric NOULARDNote Added: 0027087
2011-07-27 19:59Mikhail TitovNote Added: 0027091
2011-07-28 03:36Eric NOULARDNote Added: 0027093
2011-08-19 19:53Mikhail TitovNote Added: 0027251
2012-06-15 02:28Eric NOULARDRelationship addedrelated to 0012997
2012-08-11 21:42David ColeStatusnew => backlog
2012-08-11 21:42David ColeNote Added: 0030442
2016-06-10 14:28Kitware RobotNote Added: 0041866
2016-06-10 14:28Kitware RobotStatusbacklog => resolved
2016-06-10 14:28Kitware RobotResolutionopen => moved
2016-06-10 14:28Kitware RobotAssigned To => Kitware Robot
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0027084)
Mikhail Titov   
2011-07-27 15:50   
Here is the workaround. One may add the following line after setting CPACK_OUTPUT_FILE_NAME :

set( CPACK_TEMPORARY_PACKAGE_FILE_NAME ${CMAKE_BINARY_DIR}/_CPack_Packages/win32/NSIS/${CPACK_OUTPUT_FILE_NAME} )

Looks ugly but it works.
For some reason the following doesn't work

set( CPACK_TEMPORARY_PACKAGE_FILE_NAME ${CPACK_TOPLEVEL_DIRECTORY}${CPACK_OUTPUT_FILE_NAME} )

as CPACK_TOPLEVEL_DIRECTORY is not defined at this moment(?)
(0027085)
Mikhail Titov   
2011-07-27 15:54   
(edited on: 2011-07-27 15:55)
I'm not sure if this will break anything

diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index 7e5b26d..cd38b3b 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -1055,7 +1055,7 @@ int cmCPackGenerator::DoPackage()
     {
     std::string tmpPF(this->GetOption("CPACK_OUTPUT_FILE_PREFIX"));
     tempPackageFileName = it->c_str();
- tmpPF += "/"+cmSystemTools::GetFilenameName(*it);
+ tmpPF += "/"+this->GetOption("CPACK_OUTPUT_FILE_NAME");
     packageFileName = tmpPF.c_str();
     cmCPackLogger(cmCPackLog::LOG_DEBUG, "Copy final package(s): "
         << (tempPackageFileName ? tempPackageFileName : "(NULL)" )

(0027087)
Eric NOULARD   
2011-07-27 17:09   
Hi Mikhail,

Try at least to run CPack related tests:

cd <CMAKE_BUILD_TREE>
ctest -R CPack

then you'll see what happen.

Regarding
"as CPACK_TOPLEVEL_DIRECTORY is not defined at this moment(?) "

because this is defined at "CPack-time" i.e. when CPack runs
when not at "CMake-time".

you may [probably]
set( CPACK_TEMPORARY_PACKAGE_FILE_NAME ${CPACK_TOPLEVEL_DIRECTORY}${CPACK_OUTPUT_FILE_NAME} )

from within a CPACK_PROJECT_CONFIG_FILE
http://www.cmake.org/Wiki/CMake:CPackPackageGenerators#Overall_usage_.28common_to_all_generators.29 [^]

but not in your CMakeLists.txt.
(0027091)
Mikhail Titov   
2011-07-27 19:59   
While I can't add two char*, the following did compile:

diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index 7e5b26d..a3fa6da 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -1055,7 +1055,8 @@ int cmCPackGenerator::DoPackage()
     {
     std::string tmpPF(this->GetOption("CPACK_OUTPUT_FILE_PREFIX"));
     tempPackageFileName = it->c_str();
- tmpPF += "/"+cmSystemTools::GetFilenameName(*it);
+ tmpPF += "/";
+ tmpPF += this->GetOption("CPACK_OUTPUT_FILE_NAME");
     packageFileName = tmpPF.c_str();
     cmCPackLogger(cmCPackLog::LOG_DEBUG, "Copy final package(s): "
         << (tempPackageFileName ? tempPackageFileName : "(NULL)" )

However I got this:

C:\workspace\CMake.build>"\Program Files\CMake 2.8\bin\ctest.exe" -R CPack
Test project C:/workspace/CMake.build
Guessing configuration NoConfig
    Start 82: CPackComponents
1/6 Test 0000082: CPackComponents ............................. Passed 40.05 sec

    Start 83: CPackComponentsForAll-ZIP-default
2/6 Test #83: CPackComponentsForAll-ZIP-default ........... Passed 16.63 sec

    Start 84: CPackComponentsForAll-ZIP-OnePackPerGroup
3/6 Test 0000084: CPackComponentsForAll-ZIP-OnePackPerGroup ...***Failed 23.47 sec

    Start 85: CPackComponentsForAll-ZIP-IgnoreGroup
4/6 Test 0000085: CPackComponentsForAll-ZIP-IgnoreGroup .......***Failed 11.92 sec

    Start 86: CPackComponentsForAll-ZIP-AllInOne
5/6 Test 0000086: CPackComponentsForAll-ZIP-AllInOne .......... Passed 11.44 sec

    Start 87: CPackTestAllGenerators
6/6 Test #87: CPackTestAllGenerators ...................... Passed 21.27 sec


67% tests passed, 2 tests failed out of 6

Total Test time (real) = 125.89 sec

The following tests FAILED:
         84 - CPackComponentsForAll-ZIP-OnePackPerGroup (Failed)
         85 - CPackComponentsForAll-ZIP-IgnoreGroup (Failed)
Errors while running CTest
(0027093)
Eric NOULARD   
2011-07-28 03:36   
Yeah,

meaning the change is not valid,..yet :-(
If you want to take some time to learn the CPack code
I'll help you and I'm pretty sure you'll be able to
produce a valid patch.

Are you willing to try that road?
(0027251)
Mikhail Titov   
2011-08-19 19:53   
Well, I realized that I can use existing methods to generate output name that I like more or less. CMake sources is a good reference how to get most of it. I guess this issue can be closed as invalid as CPACK_OUTPUT_FILE_NAME is not mentioned in documentation IIRC anyway.
(0030442)
David Cole   
2012-08-11 21:42   
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.
(0041866)
Kitware Robot   
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.