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

Philip Lowman philip at yhbt.com
Sun Jan 11 19:13:16 EST 2009


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090111/3f21e38d/attachment-0001.htm>


More information about the CMake mailing list