[CMake] Environment variable for a custom command

David Cole david.cole at kitware.com
Fri Aug 15 12:05:12 EDT 2008


Make that "cmake -P" (not cmake -S)     -S is the run this script arg to
ctest...


On Fri, Aug 15, 2008 at 11:45 AM, Bill Hoffman <bill.hoffman at kitware.com>wrote:

> Gregory C. Sharp wrote:
>
>> Bill Hoffman wrote:
>>
>>> Gregory C. Sharp wrote:
>>>
>>>>
>>>> I found this little tidbit in the FAQ:
>>>>
>>>>  [E]nvironment variables SET in the CMakeLists.txt only take
>>>>  effect for cmake itself, so you cannot use this method to set
>>>>  an environment variable that a custom command might need.
>>>>
>>>> I would like to augment the path during a custom command.
>>>> Is there a suggested workaround?
>>>>
>>>>  Run a cmake script in the custom command that runs the program via
>>> execute_process.
>>>
>>
>> OK.  I might need another hint though.  I try this:
>>
>>  MACRO(RUNME)
>>    EXECUTE_PROCESS(...)
>>  ENDMACRO(RUNME)
>>
>>  ADD_CUSTOM_COMMAND(OUTPUT output COMMAND RUNME ...)
>>
>> Which yields:
>>
>>  1> 'RUNME' is not recognized as an internal or external command
>>
>> -Greg
>>
> add_custom_command(OUTPUT output COMMAND ${CMAKE_COMMAND} -S
> myscript.cmake)
>
> myscript.cmake:
> set(ENV{PATH} ...)
> execute_process(....)
>
>
> -Bill
>
> --
> Bill Hoffman
> Kitware, Inc.
> 28 Corporate Drive
> Clifton Park, NY 12065
> bill.hoffman at kitware.com
> http://www.kitware.com
> 518-371-3971 (phone and fax)
>
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20080815/76a93569/attachment.htm>


More information about the CMake mailing list