So, it seems it is not possible to have CMake NOT to use absolute paths Quote
“CMake does always use absolute paths. It's part of the concept.” https://stackoverflow.com/questions/45856955/how-to-tell-cmake-to-use-relative-paths One use case: 1) I have a Cmake script and I generate a Visual Studio project on machine 1 2) I have another high security computer, machine 2, where I don’t have administrator privileges To install software and CMake is on the list of “not approved” software. 3) I can copy the generated Visual Studio project from machine 1 to machine 2… But …alas, all miserably fails to compile because the paths are all wrong One solution I have used in the past for small projects, like 1 project file, was to manually edit the .vcxproj Visual Studio file For example replace this <AdditionalIncludeDirectories>F:\wt.leaflet\wt-4.0.1\src\3rdparty\gason\src; With a relative path <AdditionalIncludeDirectories>..\..\..\3rdparty\gason\src; Which works perfectly (also remove all the CMake generated things, it’s really not needed after the project is made), but for projects where the number of generated projects Is more than 40, this is not a good way to spend our time Of course , doing a dedicated program that does this replacement for us Would be ideal So, question, does anyone know of the existence of this program? Also, this post circa 2008 says there was a “CMAKE_USE_RELATIVE_PATHS” That seems to have been deprecated “If you set CMAKE_SUPPRESS_REGENERATION to true, and CMAKE_USE_RELATIVE_PATHS to true, you might get things to work for a small project. “ would this work? Of course I would have to travel back in time to 2008, but that’s another problem https://cmake.org/pipermail/cmake/2008-March/020629.html I quote here the original post on this thread, “I cant help but comment that this is unnecessarily complicated when all that is desired is simply compiling without the Cmake dependency. Conceptually it should not be this hard. “ Yes, it should not be this hard for Cmake to have an *OPTION* to use relative paths, maybe ? http://pedro-vicente.net/
-- 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: https://cmake.org/mailman/listinfo/cmake