Hi,

I have a source file (version.cpp) I need to generate trough a script.

What the script does is

- generate a version.cpp.new file
- if version.cpp does not exists or is different from version.cpp.new, copy version.cpp.new into version.cpp

-------------------

add_custom_command(OUTPUT version.cpp always
  COMMAND
  bash -x ${CMAKE_SOURCE_DIR}/tools/dev/gen_version.sh ${CMAKE_CURRENT_BINARY_DIR}/version.cpp  )

set_source_files_properties(version.cpp PROPERTIES GENERATED TRUE)

-----------------

the 'always' target is here to make sure the script is alway called (in case the version changed).

Unfortunately, it seems that add_custom_command will delete its output before calling the command. As a result the version.cpp's dependancies are always bult.

Is there a way to prevent that deletion ?


Thanks

--
-----
Alain Miniussi
DSI, Pôles Calcul et Genie Log.
Tél. : +33492003009 (Mont-Gros)
Tél. : +33483618544 (Sophia Antipolis)

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake

Reply via email to