Bill, This is great and it works. I have several sub-projects in our main source code, but I can't seem to share the ADD_CUSTOM_COMMAND amongst them. Is there some way to do this once for all projects?
Thanks, -dan -----Original Message----- From: Bill Hoffman [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 05, 2008 9:37 AM To: Blezek, Daniel J. Cc: Mike Arthur; [email protected] Subject: Re: [CMake] CMake generated build number? Blezek, Daniel J. wrote: > Hi Mike, > > This only works during the CMake configure process, not during the > build. So it's possible for this information to be out of date. I > think I'll have to make a bogus target to grab the info from > Subversion, which is not what I had wanted to do. > You should just use a cmake -P script to create a header file or .cxx file that has the information you want in it. You would use a custom command to drive this. You should be able to follow this FAQ entry: http://www.vtk.org/Wiki/CMake_FAQ#How_do_I_generate_an_executable.2C_the n_use_the_executable_to_generate_a_file.3F So, something like this: ADD_CUSTOM_COMMAND( OUTPUT myVersion.cxx COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/version.cmake DEPENDS generate ${CMAKE_CURRENT_SOURCE_DIR}/version.cmake ) ADD_EXECUTABLE(product product.c myVersion.cxx) version.cmake: execute_process(svn ....) configure_file(myVersion.cxx.in myVersion.cxx) -Bill _______________________________________________ CMake mailing list [email protected] http://www.cmake.org/mailman/listinfo/cmake
