[cmake-developers] [CMake 0014444]: INSTALL TARGET command does not work with targets outside the current directory

Mantis Bug Tracker mantis at public.kitware.com
Thu Sep 26 18:14:28 EDT 2013


The following issue has been SUBMITTED. 
====================================================================== 
http://www.cmake.org/Bug/view.php?id=14444 
====================================================================== 
Reported By:                Blaise Gassend
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   14444
Category:                   (No Category)
Reproducibility:            have not tried
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2013-09-26 18:14 EDT
Last Modified:              2013-09-26 18:14 EDT
====================================================================== 
Summary:                    INSTALL TARGET command does not work with targets
outside the current directory
Description: 
If you try to INSTALL TARGET a target that was defined in a different directory,
CMake fails with an error. 

This is behaviour is really annoying. We are trying to install only libraries
that get used by executables that need to be installed. However, if the library
and executable are defined in different directories, this bug prevents you from
INSTALLing the library at the place where you know you need to install it. Using
INSTALL FILES partially works, but causes stripping and rpath changing to break,
as CMake no longer recognizes the library as a library.

If this behaviour is a feature, it would be really nice to have documentation of
why it is a feature. (I can't seem to be able to define targets with the same
name in different directories, so why on earth would INSTALL TARGETS be the only
command that only considers 

Steps to Reproduce: 
I'll attach a tarball for a directory that reproduces this. To reproduce:

cd cmake_deb_test
mkdir build
cd build
cmake ..

[ret=2] blaise at bnl: /st/stor1/blaise/work/cmake_deb_test/build $ cmake ..
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/lib/ccache/gcc
-- Check for working C compiler: /usr/lib/ccache/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
m-- Check for working CXX compiler: /usr/lib/ccache/c++
ak-- Check for working CXX compiler: /usr/lib/ccache/c++ -- works
-- Detecting CXX compiler ABI info
e -- Detecting CXX compiler ABI info - done
CMake Error at CMakeLists.txt:10 (install):
  install TARGETS given target "mylib2" which does not exist in this
  directory.


-- Configuring incomplete, errors occurred!


Additional Information: 
The following patch fixes the problem. I don't understand the cmake philosophy
enough to know if it hopelessly breaks something else though.


Description: INSTALL TARGETS will find non-local targets
 .
 cmake (2.8.7-0ubuntu5) precise-proposed; urgency=low
 .
   * Fix corrupted tarballs when using DEB generator in CPack.
     (LP: http://www.cmake.org/Bug/view.php?id=972419)
Author: David Dunsmore <david.dunsmore at sbl-dd-laptop1.seebyte.com>
Bug-Ubuntu: https://bugs.launchpad.net/bugs/972419
 
---
The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: <vendor|upstream|other>, <url of original patch>
Bug: <url in upstream bugtracker>
Bug-Debian: http://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: <no|not-needed|url proving that it has been forwarded>
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: <YYYY-MM-DD>

--- cmake-2.8.7.orig/Source/cmInstallCommand.cxx
+++ cmake-2.8.7/Source/cmInstallCommand.cxx
@@ -350,8 +350,8 @@ bool cmInstallCommand::HandleTargetsMode
       targetIt!=targetList.GetVector().end();
       ++targetIt)
     {
-      // Lookup this target in the current directory.
-      if(cmTarget* target=this->Makefile->FindTarget(targetIt->c_str()))
+      // Lookup this target 
+      if(cmTarget* target=this->Makefile->FindTargetToUse(targetIt->c_str()))
         {
         // Found the target.  Check its type.
         if(target->GetType() != cmTarget::EXECUTABLE &&
@@ -373,7 +373,7 @@ bool cmInstallCommand::HandleTargetsMode
         // Did not find the target.
         cmOStringStream e;
         e << "TARGETS given target \"" << (*targetIt)
-          << "\" which does not exist in this directory.";
+          << "\" which does not exist.";
         this->SetError(e.str().c_str());
         return false;
         } 

====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2013-09-26 18:14 Blaise Gassend New Issue                                    
2013-09-26 18:14 Blaise Gassend File Added: cmake_deb_test.tgz                  
 
======================================================================




More information about the cmake-developers mailing list