[CMake] this is what i got struck

Michael Wild themiwi at gmail.com
Thu Jan 28 04:41:23 EST 2010


Dude, you really are in some need of RTFM! E.g. here http://lmgtfy.com/?q=cmake+documentation

Flaming, swearing and strong language won't get you much help here!

find_library(a ...) creates a variable in the cache called "a". Next time you call find_library(a ...) it just won't do anything, because "a" is already in the cache and evaluates to true (i.e. is not 0, FALSE, NO, OFF, NOTFOUND or *-NOTFOUND).

So, fix your code to read:


find_package(GTK2 REQUIRED)
include_directories(${GTK2_INCLUDE_DIRS})
...
target_link_libraries(dev9null ${GTK2_LIBRARIES})
...


Most of the libraries you showed below will be picked up automatically. If you still insist on doing things yourself, do something like this:

find_library(GDK_PIXBUF_LIBRARY gdk_pixbuf-2.0)
find_library(GDK_WIN32_LIBRARY gdk-win32-2.0)
find_library(GTK_WIN32_LIBRARY gtk-win32-2.0)
...
set(GTKLIBS
  "${GDK_PIXBUF_LIBRARY}"
  "${GDK_WIN32_LIBRARY}"
  "${GTK_WIN32_LIBRARY}"
  ...
  )

target_link_libraries(dev9null ${GTKLIBS})
...


HTH

Michael

On 28. Jan, 2010, at 10:30 , jojelino wrote:

> i want to include gtk dependency libraries with gtk itself. but followings was error-prone.
> set(a "")
> find_library(a NAMES gdk_pixbuf-2.0)
> set(GTKLIBS ${GTKLIBS} ${a})
> set(a "")
> find_library(a NAMES gdk-win32-2.0)
> set(GTKLIBS ${GTKLIBS} ${a})
> set(a "")
> find_library(a NAMES gtk-win32-2.0)
> set(GTKLIBS ${GTKLIBS} ${a})
> set(a "")
> find_library(a NAMES gdi32)
> set(GTKLIBS ${GTKLIBS} ${a})
> set(a "")
> find_library(a NAMES imm32)
> set(GTKLIBS ${GTKLIBS} ${a})
> set(a "")
> find_library(a NAMES shell32)
> set(GTKLIBS ${GTKLIBS} ${a})
> set(a "")
> find_library(a NAMES ole32)
> set(GTKLIBS ${GTKLIBS} ${a})
> set(a "")
> find_library(a NAMES uuid)
> set(GTKLIBS ${GTKLIBS} ${a})
> set(a "")
> find_library(a NAMES pangocairo-1.0)
> set(GTKLIBS ${GTKLIBS} ${a})
> set(a "")
> find_library(a NAMES pangoft2-1.0)
> set(GTKLIBS ${GTKLIBS} ${a})
> set(a "")
> find_library(a NAMES pangowin32-1.0)
> set(GTKLIBS ${GTKLIBS} ${a})
> set(a "")
> find_library(a NAMES gdi32)
> set(GTKLIBS ${GTKLIBS} ${a})
> set(a "")
> find_library(a NAMES freetype)
> set(GTKLIBS ${GTKLIBS} ${a})
> set(a "")
> find_library(a NAMES fontconfig)
> set(GTKLIBS ${GTKLIBS} ${a})
> set(a "")
> find_library(a NAMES pango-1.0)
> set(GTKLIBS ${GTKLIBS} ${a})
> set(a "")
> find_library(a NAMES m)
> set(GTKLIBS ${GTKLIBS} ${a})
> set(a "")
> find_library(a NAMES atk-1.0)
> set(GTKLIBS ${GTKLIBS} ${a})
> set(a "")
> find_library(a NAMES cairo)
> set(GTKLIBS ${GTKLIBS} ${a})
> set(a "")
> find_library(a NAMES gio-2.0)
> set(GTKLIBS ${GTKLIBS} ${a})
> set(a "")
> find_library(a NAMES gobject-2.0)
> set(GTKLIBS ${GTKLIBS} ${a})
> set(a "")
> find_library(a NAMES gmodule-2.0)
> set(GTKLIBS ${GTKLIBS} ${a})
> set(a "")
> find_library(a NAMES gthread-2.0)
> set(GTKLIBS ${GTKLIBS} ${a})
> set(a "")
> find_library(a NAMES glib-2.0)
> set(GTKLIBS ${GTKLIBS} ${a})
> set(a "")
> find_library(a NAMES intl)
> set(GTKLIBS ${GTKLIBS} ${a})
> set(a "")
> mark_as_advanced(GTKLIBS)
> target_link_libraries(dev9null ${GTKLIBS})
> target_link_libraries(CDVDnull ${GTKLIBS})
> 
> I wondered why this brute-force based method doesn't work with cmake.
> it complains it isn't from project so it can't compile. what a mess. cmake, this is not what you need to care for!
> how we can deceive cmake so that i can work without problem?
> 
> _______________________________________________
> 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://www.cmake.org/mailman/listinfo/cmake



More information about the CMake mailing list