View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0002922CMakeCMakepublic2006-02-28 17:392006-10-05 12:16
ReporterSebastien Barre 
Assigned ToBrad King 
PrioritynormalSeverityfeatureReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0002922: Installation fails too easily
DescriptionHere is my problem.

I build some examples as part of the KWWidgets library. When I trigger the "install" target, the library gets installed, the examples as well, for educational purposes.

Now my problem is that if an example (say, FOO) failed to build (say, it was depending on an external library like ITK that failed to build that night, but is *not used* by the library itself), then when I try to install the whole thing, the library fails to install because the install process fails as soon as any error occurs (in my case, it fails because it can not find the example FOO to install, which never built correctly).

So at the end of the day the library is not installed correctly, when ultimately it's actually *not* that important that the examples are not installed properly.

I checked the cmake_install.cmake file for that specific example, and got something like:

FILE(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/bin" TYPE EXECUTABLE FILES "/home/barre/build/my dashboards/KWWidgets/Nightly/KWWidgets-Linux-gcc4.0-dbg-ITK-SOV/bin/KWSOViewerExample")

I checked the documentation for cmFileCommand.h, nothing about the "INSTALL" mode, so I checked the C++, and it's there, and I see it accepts an "OPTIONAL" parameter that prevents the installation from failing if the file was not found. Exactly what I need I guess, but apparently there is nowhere to set that flag from a CMakeLists.txt file. What about a target property flag ? Or better yet, directly in INSTALL_TARGETS. Say, something like:
INSTALL_TARGETS(${KWWidgets_INSTALL_BIN_DIR} FOOExample OPTIONAL)

Thanks
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0003816)
Sebastien Barre (reporter)
2006-02-28 17:39

Note that this problem seem to happen in the CVS too.
(0005154)
Bill Hoffman (manager)
2006-10-04 13:40

Is this still an issue?
(0005162)
Brad King (manager)
2006-10-04 14:11

I don't agree with this bug. If examples fail to build perhaps there is a problem with the libraries too.
(0005169)
Sebastien Barre (reporter)
2006-10-04 14:24

As I said, the problem is with an external library, not with a library I'm building. The library I'm building built fine, and that's *why* I want it to be installed, despite the examples failing to build.
(0005241)
Brad King (manager)
2006-10-05 10:04

So turn off the examples and then install. There is no way CMake can know that what failed to build is meant only as an example, or that it failed because of an outside library. If part A of a project builds and part B doesn't installing part A by itself may not be safe.
(0005242)
Sebastien Barre (reporter)
2006-10-05 10:18

> There is no way CMake can know that what failed to build is meant only as an example,

That's why I sugggested an OPTIONAL flag.

> that it failed because of an outside library.

Doesn't CMake knows which library this example depends on ? And the libraries being built in the project ?

> If part A of a project builds and part B doesn't
> installing part A by itself may not be safe.

Hence the OPTIONAL flag. Cmon, let's be reasonable here, the library built fine, I want it to be installed. The example may or may not depending on external libs, and I would rather they are installed, but if not I would like my libs to be installed and keep on going...
If the examples were not built because some option was OFF, or there was just no examples, and the library built fine, you could also say that it does not guarantee the library is working fine and should not be installed...
(0005243)
Brad King (manager)
2006-10-05 10:28

The problem with implementing this is that the "install" target depends on the "all" target. The build tool will see that "all" failed to build and then not run the install target at all. CMake won't even get a chance to decide to do the optional install.
(0005247)
Sebastien Barre (reporter)
2006-10-05 10:43

Oh I know what the problem is :) It's the solution I'm more interested in :)

It's a real world problem. The KWWidgets dashboard *is* complex, and stresses way more installation scenarios than VTK or CMake. Now you guys don't have to solve it, but the problem exists, so I just put it in the bug tracker.

Maybe the install target should not depend on the all target, or it could be split?

I mean, guys, think about it in a simple way from a simple (dumb) user point of view for a minute: inside a *simple* CMake file, I have something like:
  ADD_LIBRARY(foo...)
  INSTALL_TARGETS(foo...)
So it's pretty clear what I want to do: build the library and install it, i.e. if the library built fine, just install it! Now some dingbat later on add an example to this project, deep in the tree, and sudently just because he added an exemple that may or may not build correctly, my library does not install anymore...

I know this behavior of "I'm gonna install only if everything was fine" is something you've come to expect from build systems in the past, but cmon, it's CMake we are talking about :), there gotta be a way to do it smarter, not in the old computer-science-thinking way...
(0005249)
Brad King (manager)
2006-10-05 11:34

Okay, I've added an OPTIONAL option to the INSTALL command. See the command help for details. This will be in 2.4.4, but please try it in the CVS version to make sure it does what you need.

You can avoid the install->all dependency like this:

SET(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY 1)

or just add it to your cache with -D on the cmake command line. Alternatively you can not build the examples as part of all using the new EXCLUDE_FROM_ALL feature:

ADD_CUSTOM_TARGET(build_examples)
ADD_EXECUTABLE(myexample EXCLUDE_FROM_ALL ex.cxx)
ADD_DEPENDENCIES(build_examples myexample)

This will skip building the example as part of all but allow the user to build it by running "make build_examples" or building the target explicitly in VS.

/cvsroot/CMake/CMake/Source/cmInstallCommand.cxx,v <-- cmInstallCommand.cxx
new revision: 1.19; previous revision: 1.18
/cvsroot/CMake/CMake/Source/cmInstallCommand.h,v <-- cmInstallCommand.h
new revision: 1.16; previous revision: 1.15
/cvsroot/CMake/CMake/Source/cmInstallFilesGenerator.cxx,v <-- cmInstallFilesGenerator.cxx
new revision: 1.6; previous revision: 1.5
/cvsroot/CMake/CMake/Source/cmInstallFilesGenerator.h,v <-- cmInstallFilesGenerator.h
new revision: 1.6; previous revision: 1.5
/cvsroot/CMake/CMake/Source/cmInstallTargetGenerator.cxx,v <-- cmInstallTargetGenerator.cxx
new revision: 1.21; previous revision: 1.20
/cvsroot/CMake/CMake/Source/cmInstallTargetGenerator.h,v <-- cmInstallTargetGenerator.h
new revision: 1.9; previous revision: 1.8
confused about file cmInstallGenerator.h -- ignoring
confused about file cmInstallGenerator.cxx -- ignoring
/cvsroot/CMake/CMake/Tests/SimpleInstall/CMakeLists.txt,v <-- CMakeLists.txt
new revision: 1.69; previous revision: 1.68
(0005256)
Sebastien Barre (reporter)
2006-10-05 12:16

sweet thanks I'll try it (the medical team is a little swamped right now)

 Issue History
Date Modified Username Field Change


Copyright © 2000 - 2018 MantisBT Team