[CMake] CMake 2.4 (8) and WxWidgets + RichText

Eric Torstenson eric.torstenson at mac.com
Fri Apr 18 16:58:37 EDT 2008


Hi All,

I've been struggling to get my gui application to compile and link using 
CMake (the command line version went easily enough) and I think it's 
time to ask for some help.

I'm using version 2.8.6 of wx-widgets, and my old makefiles compiled and 
linked the application just fine. However, I've had many problems trying 
to feed the various flags into the compiler myself. So, now I'm trying 
to use the FIND_PACKAGE(wxWidgets) command to let CMake do the work for me.

However, when I do, it doesn't find RichText.

Here is that portion of my CMakeLists.txt file:

FIND_PACKAGE(wxWidgets COMPONENTS aui richtext adv html core xml base 
xrc qa net)
IF (wxWidgets_FOUND)
    MESSAGE ("WxWidgets LIB Root :    ${wxWidgets_ROOT_DIR}")
    MESSAGE ("WxWidgets LIB Dir  :    ${wxWidgets_LIB_DIR}")
    MESSAGE ("WxWidgets CXX Flags:    ${wxWidgets_CXX_FLAGS}")
    MESSAGE ("WxWidgets Inc. Dirs:    ${wxWidgets_INCLUDE_DIRS}")
    MESSAGE ("wxWidgets Def.     :    ${wxWidgets_DEFINITIONS}")
    MESSAGE ("wxWidgets Libraries:    ${wxWidgets_LIBRARIES}")


    SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WxTypeCFlags} 
-L/usr/local/lib" )
    SET (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D__WXDEBUG__ 
-DWXDEBUG=1 ${WxTypeCFlags} -L/usr/local/lib")


    ADD_DEFINITIONS (${wxWidgets_DEFINITIONS})
    INCLUDE_DIRECTORIES ("${wxWidgets_INCLUDE_DIR} ${SourceDIR} 
$ENV{rdParty}$/include ${FreeTypeCFlags} ${WxTypeCFlags} -L/usr/local/lib")
    LINK_DIRECTORIES (${wxWidgets_LINK_DIRECTORIES})
    LINK_LIBRARIES (${wxWidgets_LIBRARIES})


ENDIF (wxWidgets_FOUND)

The results of the wxWidgets_LIBRARIES printout are:
wxWidgets Libraries:    
-L/usr/local/lib;-pthread;;;-L/usr/lib64;;;/usr/local/lib/libwx_gtk2_aui-2.8.a;/usr/local/lib/libwx_gtk2_xrc-2.8.a;/usr/local/lib/libwx_gtk2_qa-2.8.a;/usr/local/lib/libwx_gtk2_html-2.8.a;/usr/local/lib/libwx_gtk2_adv-2.8.a;/usr/local/lib/libwx_gtk2_core-2.8.a;/usr/local/lib/libwx_base_xml-2.8.a;/usr/local/lib/libwx_base_net-2.8.a;/usr/local/lib/libwx_base-2.8.a;-pthread;-lgtk-x11-2.0;-lgdk-x11-2.0;-latk-1.0;-lgdk_pixbuf-2.0;-lpango-1.0;-lgobject-2.0;-lgmodule-2.0;-lgthread-2.0;-lrt;-lglib-2.0;-lXinerama;-lXxf86vm;-lSM;-lpng;-ljpeg;-ltiff;-lexpat;-lz;-ldl;-lm

There is simply no richtext in there at all:(

When I run wx-config --libs aui richtext adv html core xml base xrc qa net

I get this:
-L/usr/local/lib -pthread   -L/usr/lib64   
/usr/local/lib/libwx_gtk2_aui-2.8.a 
/usr/local/lib/libwx_gtk2_richtext-2.8.a 
/usr/local/lib/libwx_gtk2_adv-2.8.a /usr/local/lib/libwx_gtk2_html-2.8.a 
/usr/local/lib/libwx_gtk2_core-2.8.a /usr/local/lib/libwx_base_xml-2.8.a 
/usr/local/lib/libwx_base-2.8.a /usr/local/lib/libwx_gtk2_xrc-2.8.a 
/usr/local/lib/libwx_gtk2_qa-2.8.a /usr/local/lib/libwx_base_net-2.8.a 
-pthread -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 
-lpango-1.0 -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lrt -lglib-2.0 
-lXinerama -lXxf86vm -lSM -lpng -ljpeg -ltiff -lexpat -lz -ldl -lm

I should be able to get the richtext as a component. I don't know how 
CMake is finding this, but the paths are correct, so they are using the 
correct installation, I think.

I tried to manually set the various flags, but I was having all sorts of 
issues there, so I thought it was best to go according to the way that 
seems to be provided.

Thanks any help!

eric




More information about the CMake mailing list