View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0012935CMakeCPackpublic2012-02-05 06:382012-07-09 06:52
ReporterHong Xu 
Assigned ToEric NOULARD 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformMicrosoft Visual C++, OpenWatcomOSWindowsOS VersionVista
Product VersionCMake 2.8.7 
Target VersionCMake 2.8.8Fixed in VersionCMake 2.8.8 
Summary0012935: When CPACK_INCLUDE_TOPLEVEL_DIRECTORY is set to 1, the NSIS generator is always failed to be initialized
DescriptionWhen set CPACK_INCLUDE_TOPLEVEL_DIRECTORY to 1 in the CMakeLists.txt, "nmake package" or "wmake package" (not tried other compilers) will lead to the following output:

CPack Error: NSIS Generator cannot work with CPACK_INCLUDE_TOPLEVEL_DIRECTORY. This option will be ignored.
CPack Error: Cannot initialize the generator NSIS


As long as it says this option will be ignored, the error should not be caused.

I have NSIS installed on my machine. The original source tree could be found here:

https://github.com/editorconfig/editorconfig/zipball/90978de4e2bfcdf6577ceb54edba9a044f10c5ba [^]
Steps To ReproduceDownload the source tree: https://github.com/editorconfig/editorconfig/zipball/90978de4e2bfcdf6577ceb54edba9a044f10c5ba [^]

Note that in the root CMakeLists.txt, CPACK_INCLUDE_TOPLEVEL_DIRECTORY is set to 1.

Execute: cmake -G "NMake Makefiles" .

Execute: nmake
Execute: nmake package

Then the output is:

CPack Error: NSIS Generator cannot work with CPACK_INCLUDE_TOPLEVEL_DIRECTORY. This option will be ignored.
CPack Error: Cannot initialize the generator NSIS
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0028474)
Eric NOULARD (developer)
2012-02-05 07:25

Hi Hong,

This is fixable (see my next note).
However I have question, for which generator are you setting
CPACK_INCLUDE_TOPLEVEL_DIRECTORY to 1?

All Archive do that by themselves and others (RPM, DEB, NSIS,...)
usually don't need that nor support it.

If you have good reason to do that, you can always
do [CPack] generator specific action using a
CPACK_PROJECT_CONFIG_FILE
see
http://www.cmake.org/Wiki/CMake:CPackPackageGenerators#Overall_usage_.28common_to_all_generators.29 [^]
(0028475)
Eric NOULARD (developer)
2012-02-05 07:26

For CMake dev:

I have just pushed a possible
fix to stage/CPackNSIS-fixIgnore-INCLUDE_TOPLEVEL:

To git@cmake.org:stage/cmake.git
 * [new branch] HEAD -> CPackNSIS-fixIgnore-INCLUDE_TOPLEVEL

The fix is simple.
Avoid LOG_ERROR in this case and use LOG_WARNING in order to avoid
final failure.

I did test it in a cross-compiling env. but I let you decide
if it's ok to merge. My doubt about that fix was whether if
forcing CPACK_INCLUDE_TOPLEVEL_DIRECTORY would leak to next
generator if a serie of them was used.

It looks like we create a new cmMakefile for each CPack generator
so this is safe. Nevertheless I let you review it, before merging
to next.
(0028478)
Hong Xu (reporter)
2012-02-05 09:14

Hi Eric,

I think that zip, tarball generators may need CPACK_INCLUDE_TOPLEVEL_DIRECTORY set to 1.

I'll try CPASCK_PROJECT_CONFIG_FILE. Thanks!
(0028479)
Eric NOULARD (developer)
2012-02-05 09:25

Hi Hong,

zip and tarball are CPack Archive Generator
family (they all rely on libarchive).
The archive generator family do set
"CPACK_INCLUDE_TOPLEVEL_DIRECTORY" internally
if the user did not set it, so that you don't need
to set it to 1.

With you current usage I think you may just
don't set CPACK_INCLUDE_TOPLEVEL_DIRECTORY
to any value
(just remove any
 set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY ...)
 line)
in your CMakeLists.txt and you'll get what you need.

If not then you'd better use CPACK_PROJECT_CONFIG_FILE.
(0028480)
Hong Xu (reporter)
2012-02-05 09:36

Thanks! I removed this variable and the previous problem disappears. However, a new problem came. The output is:

CPack Error: Problem creating temporary directory: D:/Users/xxx/Documents/src/editorconfig/build/_CPack_Packag
es/Windows-x86/NSIS/editorconfig-0.2.0-Windows-x86/C:/Program Files/editorconfig
CPack Error: Error when generating package: editorconfig
NMAKE : fatal error U1077: 'echo' : return code '0x1'

This should be different from this issue. I'll take a look at this and if I should, I'll open a new issue.
(0028481)
Hong Xu (reporter)
2012-02-05 09:39

BTW, maybe the default value of CPACK_INCLUDE_TOPLEVEL_DIRECTORY could be written to this wiki page:

http://www.vtk.org/Wiki/CMake:CPackConfiguration [^]

Thus users could know this.
(0028482)
Eric NOULARD (developer)
2012-02-05 09:58

You should NOT
set(CPACK_SET_DESTDIR "ON")
unless you really know what you are doing.

In any case this won't work for NSIS,
and may be not at all on Windows.

Concerning the documentation of CPack variables,
we are working on it, see 0010067
(0028483)
Hong Xu (reporter)
2012-02-05 11:20

OK, I understand. Thanks very much.
(0028532)
Eric NOULARD (developer)
2012-02-08 18:43

Initial problem solved by better usage from the user.
And initial error is now a warning with this:
Merge topic 'CPackNSIS-fixIgnore-INCLUDE_TOPLEVEL' into next

6a74eb1 CPackNSIS fix 0012935 switch from LOG_WARNING to avoid final error.
(0029968)
David Cole (manager)
2012-07-09 06:52

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2012-02-05 06:38 Hong Xu New Issue
2012-02-05 07:16 Eric NOULARD Assigned To => Eric NOULARD
2012-02-05 07:16 Eric NOULARD Status new => assigned
2012-02-05 07:25 Eric NOULARD Note Added: 0028474
2012-02-05 07:26 Eric NOULARD Note Added: 0028475
2012-02-05 09:14 Hong Xu Note Added: 0028478
2012-02-05 09:25 Eric NOULARD Note Added: 0028479
2012-02-05 09:26 Eric NOULARD Severity major => minor
2012-02-05 09:26 Eric NOULARD Target Version => CMake 2.8.8
2012-02-05 09:36 Hong Xu Note Added: 0028480
2012-02-05 09:39 Hong Xu Note Added: 0028481
2012-02-05 09:58 Eric NOULARD Note Added: 0028482
2012-02-05 11:21 Hong Xu Note Added: 0028483
2012-02-08 18:43 Eric NOULARD Note Added: 0028532
2012-02-08 18:43 Eric NOULARD Status assigned => resolved
2012-02-08 18:43 Eric NOULARD Fixed in Version => CMake 2.8.8
2012-02-08 18:43 Eric NOULARD Resolution open => fixed
2012-07-09 06:52 David Cole Note Added: 0029968
2012-07-09 06:52 David Cole Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team