Compile time env settings may most easily be achieved (and in a cross-platform manner) by writing cmake scripts (called with cmake -P on the command line) and then using them as custom build steps via add_custom_command and add_custom_target calls. The scripts run in Visual Studio's environment, but can then set other environment variables as needed before performing their real work.<div>
<br></div><div>We do not have any support for the VS-specific property sheets that you mention. It might be a worthwhile feature request: you could ask for it in the bug tracker: <a href="http://www.cmake.org/Bug">http://www.cmake.org/Bug</a>. It sounds like it could be a useful thing.</div>
<div><br></div><div><br></div><div>HTH,</div><div>David</div><div><br></div><div><br><div class="gmail_quote">On Thu, Dec 10, 2009 at 1:27 PM, Tim St. Clair <span dir="ltr"><<a href="mailto:timothysc@gmail.com">timothysc@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">I figured I would tickle this again, b/c it seemed like you knew a solution...<br>
<br>
Cheers,<br>
<font color="#888888">Tim<br>
</font><div><div></div><div class="h5"><br>
On Wed, Dec 9, 2009 at 12:01 PM, Tim St. Clair <<a href="mailto:timothysc@gmail.com">timothysc@gmail.com</a>> wrote:<br>
> Environment variable, for the exact reason you mentioned.<br>
><br>
> On Wed, Dec 9, 2009 at 11:23 AM, Mike Jackson<br>
> <<a href="mailto:mike.jackson@bluequartz.net">mike.jackson@bluequartz.net</a>> wrote:<br>
>> On Wed, Dec 9, 2009 at 12:09 PM, Tim St. Clair <<a href="mailto:timothysc@gmail.com">timothysc@gmail.com</a>> wrote:<br>
>>> when using vsprops on windows, you can set environment variables which<br>
>>> will be exist for a given project when it compiles.<br>
>>><br>
>>> The example given in the link below:<br>
>>> set_tests_properties(SomeTest PROPERTIES ENVIRONMENT<br>
>>> "PATH=c:\somedir;c:\otherdir")<br>
>>><br>
>>> is close to what I'm looking for, but I would like it to be fore any<br>
>>> TARGET. I tried doing:<br>
>>> set_properties(MyTarget PROPERTIES ENVIRONMENT "MYVAR=foo1;MYVAR2=foo2")<br>
>>> with no success on visual studio 2008. During compilation of MyTarget<br>
>>> those vars *do not* appear to be set.<br>
>>><br>
>>> The template .vcproj, is kinda ugly, but may be last hope unless there<br>
>>> is a cleaner method for doing thing in VS.<br>
>>><br>
>>> Cheers,<br>
>>> Tim<br>
>>><br>
>>><br>
>>> On Wed, Dec 9, 2009 at 10:54 AM, Tyler Roscoe <<a href="mailto:tyler@cryptio.net">tyler@cryptio.net</a>> wrote:<br>
>>>> On Wed, Dec 09, 2009 at 07:49:12AM -0600, Tim St. Clair wrote:<br>
>>>>> Is there support for visual studio property sheets in CMAKE, or the<br>
>>>>> equivalent for *compile-time* env settings?<br>
>>>><br>
>>>> I haven't played with this solution but maybe it will help:<br>
>>>><br>
>>>> <a href="http://stackoverflow.com/questions/1005901/how-to-set-path-environment-variable-using-cmake-and-visual-studio-to-run-test" target="_blank">http://stackoverflow.com/questions/1005901/how-to-set-path-environment-variable-using-cmake-and-visual-studio-to-run-test</a><br>
>>>><br>
>>>> I don't know what you mean by "compile-time env settings".<br>
>>>><br>
>>>>> I have had little luck finding this information online, and there are<br>
>>>>> no (+,-) refs in the manual.<br>
>>>><br>
>>>> I don't know what you mean by "(+,-) refs in the manual".<br>
>>>><br>
>>>> tyler<br>
>>>><br>
>>><br>
>>><br>
>>><br>
>>> --<br>
>>> Cheers,<br>
>>> Timothy St. Clair<br>
>><br>
>><br>
>> Little late to the thread, but are you trying to set a Compile<br>
>> Definition on an actual environment variable because a script or<br>
>> something else is running during the compilation and it needs to know<br>
>> where/what something is?<br>
>><br>
>> _________________________________________________________<br>
>> Mike Jackson <a href="mailto:mike.jackson@bluequartz.net">mike.jackson@bluequartz.net</a><br>
>> BlueQuartz Software <a href="http://www.bluequartz.net" target="_blank">www.bluequartz.net</a><br>
>> Principal Software Engineer Dayton, Ohio<br>
>><br>
><br>
><br>
><br>
> --<br>
> Cheers,<br>
> Timothy St. Clair<br>
><br>
<br>
<br>
<br>
--<br>
Cheers,<br>
Timothy St. Clair<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br>
</div></div></blockquote></div><br></div>