If VERSION is a preprocessor definition, you can use the
set_property<http://cmake.org/cmake/help/cmake2.6docs.html#command:set_property>command.
For example, if you want VERSION to be defined only in your main.cc
source, do

set_property(SOURCE main.cc PROPERTY COMPILE_DEFINITIONS VERSION=1.0)

or

set_source_files_properties(main.cc PROPERTY COMPILE_DEFINITIONS VERSION=1.0)

you can also set properties on a per-target or per-directory basis.

HTH

-

On Fri, Apr 10, 2009 at 4:42 PM, John Dey <[email protected]> wrote:

> Hi,
>
> I have converted a program from using make to cmake.  I needed to make a
> change to the main.cc program to get it to work.  I am going back to see if
> I can get it to work without making the change.  main.cc has a statement
> something to the effect of "fprintf(stdin, "%s\n", VERSION);" and the
> Makefile contains the statement "VERSION = 0.8.2".  How can I set the
> variable VERSION in CMakeLists.txt?  Any direction on setting the variable
> would be appreciated.  Thanks.
>
> John
> _______________________________________________
> 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
>



-- 
Adolfo Rodríguez Tsouroukdissian

Robotics engineer
PAL ROBOTICS S.L
http://www.pal-robotics.com
Tel. +34.93.414.53.47
Fax.+34.93.209.11.09
_______________________________________________
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

Reply via email to