Daniele,

Your changes look fine to me although my experience with imported targets
is limited so someone with more experience should review your changes there.

I'm not sure if there is a way to develop automated unit tests and mark
them to not run by default.  That would be useful for regression testing of
modules even if it the tests had to be run manually.  Would be a good
question for some of the more active developers (read: not me) :).

If compilation of the hello world examples is still working for you, that
would be a pretty good sign you didn't break anything.
https://developer.gnome.org/gtk-tutorial/stable/c39.html#SEC-HELLOWORLD
https://developer.gnome.org/gtkmm-tutorial/2.24/sec-helloworld.html.en

Here's some old test code I had lying around which obviously could be much
improved.

*CMakeLists.txt*
project(foo)
cmake_minimum_required(VERSION 2.6)

set(GTK2_DEBUG TRUE)

set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
find_package(GTK2 2.16 REQUIRED gtk glade gtkmm glademm)
message("GTK2_INCLUDE_DIRS = ${GTK2_INCLUDE_DIRS}")
message("GTK2_LIBRARIES = ${GTK2_LIBRARIES}")

include_directories(${GTK2_INCLUDE_DIRS})
add_executable(bar bar.cc helloworld.cc)
target_link_libraries(bar ${GTK2_LIBRARIES}

*bar.cc:*
#include <gtkmm/main.h>
#include "helloworld.h"

int main (int argc, char *argv[])
{
  Gtk::Main kit(argc, argv);

  HelloWorld helloworld;
  //Shows the window and returns when it is closed.
  Gtk::Main::run(helloworld);

  return 0;
}

*helloworld.cc*
#include "helloworld.h"
#include <iostream>

HelloWorld::HelloWorld()
: m_button("Hello World")   // creates a new button with label "Hello
World".
{
  // Sets the border width of the window.
  set_border_width(10);

  // When the button receives the "clicked" signal, it will call the
  // on_button_clicked() method defined below.
  m_button.signal_clicked().connect(sigc::mem_fun(*this,
              &HelloWorld::on_button_clicked));

  // This packs the button into the Window (a container).
  add(m_button);

  // The final step is to display this newly created widget...
  m_button.show();
}

HelloWorld::~HelloWorld()
{
}

void HelloWorld::on_button_clicked()
{
  std::cout << "Hello World" << std::endl;
}

*helloworld.h*
#ifndef GTKMM_EXAMPLE_HELLOWORLD_H
#define GTKMM_EXAMPLE_HELLOWORLD_H

#include <gtkmm/button.h>
#include <gtkmm/window.h>

class HelloWorld : public Gtk::Window
{

public:
  HelloWorld();
  virtual ~HelloWorld();

protected:
  //Signal handlers:
  void on_button_clicked();

  //Member widgets:
  Gtk::Button m_button;
};

#endif // GTKMM_EXAMPLE_HELLOWORLD_H




On Mon, Aug 5, 2013 at 11:00 AM, Daniele E. Domenichelli <
daniele.domeniche...@gmail.com> wrote:

> Hello all,
>
> I'd like to introduce imported targets in FindGTK2.cmake, in a similar
> manner as they are used in FindQT4.cmake.
>
> The aim is to be able to do something like:
>
>    find_package(GTK2 gtk gtkmm)
>    target_link_libraries(<target> GTK2::gtkmm)
>
> (In the future I want to handle dependencies on modules as well, at the
> moment I think that if you don't include the gtk module it will not work)
>
> If you want to review my changes, you can checkout the FindGTK2-targets
> topic. I tested it on Windows and Linux, but unfortunately there are not
> unit tests afaik.
>
>
>
> Cheers,
>  Daniele
> --
>
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers
>



-- 
Philip Lowman
--

Powered by www.kitware.com

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

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

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers

Reply via email to