[CMake] how consider pre build

"Sören Freudiger" muffmolch at gmx.de
Wed Nov 25 13:14:05 EST 2009


Hi
One Problem.

There's one file in my sources that produces a cxx file in a pre build step (similar to qt_ui or moc, swig ...)

But the source file isn't a h,c,cxx, file. It's a .if file thus I caonnot put this to the project source files without getting an error.

Ok, but step by step...

#input file    : file.if
#generated file: gen_file.cxx

 ADD_CUSTOM_COMMAND(OUTPUT gen_file.cxx
                    PRE_BUILD
                    COMMAND echo on \n ..\if.exe
                    ARGS -c++ 
                         ${include_dirs} 
                         ${preProcessorDefs} 
                         -o gen_file.cxx 
                         file.if
                    MAIN_DEPENDENCY file.if
                    DEPENDS file.if
                    COMMENT generating gen_file.cxx )

SET_SOURCE_FILES_PROPERTIES(gen_file.cxx PROPERTIES GENERATED 1)


lets use this stuff (LINUX gxx):

cmake
make       --> first run -> generates gen_file.cxx
make clean --> gen_file.cxx gets deleted becaus eit's generated
make       --> error: gen_file.cxx : No such file or directory

On Windows with VS 200x the file.if appears in my project witout adding it explecitly. And the gen_file.cxx will be rebuild if missing.

How can I ensure that the cxx is rebuilded if it's missing on Linux?

Best,
 SirAnn
-- 
Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox 3.5 -
sicherer, schneller und einfacher! http://portal.gmx.net/de/go/chbrowser


More information about the CMake mailing list