[CMake] [New Module] FindGTK2.cmake call for testing

Michael Jackson mike.jackson at bluequartz.net
Sun Jan 11 20:07:11 EST 2009


On Jan 11, 2009, at 7:13 PM, Philip Lowman wrote:

> On Sat, Jan 10, 2009 at 7:48 AM, Alexander Neundorf <a.neundorf-work at gmx.net 
> > wrote:
> On Thursday 08 January 2009, Philip Lowman wrote:
> > If you use GTK2 in any of your projects and have time, please test  
> this
> > CMake module and post any issues to this thread.
>
> I had a quick look at it.
> I think in the FIND_PATH() call you don't need to list /usr/include
> and /usr/local/include, they are searched anyway.
>
> Yes, thanks.  I'm not sure how those got there, I will remove them.
>
> The constants for true and false are "TRUE" and "FALSE" (i.e. upper  
> case).
>
> Ah, you're complaining about using 1 and 0 in the macro arguments.   
> There's a reason for that.  I'm not sure what I'm doing wrong here  
> below, but this code only outputs "a is true" when a 1 is passed in,  
> both TRUE and ON do not work.  Kinda looks like a bug but it's hard  
> to believe that it is.
>
> PROJECT(Foo)
> CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
> MACRO(test_constants _a _b )
>     MESSAGE("a,b = ${_a},${_b}")
>     IF(${_a})
>         MESSAGE("a is true")
>     ENDIF()
>     IF(${_b})
>         MESSAGE("b is true")
>     ENDIF()
> ENDMACRO()
>
> test_constants(1 0)
> test_constants(TRUE FALSE)
> test_constants(ON OFF)
>
> outputs:
> a,b = 1,0
> a is true
> a,b = TRUE,FALSE
> a,b = ON,OFF
>
> I'm not sure it's a good idea to abort with FATAL_ERROR if no  
> components are
> given. No other module does that. What would be a good default ?
> Trying to find everything and report success if at least gtk itself  
> has been
> found ?
>
> One choice would be to assume the only thing they want is "gtk" and  
> it's dependents.  I prefer the FATAL_ERROR though as it forces CMake  
> users to read the documentation, they may after all want gtkmm,  
> glade, or some other combination of GTK2's libraries.  Worse case  
> they don't read it and the FATAL_ERROR message tells them to read  
> the documentation. =)
>
> > I intend to check it into CMake and support it.
>
> Cool :-)
> Let me know when you do this, then I can close
> http://public.kitware.com/Bug/view.php?id=7483
>
> Will do.  Thanks for the reference.  I noticed a couple of use cases  
> in that module I hadn't thought of like
> /usr/lib64/gtk-2.0/include for example.
>
> -- 
> Philip Lowman

Coming from a complete outsider is GTK like Qt in that GTK has a  
"Core" library then others built on top of that? If so you can default  
to looking for the "Core" library then use CMake variables such as  
"GTK_USE_MM" set to "TRUE" and find components that way. I think  
FindBoost does something like that also.

  just my 2 cents. It is my hope that large libraries such as GTK, Qt,  
Boost and others could be written to the same "style" so that if I  
were used to using FindBoost, then I could easily use FindGTK in the  
same way and it would just work.

Respectfully.
---
Mike Jackson                 www.bluequartz.net





More information about the CMake mailing list