[CMake] The project files that CMake generates can't be moved

Attila Krasznahorkay attila.krasznahorkay at gmail.com
Fri Oct 30 13:48:33 EDT 2015


Hi,

I'm a bit surprised about this answer.

Sure, build areas are not to be moved around. I completely agree. But this is why we have the concept of installing releases. As long as you configure your build correctly, you should be able to move around your install directory. As the binaries by default will not have absolute paths in them after installation. At least not to "themselves".

(I am myself working these days on how to install larger projects such that after installation, after moving the installed directories around, including the directories that the build was done against, the code would still work. It's not trivial to do, but it's not impossible either. One just has to use $<INSTALL_INTERFACE:...> in a clever way...)

Cheers,
           Attila

> On 30 Oct 2015, at 11:59, Nils Gladitz <nilsgladitz at gmail.com> wrote:
> 
> On 10/30/2015 11:32 AM, 李荣贵_dongnan wrote:
>> 
>> Recently, I use CMake to build the source code of a software in the platform of windows and I make it. However, I found if I move the whole file to other place, some errors will take place when the program run. According to the prompt information, I know CMake uses absolute path when building. Then I read a lot of relevant datum on the net. One solution is to open the variable “CMAKE_USE_RELATIVE_PATHS”. I have tried it and it doesn’t work. Someone also say this problem has not been effectively solved yet. I want to make this problem clear, so I decide to write this email.
>> 
> 
> CMAKE_USE_RELATIVE_PATHS has been removed from CMake [1]. Even before that its use was not recommended.
> CMake build directories are not meant to be transferable or moved around; if you need a build in a different location you will have to rerun cmake / the build there.
> 
> Nils
> 
> [1] https://cmake.org/gitweb?p=cmake.git;a=commit;h=1335992c8f4e8b96f1a21d5dcc7d65a9fbd84c11
> -- 
> 
> 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



More information about the CMake mailing list