On Sep 21, 2008, at 9:28 AM, Steven Samuel Cole wrote:

Mike Jackson schrieb:
include(FindGTK)
add_executable (myexec ${sources} )
target_link_libraries(myexec ${GTK_LIBRARIES} )
Note the order above.
Also, cmake variables are ALWAYS used with braces ${Variable} NOT $Variable.
Mike

Thanks for that, Mike :-)

The sample code corresponds to what I'm doing, even the order happens to be the same. I still keep getting GTK include errors. Tried include_directories (... ${GTK_INCLUDE_DIR}) in all orders.

BTW: Why does the order matter ? How do I know the right order ?

When I use hand-coded include paths, I get GTK linker errors.

> If you are having cmake generate makefiles then run make in the
> following fashion:
>
> make VERBOSE=1
>
> and carefully inspect the compile line. From that you should be able
> to deduce why gtk/gtk.h is NOT on the  include paths.

True,there is nothing GTK-related in the compile line.

So does FindGTK silently fail to find GTK inc/libs ?
If so, how can I fix that ?



You need to "add_executable" before you can "target_link_libraries". The add_executable command adds a "target" called myexec. Then you "target_link_libraries". Think of the "add_executable" as the compile step and the "target_link_libraries" as the link step. You have to compile before you can link. ;-)

Looking at the FindGTK module in CMake 2.6.1 it would seem that it will silently fail. add the following to your cmake code:

FIND_PACKAGE(GTK REQUIRED)
IF (NOT GTK_FOUND)
   MESSAGE (FATAL_ERROR "GTK NOT FOUND")
ENDIF (NOT GTK_FOUND)

then your add_executable and target_link_libraries lines and lets see what happens


---
Mike Jackson - Principal Software Engineer
www.bluequartz.net


_______________________________________________
CMake mailing list
[email protected]
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to