[Cmake] Re: cmake for wxWindows

Andy Cedilnik andy.cedilnik at kitware.com
Fri Nov 22 07:52:38 EST 2002


Hi Klaas,

I am forwarding this e-mail to cmake mailing list just for information
for anybody interested in this.

The current state of affairs is that you can build wxWindows project
using CMake without building wxWindows libraries using CMake. It is not
entirely smooth though.

The procedure is:

1. Compile wxWindows 
   this is good idea instead of getting binaries, 
   because then you can know that they were built 
   using the same compiler.

2. (on unix) Install wxWindows somewhere 
   it does not have to be in /usr/local or whatever, 
   because all you need is the wx-config to refer to
   the right locations.

2. (on windows) Just remember locations of files.

3. In your project, in the CMakeLists.txt refer to FindwxWindows.cmake:

INCLUDE (${CMAKE_ROOT}/Modules/FindwxWindows.cmake)

and other compiler options:

IF(WXWINDOWS_INCLUDE_PATH)
  INCLUDE_DIRECTORIES(${WXWINDOWS_INCLUDE_PATH})
ENDIF(WXWINDOWS_INCLUDE_PATH)

IF(CMAKE_WX_CXX_FLAGS)
  SET(CMAKE_CXX_FLAGS "${CMAKE_WX_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
ENDIF(CMAKE_WX_CXX_FLAGS)

also, add link options for wxWindows:

TARGET_LINK_LIBRARIES(wxArt2D ${WXWINDOWS_LIBRARY})

where wxArt2D is your executable. Make sure that TARGET_LINK_LIBRARIES
is after you say ADD_EXECUTABLE.

4. Now you run CMake

(Unix) Specify the location of wx-config in CMAKE_WX_CONFIG
(Windows) Specify the location of wx/wx.h in WXWINDOWS_INCLUDE_PATH
          and location of wx library (wx.lib, wx23_2.dll, ...) in
          WXWINDOWS_SHARED_LIBRARY and WXWINDOWS_STATIC_LIBRARY.

I suggest using static library, as you do not have to include it in your
distribution.

That should be it.

Let me know if it works.

There is work in progress to get wxWindows library to compile using
CMake. That would be easier, since then configuring applications on
different platforms would be transparent. Also, the UsewxWindows.cmake
would have all the information about compiler with all flags and
directories.


					Andy


On Fri, 2002-11-22 at 06:32, k. holwerda wrote:
> I am not sure if you follow wxDev so excuse me to contact you directly.
> 
> I am trying to use cmake for the wxArt2D project.
> And i started of with the cmake files you donated to the wxWindows
> project.
> 
> But now i am in trouble, since i think this setup will only work if the
> wxWindows library
> was setup/build with cmake itself also.
> To bad wxWindows does not have a wx-config on MSWwindows, because this
> almost
> makes it impossible to get preprocessor flags etc.
> 
> I wonder if you have a cmake project which uses wxWindows as is, and
> maybe even
> have a module in cmake to load its information.
> Am i right to say that to use cmake with wxWindows,
> i need  to get for every compiler used within wxWindows on MSW things
> like CPPFLAGS etc.
> I wonder how it is possible to know which compiler was used to build the
> wxWindows library.
> 
> Anyway, i hope you can help me in some way,
> 
> Thanks in advance,





More information about the CMake mailing list