[CMake] EXECUTE_PROCESS and relative path

Philip Lowman philip at yhbt.com
Sun Dec 20 11:04:31 EST 2009


On Sun, Dec 20, 2009 at 10:53 AM, Steve Chu <stvchu at gmail.com> wrote:
> Does EXECUTE_PROCESS support relative path to CMakeLists.txt file?
>
> Suppose we have this demo:
>
> EXECUTE_PROCESS(
>  COMMAND /bin/cat ./xxx
>  # WORKING_DIRECTORY /some/absolute/path
> )
>
> If we do not set WORKING_DIRECTORY to absolute path, this command does not work.
> But I do not want to introduce a fixed absolute path(or ENV) that is
> up to who builds the project.
>
> So does cmake have a feature of relative path? Such as:
> EXECUTE_PROCESS(
>  COMMAND /bin/cat RELATIVE{./xxx}
> )
>
> here RELATIVE means relative to CMakeLists.txt file.

You can use ${CMAKE_CURRENT_SOURCE_DIR} and the path relative to that.

http://www.cmake.org/Wiki/CMake_Useful_Variables

-- 
Philip Lowman


More information about the CMake mailing list