<div dir="ltr"><div><div><div><div>Hi Egor, <br><br></div>DESTINATION should be specified as relative path. I would also recommend to use COMPONENTS.<br><br></div>Finally, to know how to organize your files in the install package, I would suggest you look at the "Filesystem Hierarchy Standard". See <a href="http://www.pathname.com/fhs/pub/fhs-2.3.html">http://www.pathname.com/fhs/pub/fhs-2.3.html</a><br>

<br>For example, see [1] to have an idea of how we will organize the files within 3DSlicer to be compliant with the FHS.<br><br></div>Hth<br></div>Jc<br><div><div><br>[1] <a href="http://wiki.slicer.org/slicerWiki/index.php/Documentation/Labs/FHSCompliantDirectoryStructure">http://wiki.slicer.org/slicerWiki/index.php/Documentation/Labs/FHSCompliantDirectoryStructure</a><br>

</div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Jun 21, 2014 at 2:55 PM, Egor Tensin <span dir="ltr"><<a href="mailto:egor.tensin@gmail.com" target="_blank">egor.tensin@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">So you suggest that I define "full" relative paths in each CMakeLists.txt? Like<br>
<br>
install(TARGETS foo DESTINATION "bin/examples/lib1")<br>
<br>
instead of<br>
<br>
install(TARGETS foo DESTINATION "${INSTALL_PREFIX}/lib1")<br>
<br>
That's an option to consider, of course...<br>
<div class="HOEnZb"><div class="h5"><br>
On Sat, Jun 21, 2014 at 10:52 PM, J Decker <<a href="mailto:d3ck0r@gmail.com">d3ck0r@gmail.com</a>> wrote:<br>
> Install has a DESTINATION option; which should be used rather than modifying<br>
> what the install path is....<br>
> well I guess depends on the method... install( targets ) has 3 destinations,<br>
> LIBRARY_DESTINTION, RUNTIME_DESTINATION, (something)_DESTINATION for shared<br>
> library output<br>
><br>
><br>
> On Sat, Jun 21, 2014 at 11:14 AM, Egor Tensin <<a href="mailto:egor.tensin@gmail.com">egor.tensin@gmail.com</a>> wrote:<br>
>><br>
>> Hello,<br>
>><br>
>> I'm bothered with my approach to `install`ing CMake-enabled project<br>
>> components. The whole source tree is separated into "libs" and<br>
>> "examples" subdirectories, with a lot of libraries under the "libs"<br>
>> subdirectory and library usage examples under the "examples"<br>
>> subdirectory.<br>
>><br>
>> For example:<br>
>> .<br>
>> ├── examples<br>
>> │   ├── CMakeLists.txt<br>
>> │   ├── lib1<br>
>> │   │   ├── CMakeLists.txt<br>
>> │   │   ├── example1.cpp<br>
>> │   │   └── example2.cpp<br>
>> │   └── lib2<br>
>> │       ├── CMakeLists.txt<br>
>> │       └── example1.cpp<br>
>> └── libs<br>
>>     ├── CMakeLists.txt<br>
>>     ├── lib1<br>
>>     └── lib2<br>
>><br>
>> I would like to install the corresponding targets like this:<br>
>><br>
>> .<br>
>> ├── bin<br>
>> │   └── examples<br>
>> │       ├── lib1<br>
>> │       │   ├── example1.exe<br>
>> │       │   └── example2.exe<br>
>> │       └── lib2<br>
>> │           └── example1.exe<br>
>> └── lib<br>
>>     ├── lib1.lib<br>
>>     └── lib2.lib<br>
>><br>
>> At the moment I'm just defining a custom variable (say,<br>
>> INSTALL_PREFIX) in the highest-level CMakeLists.txt, and basically in<br>
>> each of the underlying CMakeLists.txt files append something to the<br>
>> variable. For example, in libs/CMakeLists.txt I use:<br>
>><br>
>> set(INSTALL_PREFIX "${INSTALL_PREFIX}/lib")<br>
>><br>
>> and in examples/CMakeLists.txt:<br>
>><br>
>> set(INSTALL_PREFIX "${INSTALL_PREFIX}/bin")<br>
>><br>
>> and in examples/lib1/CMakeLists.txt:<br>
>><br>
>> set(INSTALL_PREFIX "${INSTALL_PREFIX}/lib1")<br>
>><br>
>> I'm wondering if it's idiomatic, because at the moment I'm facing a<br>
>> few issues using this approach. For example, if I build & install only<br>
>> examples/lib1/example1.cpp, it gets installed to "lib1/" instead of<br>
>> "bin/examples/lib1".<br>
>><br>
>> Could you please share your best practices on installing project<br>
>> components or give me an advice on how to fix the issue(s) I'm facing?<br>
>><br>
>> Thank you,<br>
>> Egor Tensin.<br>
>> --<br>
>><br>
>> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
>><br>
>> Please keep messages on-topic and check the CMake FAQ at:<br>
>> <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
>><br>
>> Kitware offers various services to support the CMake community. For more<br>
>> information on each offering, please visit:<br>
>><br>
>> CMake Support: <a href="http://cmake.org/cmake/help/support.html" target="_blank">http://cmake.org/cmake/help/support.html</a><br>
>> CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" target="_blank">http://cmake.org/cmake/help/consulting.html</a><br>
>> CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" target="_blank">http://cmake.org/cmake/help/training.html</a><br>
>><br>
>> Visit other Kitware open-source projects at<br>
>> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
>><br>
>> Follow this link to subscribe/unsubscribe:<br>
>> <a href="http://public.kitware.com/mailman/listinfo/cmake" target="_blank">http://public.kitware.com/mailman/listinfo/cmake</a><br>
><br>
><br>
--<br>
<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
<br>
CMake Support: <a href="http://cmake.org/cmake/help/support.html" target="_blank">http://cmake.org/cmake/help/support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" target="_blank">http://cmake.org/cmake/help/consulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" target="_blank">http://cmake.org/cmake/help/training.html</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/cmake" target="_blank">http://public.kitware.com/mailman/listinfo/cmake</a></div></div></blockquote></div><br><br clear="all"><br>-- <br>+1 919 869 8849<br>
</div>