[Changing subject in order to keep the conversation separate]

On 23/07/14 20:39, Brad King wrote:
>>> Since you were asking if CMake misses some important feature, I believe
>>> that a very useful feature to have would be to be able to have an option
>>> for the install(FILES/PROGRAMS/DIRECTORY) command that reproduces the
>>> install tree in the binary directory
>>
>> Yes, seems like something worth investigating.
> 
> I don't think we need to have a build tree, install-in-build-tree, and
> install-tree all managed by a single build tree.  Things like
> INSTALL_RPATH do not make sense when there are two possible "install"
> locations.  An install-in-build-tree directory is not easily defined
> in multi-config generators.


Sorry, maybe I didn't explain the problem properly, there are no "build
tree", "install-in-build-tree", and "install-tree", but only "build
tree" and "install-tree"

I'm not referring to the installation of "TARGETS" (for which the rpath
and CMAKE_RUNTIME_OUTPUT_DIRECTORY[_<CONFIG>] and related variables are
enough), I'm referring to the "data files" (i.e. whatever usually goes
to <prefix>/share) that may or may not be generated by cmake or by the
build step (not as target but as configure_file or as a product of some
command) and are usually installed with
"install(FILES/PROGRAMS/DIRECTORY)". These files might not be related to
a target, therefore it might not make sense to "add" them to a target
and install them with the install(TARGET) call (like you could do with
PUBLIC_HEADERs and similar).

I think there are good reasons for copying the files, for example:

* Your program expects to find the data files in a certain relative path
or with a certain tree structure and you have some good reason for not
keeping them with the same structure in the source folder.
* You have some files that are coming from the source tree but some are
generated by CMake or produced during the build and the program expects
to find all of them in the same folder.

If these files are not in the expected place, the build tree might not
be usable, and the installation step would be required to use your project.


> If you want to test installation then set CMAKE_INSTALL_PREFIX to
> $build/prefix or something and use the normal "make install" target.

What I want to be able to do is not test the installation, but to be
able to use the library from the build tree.

Using an installation for testing different builds is more complicated,
because you will have to set a different CMAKE_INSTALL_PREFIX and to run
the install phase every time you make a change. Finally it will require
to set LD_LIBRARY_PATH environment variable, or to set
CMAKE_SKIP_INSTALL_RPATH cmake variable to FALSE.


> Some projects also arrange their layout within the build tree to look
> like the install tree by setting CMAKE_RUNTIME_OUTPUT_DIRECTORY[_<CONFIG>]
> and related variables appropriately.

That's exactly what I would like to be able to do, but for "data files"
as well, and at the moment that is possible, but not in an easy way.



Cheers,
 Daniele

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to