[CMake] Find wxWidgets and unicode

Jason Stewart jstewart at pobox.com
Tue Jul 31 10:13:46 EDT 2007


I am trying to use the FindwxWidgets macro to build a windows/linux 
program that uses wxWidgets. It works on Windows unless I try to build 
with unicode, in which case it still finds the non-unicode libraries and 
my link fails. Everything works correctly on linux.

When looking at the FindwxWidgets.cmake file there is a comment about 
how it can be extended to support unicode. Is this supported? Has anyone 
linked against unicode wxWidgets libraries on Windows? Do I need to do 
something else?

I call it like this:

SET(wxWidgets_CONFIGURATION mswu)

# We need the Find package for wxWidgets to work
FIND_PACKAGE(wxWidgets)

IF(wxWidgets_FOUND)
     
    # Include wxWidgets macros
    INCLUDE(${wxWidgets_USE_FILE})

    PROJECT( viewer )

    INCLUDE_DIRECTORIES(${wxWidgets_INCLUDE_DIRS} )

    SET(SRCS main.cpp server.cpp )

    # If we build for windows systems, we also include the resource file
    # containing the manifest, icon and other resources
    IF(WIN32)
        SET(SRCS ${SRCS} viewer.rc)
    ENDIF(WIN32)

    # Here we define the executable viewer.exe or viewer on other systems
    # the above paths and defines will be used in this build
    ADD_EXECUTABLE(viewer WIN32 ${SRCS})

    # We add to our target 'viewer' the wxWidgets libraries. These are
    # set for us by the find script. If you need other libraries, you
    # can add them here as well.
    TARGET_LINK_LIBRARIES(viewer ${wxWidgets_LIBRARIES} )
ELSE(wxWidgets_FOUND)
    # For convenience. When we cannot continue, inform the user
    MESSAGE(FATAL, "wxWidgets not found!")
ENDIF(wxWidgets_FOUND)


Most of this was taken from an example.

Thanks,

Jason



More information about the CMake mailing list