Hello,

I'm still trying to find a correct solution to handle user specified installation paths.

Let's consider two kind of paths:

  - WITH_BINDIR (default: bin/) where to install executables,
- WITH_DATADIR (default: share/project_name/) where to install extra data.

I want to let the user configuring those paths because not all distributions use the same paths (e.g. bin vs usr/bin).

Then, I also like to build the whole CMake project by creating the hierarchy as it would be installed like:

<binarydir>/WITH_BINDIR/myapp
<binarydir>/WITH_DATADIR/somestuff.txt

Using relative paths makes the application relocatable, if I keep WITH_BINDIR set as "bin" I can get the executable path at runtime, going through its parent (bin/../) and then I can go share/project_name. Obviously this is only valid for relative paths.

However, a very high number of package managers build programs by specifying absolute paths, it is not an issue: instead of getting the directories at runtime, I use directly the absolute ones.

On unix it can still work because it will just be translated as:

<binarydir>/usr/local/bin/myapp
<binarydir>/usr/local/share/project_name/somestuff.txt

This is much bigger an issue on Windows if the user set WITH_BINDIR to something like D:/alt/bin

The path would be translated to

<binarydir>D:/alt/bin

which is invalid on Windows.

I like very much having this kind of `fakeroot' directory where you can have a preview on how the project looks like but I don't know what to do if paths are absolute, especially on Windows.

What are your thoughts on that, recommandations?

Regards,

--
David Demelier
--

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

Reply via email to