[CMake] INSTALL(TARGET ...) Target not in this folder

Aaron_Wright at selinc.com Aaron_Wright at selinc.com
Fri Jul 16 11:07:33 EDT 2010

I have sort of an interesting directory structure for my projects. I have 
a folder for libraries, a folder for executables, and a folder for 
packages. The packages folder contains debian packages that combine 
libraries and executables from the other two folders. So they look sort of 

IF(NOT TARGET executable_a)

        TARGET executable_a
        DESTINATION bin)

This then gets packaged up into a *.deb with the executable in it. Well, 
that's what I would like it to do. Unfortunately, INSTALL(TARGET is giving 
me an error about "executable_a" not being the current directory or 
something close to that. I can get around this by using:

        PROGRAM "${CMAKE_BINARY_DIR}/executable_a/executable_a"
        DESTINATION bin)

But this seems more brittle than the INSTALL(TARGET usage. What is the 
reasoning behind this error message? I don't understand why it shouldn't 
just work.

On a side note, I don't put the INSTALL(TARGET command in executable_a's 
folder because not everyone that ADD_SUBDIRECTORY on that folder wants 
executable_a to be installed. In fact this is the problem I was trying to 
solve by moving the INSTALL command up a level.

Aaron Wright
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100716/26b416c4/attachment.htm>

More information about the CMake mailing list