[CMake] CMAKE vsprops or equivalent...

David Cole david.cole at kitware.com
Thu Dec 10 13:36:05 EST 2009


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.

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: http://www.cmake.org/Bug. It sounds like it could be a
useful thing.


HTH,
David


On Thu, Dec 10, 2009 at 1:27 PM, Tim St. Clair <timothysc at gmail.com> wrote:

> I figured I would tickle this again, b/c it seemed like you knew a
> solution...
>
> Cheers,
> Tim
>
> On Wed, Dec 9, 2009 at 12:01 PM, Tim St. Clair <timothysc at gmail.com>
> wrote:
> > Environment variable, for the exact reason you mentioned.
> >
> > On Wed, Dec 9, 2009 at 11:23 AM, Mike Jackson
> > <mike.jackson at bluequartz.net> wrote:
> >> On Wed, Dec 9, 2009 at 12:09 PM, Tim St. Clair <timothysc at gmail.com>
> wrote:
> >>> when using vsprops on windows, you can set environment variables which
> >>> will be exist for a given project when it compiles.
> >>>
> >>> The example given in the link below:
> >>> set_tests_properties(SomeTest PROPERTIES ENVIRONMENT
> >>> "PATH=c:\somedir;c:\otherdir")
> >>>
> >>> is close to what I'm looking for, but I would like it to be fore any
> >>> TARGET.  I tried doing:
> >>> set_properties(MyTarget PROPERTIES ENVIRONMENT
> "MYVAR=foo1;MYVAR2=foo2")
> >>> with no success on visual studio 2008.  During compilation of MyTarget
> >>> those vars *do not* appear to be set.
> >>>
> >>> The template .vcproj, is kinda ugly, but may be last hope unless there
> >>> is a cleaner method for doing thing in VS.
> >>>
> >>> Cheers,
> >>> Tim
> >>>
> >>>
> >>> On Wed, Dec 9, 2009 at 10:54 AM, Tyler Roscoe <tyler at cryptio.net>
> wrote:
> >>>> On Wed, Dec 09, 2009 at 07:49:12AM -0600, Tim St. Clair wrote:
> >>>>> Is there support for visual studio property sheets in CMAKE, or the
> >>>>> equivalent for *compile-time* env settings?
> >>>>
> >>>> I haven't played with this solution but maybe it will help:
> >>>>
> >>>>
> http://stackoverflow.com/questions/1005901/how-to-set-path-environment-variable-using-cmake-and-visual-studio-to-run-test
> >>>>
> >>>> I don't know what you mean by "compile-time env settings".
> >>>>
> >>>>> I have had little luck finding this information online, and there are
> >>>>> no (+,-) refs in the manual.
> >>>>
> >>>> I don't know what you mean by "(+,-) refs in the manual".
> >>>>
> >>>> tyler
> >>>>
> >>>
> >>>
> >>>
> >>> --
> >>> Cheers,
> >>> Timothy St. Clair
> >>
> >>
> >> Little late to the thread, but are you trying to set a Compile
> >> Definition on an actual environment variable because a script or
> >> something else is running during the compilation and it needs to know
> >> where/what something is?
> >>
> >> _________________________________________________________
> >> Mike Jackson                  mike.jackson at bluequartz.net
> >> BlueQuartz Software                    www.bluequartz.net
> >> Principal Software Engineer                  Dayton, Ohio
> >>
> >
> >
> >
> > --
> > Cheers,
> > Timothy St. Clair
> >
>
>
>
> --
> Cheers,
> Timothy St. Clair
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20091210/2d682846/attachment.htm>


More information about the CMake mailing list