-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi again,
I've managed to get it working, with the help of post http://www.cmake.org/pipermail/cmake/2005-July/007009.html Here's the macro: - ---- # # QT3 Macro for embedding image files into source # # EMBED_TARGET = binary to link to, i.e. sbvd_manager # EMBED_SOURCE_OUTPUT = outputted .cpp file # SOURCE_IMAGES = list of images to embed # Macro(QT_EMBED_IMAGES EMBED_TARGET EMBED_SOURCE_OUTPUT SOURCE_IMAGES) Add_Custom_Command( OUTPUT ${EMBED_SOURCE_OUTPUT} COMMAND ${QT_UIC_EXECUTABLE} -embed ${EMBED_TARGET} ${${SOURCE_IMAGES}} -o ${EMBED_SOURCE_OUTPUT} ) EndMacro(QT_EMBED_IMAGES EMBED_TARGET EMBED_SOURCE_OUTPUT SOURCE_IMAGES) - ---- And here's how I'm calling it: - ---- Set (GUI_IMAGE_SOURCE ${PROJECT_BINARY_DIR}/embed_src.cpp) Set (GUI_IMAGES ${PROJECT_SOURCE_DIR}/images/image1.png ....) QT_EMBED_IMAGES(program ${GUI_IMAGE_SOURCE} GUI_IMAGES) Add_Executable(program ${src} ${GUI_IMAGE_SOURCE}) - ---- Hope this helps someone! Thanks again for the help. /Tim Alexander Neundorf wrote: > On Friday 24 August 2007 07:41, Tim Schooley wrote: >> Hi folks, >> >> I've recently ported my project to CMake from standard Makefiles, but >> missed a vital point (only just noticed by running the damn thing!). >> >> I've looked around, but can't find the answer: How to I embed images >> into QT3 apps with CMake ? The Makefile generated from qmake was >> something like: >> >> ---- >> >> .obj/qmake_image_collection.o: .ui/qmake_image_collection.cpp >> $(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/qmake_image_collection.o >> .ui/qmake_image_collection.cpp >> >> .ui/qmake_image_collection.cpp: images/gtk-about.png >> $(UIC) -embed program images/gtk-about.png ... -o >> .ui/qmake_image_collection.cpp >> >> ---- >> >> Should I make custom targets for all this, or is there something simpler? > > Is this just for one image ? > > Yes, you need add_custom_command(), if it's for more than one image you > should > put it in a macro, something like this: > > macro(embed_images src img) > add_custom_command(OUTPUT ${src} > COMMAND ${QT_UIC...} ... > DEPENDS ${img} ) > endmacro(embed_images src img) > > > embed_images("${CMAKE_CURRENT_BINARY_DIR}/image.cpp" about.png) > add_executable(foo file1.cpp ... "${CMAKE_CURRENT_BINARY_DIR}/image.cpp") > > If it's more than one image you can also put this in a foreach() loop inside > the macro. > > If you have that working, it would be nice if you could post the script here. > > Bye > Alex > _______________________________________________ > CMake mailing list > CMake@cmake.org > http://www.cmake.org/mailman/listinfo/cmake > > -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFGzwNuChPkLPgrpHQRAsw2AKCeRtPCrp9sTMuR7GIW9LykhnVuPwCfccg4 37LL/g8gahNGAxmO6Rzv8ZI= =AIPo -----END PGP SIGNATURE----- _______________________________________________ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake