[CMake] ADD_DEFINITIONS with output from shell
David Sveningsson
ext at sidvind.com
Thu May 8 19:49:01 EDT 2008
Andreas Schneider skrev:
> David Cole wrote:
>> See also:
>> http://public.kitware.com/cgi-bin/viewcvs.cgi/Modules/FindSubversion.cmake?root=CMake&view=markup
>> <http://public.kitware.com/cgi-bin/viewcvs.cgi/Modules/FindSubversion.cmake?root=CMake&view=markup>
>>
>>
>> After a FIND_PACKAGE(Subversion) call, simply use the
>> Subversion_WC_INFO macro to retrieve an "svn info" call as a slew of
>> CMake variables...
>>
>
> Hi,
>
> 'svn info' is normally not what you want. 'svn info' doesn't recursively
> look for the latest revison. This is why 'svnversion' has been added.
>
>>
>> HTH,
>> David
>>
>
> -- andreas
>
For reference, this is how I did it:
include(FindSubversion)
IF(Subversion_FOUND)
MESSAGE(STATUS "Looking for Subversion - found")
Subversion_WC_INFO(${CMAKE_SOURCE_DIR} "svn")
EXECUTE_PROCESS(
COMMAND "svnversion" "--no-newline" ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE svn_version
ERROR_VARIABLE svn_version
)
message( ${svn_version} )
ELSE(Subversion_FOUND)
MESSAGE(STATUS "Looking for Subversion - not found")
ENDIF(Subversion_FOUND)
--
//*David Sveningsson [eXt]*
Freelance coder | Game Development Student
http://sidvind.com
Thou shalt make thy program's purpose and structure clear to thy fellow
man by using the One True Brace Style, even if thou likest it not, for
thy creativity is better used in solving problems than in creating
beautiful new impediments to understanding.
More information about the CMake
mailing list