[CMake] Some questions

MD or MD tres.14159 at gmail.com
Fri Apr 4 20:58:52 EDT 2008


Hi!

I´ve been looking for more information and easy examples in order to
learn and practise Cmake but I´ve some questions:

	-I don´t know how to use Cmake in a proyect built by several files,
ex: (main.c, functions.c and functions.h)

	-And I don´t know how to use it in a sdl proyect, like in the
following example:
		#include <stdlib.h>
		#include "SDL.h"

		int main(int argc, char *argv[])
		{
			if ( SDL_Init(SDL_INIT_AUDIO|SDL_INIT_VIDEO) < 0 )
			{
		        	fprintf(stderr, "Unable to init SDL: %s\n", SDL_GetError());
				exit(1);
			}
			atexit(SDL_Quit);
			...
		}
	- And the last, I don´t know hot to use cmake in this example with gtk:

		#include <gtk/gtk.h>
		static void hello(GtkWidget *widget, gpointer data)
		{
			g_print ("Hello World\n");
		}

		static gboolean delete_event( GtkWidget *widget, GdkEvent  *event,
gpointer   data)
		{
			g_print ("delete event occurred\n");
			return TRUE;
		}

		static void destroy( GtkWidget *widget, gpointer   data )
		{
			gtk_main_quit ();
		}

		int main( int   argc, char *argv[] )
		{
			GtkWidget *window;
			GtkWidget *button;

			gtk_init (&argc, &argv);
			window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
			g_signal_connect (G_OBJECT (window), "delete_event", G_CALLBACK
(delete_event), NULL);
			g_signal_connect (G_OBJECT (window), "destroy", G_CALLBACK (destroy), NULL);
    			gtk_container_set_border_width (GTK_CONTAINER (window), 10);
			button = gtk_button_new_with_label ("Hello World");
			g_signal_connect (G_OBJECT (button), "clicked",G_CALLBACK (hello), NULL);
			g_signal_connect_swapped (G_OBJECT (button), "clicked", G_CALLBACK
(gtk_widget_destroy), G_OBJECT (window));
			gtk_container_add (GTK_CONTAINER (window), button);
			gtk_widget_show (button);
			gtk_widget_show (window);
			gtk_main ();

    			return 0;
		}

Thank you so much for your atention (yeah, it´s a poor english and
it´s hard to understand xD). And, of course, thank you for giving the
free sofwtare comunity such an important proyect x).

Bye.


More information about the CMake mailing list