View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0015696CMakeCPackpublic2015-08-13 15:102016-01-04 11:52
ReporterClinton Stimpson 
Assigned ToClinton Stimpson 
PrioritynormalSeverityminorReproducibilityhave not tried
StatusclosedResolutionfixed 
PlatformOSOS Version
Product VersionCMake 3.3 
Target VersionCMake 3.4Fixed in VersionCMake 3.4 
Summary0015696: cpack preinstall of subdirectory no longer works
DescriptionFor one cpack config file, I want to package up only a certain subdirectory.
For that, I set CPACK_INSTALL_CMAKE_PROJECTS


SET(CPACK_INSTALL_CMAKE_PROJECTS ${CMAKE_CURRENT_BINARY_DIR} MyProject "ALL" "/" )
INCLUDE(CPack)


When I run cpack, I get the following error:
CPack Error: Problem running install command: /usr/local/bin/cmake --build . --target "preinstall"
Please check /home/cjstimp/cmake/test-cpack-subdir/build/_CPack_Packages/Linux/ZIP/PreinstallOutput.log for errors
Steps To ReproduceUse the attached example project.

From the build directory, run

cpack -G ZIP .
Additional InformationGit bisect reveals this commit introduced the error.

93a3ec8b7705c6edfa08a59a789d193fcb4cf4c1 is the first bad commit
commit 93a3ec8b7705c6edfa08a59a789d193fcb4cf4c1
Author: Brad King <brad.king@kitware.com>
Date: Tue Mar 31 10:26:29 2015 -0400

    CPack: Fix make tool selection during preinstall (0015483)
TagsNo tags attached.
Attached Filesgz file icon test-cpack-subdir.tar.gz [^] (489 bytes) 2015-08-13 15:10

 Relationships

  Notes
(0039278)
Brad King (manager)
2015-08-13 15:21

IIUC this is specific to the Makefile generators because other generators do not support subdirectory builds.

We have to use "cmake --build ." to address 0015483, so fixing this will require teaching "cmake --build ." how to run "make" in a subdirectory when run the way CPack runs it in this case. It will have to detect that the given directory is a subdirectory by searching up for a CMakeCache.txt file.
(0039279)
Clinton Stimpson (developer)
2015-08-13 15:33

By the way, I had also been doing this with the Visual Studio generator, so it is not just the Makefile generator.

For the example to work under Visual Studio, a project() in the subdirectory would need to be added, and CPACK_INSTALL_CMAKE_PROJECTS would include that sub project name.

Would your suggested fix work in this case?

I also don't mind it running preinstall in the root directory instead of a subdirectory, if that means we can support all generators. Can't we make all generators work at each project level (where a project() call is used)?

Or does "PROJECTS" in CPACK_INSTALL_CMAKE_PROJECTS refer to something else?
(0039280)
Brad King (manager)
2015-08-13 15:45

Re 0015696:0039279: In both cases we need to find the CMakeCache.txt file to know what generator is in use. To avoid searching from arbitrary locations we should at least verify that the current directory has a CMakeFiles/ subdirectory before searching up. Once we have the CMakeCache.txt file we can load it to get the generator and construct the build command (as is done already). However, we can then run the build command in the originally specified directory.
(0039290)
Brad King (manager)
2015-08-17 10:22

I see commit:

 cmake: Add support for "--build ." in subdirectory
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ba1065ab [^]

Thanks. Does that resolve this issue? Is the proper command line now constructed?
(0039291)
Clinton Stimpson (developer)
2015-08-17 11:02

Yes, with that commit, this bug is now resolved.
I've tested under both Visual Studio and Makefiles.
(0040116)
Robert Maynard (manager)
2016-01-04 11:52

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

 Issue History
Date Modified Username Field Change
2015-08-13 15:10 Clinton Stimpson New Issue
2015-08-13 15:10 Clinton Stimpson File Added: test-cpack-subdir.tar.gz
2015-08-13 15:15 Brad King Product Version => CMake 3.3
2015-08-13 15:15 Brad King Summary cpack preinstall of subdirectory regression in 3.3 => cpack preinstall of subdirectory no longer works
2015-08-13 15:15 Brad King Description Updated
2015-08-13 15:21 Brad King Note Added: 0039278
2015-08-13 15:21 Brad King Assigned To => Clinton Stimpson
2015-08-13 15:21 Brad King Status new => assigned
2015-08-13 15:33 Clinton Stimpson Note Added: 0039279
2015-08-13 15:45 Brad King Note Added: 0039280
2015-08-17 10:22 Brad King Note Added: 0039290
2015-08-17 11:02 Clinton Stimpson Note Added: 0039291
2015-08-18 10:12 Brad King Status assigned => resolved
2015-08-18 10:12 Brad King Resolution open => fixed
2015-08-18 10:12 Brad King Fixed in Version => CMake 3.4
2015-08-18 10:12 Brad King Target Version => CMake 3.4
2016-01-04 11:52 Robert Maynard Note Added: 0040116
2016-01-04 11:52 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team