[CMake] Relative path to CMAKE_SOURCE_DIR

J Decker d3ck0r at gmail.com
Fri Oct 9 18:15:41 EDT 2015


something like ... ?
file(RELATIVE_PATH variable directory file)


On Fri, Oct 9, 2015 at 2:09 PM, Howard Rubin
<howard.rubin at hl.konicaminolta.us> wrote:
> Is it possible to get the relative path from PROJECT_BINARY_DIR (or
> CMAKE_BINARY_DIR) to CMAKE_SOURCE_DIR?
>
>
>
> I’m using CMAKE_SOURCE_DIR to add files to *.csproj file (copied with
> configure_file) using CMake on Windows. This results in lots of warnings
> like the below that I’d like to get rid of. If I change the absolute path
> that’s inserted by CMake’s substitution of CMAKE_SOURCE_DIR to a relative
> path with dots (e.g. ..\..\somewhere) the warning goes away.
>
>
>
> Warning               43           The file
> 'D:/directory1/directory2/directory3\directory4\Open-XML-SDK\DocumentFormat.OpenXml\src\Framework\AlternateContent.cs'
> could not be added to the project.  The specified path contains invalid
> characters, is an absolute path, or is a path outside of the project
> directory. DocumentFormat.OpenXml
>
>
>
> References:
>
> https://cmake.org/cmake/help/v2.8.10/cmake.html#command:configure_file
>
> https://cmake.org/Wiki/CMake_Useful_Variables
>
>
>
>
> --
>
> 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