5 # Based on work by Jorgen Bodde
7 # This module finds if wxWindows is installed and determines where the
8 # include files and libraries are. It also determines what the name of
9 # the library is. This code sets the following variables:
11 # WXWIDGETS_FOUND = wxWidgets was found
12 # WXWIDGETS_ROOT_DIR = base wxWidgets directory
13 # WXWIDGETS_LINK_DIRECTORIES = link directories, useful for rpath on Unix
14 # WXWIDGETS_LIBRARIES = all the wxWindows libraries ( and linker flags on unix )
15 # WXWIDGETS_CXX_FLAGS = compiler flags for building wxWindows
16 # WXWIDGETS_EXE_LINKER_FLAGS = compiler flags for building wxWindows
17 # WXWIDGETS_INCLUDE_DIR = all include path of wxWindows
18 # WXWIDGETS_DEFINITIONS = all flags of wxWindows
20 # WXWIDGETS_RELEASE_LIBRARIES = release wxWindows libraries (Win32 only)
21 # WXWIDGETS_DEBUG_LIBRARIES = debug wxWindows libraries (Win32 only)
22 # WXWIDGETS_COMMON_LIBRARIES = libraries common to Release and Debug (Win32 only)
24 # NOTE: This module REQUIRES that an environment variable named WXWIN
25 # be set to the base wxWidgets installation directory.
26 # Under Unix, you must also set and environment variable named WXWINCFG
27 # to the name of the active build subdirectory (eg buildgtk). As an alternative
28 # to the WXWINCFG environment variable, you can set a sym link in the wxWidgets
29 # root directory called wx-config which points to the active build subdirectory.
32 # These variable should be set before including this module
34 # WXWIDGETS_FILE_VERSION (26)
35 # WXWIDGETS_VERSION (2.6)
39 ####################### EXAMPLE CMakeLists.txt ###################
41 ##Required project specific settings
42 #PROJECT( myprojectname )
43 #SET(PROJECT_SOURCE_FILES myfile.cpp myfile2.cpp)
45 # SET(PROJECT_RC_FILE myresfile.rc)
47 # SET(PROJECT_RC_FILE "")
50 ##Optional project specific settings
51 #SET(PROJECT_DEFINITIONS -D_MYPROJECT_ -D_MYPROJECT2_)
52 #SET(PROJECT_INCLUDE_PATH e:/myproject/include e:/myproject2/include)
53 #SET(PROJECT_LINK_DIRECTORIES e:/myproject/lib e:/myproject2/lib)
54 #SET(PROJECT_LIBRARIES myprojectlib myproject2lib)
56 ##wxWidgets build related stuff
57 #SET(WXW_USE_DEBUG OFF)
58 #SET(WXW_USE_UNICODE OFF)
59 #SET(WXW_USE_SHARED OFF)
60 #SET(WXW_USE_UNIV OFF)
61 #SET(WXW_USE_MONO OFF)
62 #SET(WXW_FILE_VERSION "26")
63 #SET(WXW_VERSION "2.6")
68 ####################### END EXAMPLE CMakeLists.txt ###################
71 # Set WX_USE vars in CMakeLists if you don't want to default to all off
73 SET(WXWIDGETS_USE_DEBUG ${WXW_USE_DEBUG} CACHE BOOL "Use Debug versions of wxWindows libraries")
74 SET(WXWIDGETS_USE_UNICODE ${WXW_USE_UNICODE} CACHE BOOL "Use Unicode versions of wxWindows libraries")
75 SET(WXWIDGETS_USE_SHARED ${WXW_USE_SHARED} CACHE BOOL "Use shared versions of wxWindows libraries")
76 SET(WXWIDGETS_USE_UNIV ${WXW_USE_UNIV} CACHE BOOL "Use Universal versions of wxWindows libraries")
77 SET(WXWIDGETS_USE_MONO ${WXW_USE_MONO} CACHE BOOL "Use monolithic versions of wxWindows libraries")
80 # Style can be non-Win32 even under Windows when using MinGW
83 SET(WIN32_STYLE_FIND 1)
86 SET(WIN32_STYLE_FIND 1)
88 SET(WIN32_STYLE_FIND 0)
89 SET(UNIX_STYLE_FIND 1)
93 SET(UNIX_STYLE_FIND 1)
97 # Versions should be set before this file is included. If not,
101 SET( WXVERSIONSUFFIX ${WXW_FILE_VERSION})
102 ELSE(WXW_FILE_VERSION)
103 SET( WXVERSIONSUFFIX "26")
104 ENDIF(WXW_FILE_VERSION)
107 SET( WXVERSION ${WXW_VERSION})
109 SET( WXVERSION "2.6")
113 # Find the base wxWidgets install path
114 # NOTE: WXWIN must be set
116 FIND_PATH( WXWIDGETS_ROOT_DIR
120 IF(WXWIDGETS_ROOT_DIR STREQUAL "WXWIDGETS_ROOT_DIR-NOTFOUND")
121 MESSAGE( FATAL_ERROR "FATAL_ERROR: wx-config.in NOT found. Set WXWIN")
122 ENDIF(WXWIDGETS_ROOT_DIR STREQUAL "WXWIDGETS_ROOT_DIR-NOTFOUND")
123 SET(WXWIDGETS_CONFIG_PATH ${WXWIDGETS_ROOT_DIR})
126 # Find library path (platform specific)
128 IF( WIN32_STYLE_FIND )
130 IF( WXWIDGETS_USE_SHARED )
131 SET(WXWIDGETS_LIB_PATH "${WXWIDGETS_ROOT_DIR}/lib/vc_dll" )
132 ELSE( WXWIDGETS_USE_SHARED )
133 SET(WXWIDGETS_LIB_PATH "${WXWIDGETS_ROOT_DIR}/lib/vc_lib" )
134 ENDIF( WXWIDGETS_USE_SHARED )
135 SET( WXWIDGETS_LINK_DIRECTORIES ${WXWIDGETS_LIB_PATH} )
137 ELSE( WIN32_STYLE_FIND )
141 # Unix uses a config specific directory under the install path
142 # specified in the WXWINCFG environment variable.
143 # If the WXWINCFG variable isn't set, we try a sym link within
144 # the WX root dir called wx-config, or the current PATH
146 FIND_PROGRAM( WX_WXCONFIG_EXECUTABLE
148 "${WXWIDGETS_ROOT_DIR}/$ENV{WXWINCFG}"
149 "${WXWIDGETS_ROOT_DIR}/wx-config" )
151 # Check wether wx-config can be found
153 IF(NOT EXISTS ${WX_WXCONFIG_EXECUTABLE})
154 # we really need wx-config...
155 MESSAGE(FATAL_ERROR "FATAL_ERROR: Cannot find wx-config. Set WXWIN and WXWINCFG environment variables.")
156 ENDIF(NOT EXISTS ${WX_WXCONFIG_EXECUTABLE})
158 GET_FILENAME_COMPONENT( WXWIDGETS_CONFIG_PATH
159 WX_WXCONFIG_EXECUTABLE
162 SET(WXWIDGETS_LIB_PATH "${WXWIDGETS_CONFIG_PATH}/lib" )
163 SET( WXWIDGETS_LINK_DIRECTORIES ${WXWIDGETS_LIB_PATH} )
165 ELSE(UNIX_STYLE_FIND)
166 MESSAGE(FATAL_ERROR "FATAL_ERROR: FindwxWindows.cmake: Platform unsupported by FindwxW.cmake. It's neither WIN32 nor UNIX")
167 ENDIF(UNIX_STYLE_FIND)
168 ENDIF( WIN32_STYLE_FIND )
171 # Check options against installed libraries
173 SET(WX_CONFIG_ARGS "")
174 SET( LIBRARYWANT "${WXWIDGETS_LIB_PATH}/msw" )
176 IF( WXWIDGETS_USE_UNIV )
177 SET( LIBRARYWANT "${LIBRARYWANT}univ")
179 SET(WX_CONFIG_ARGS "${WX_CONFIG_ARGS} --universal=yes")
180 ELSE( WXWIDGETS_USE_UNIV )
181 SET(WX_CONFIG_ARGS "${WX_CONFIG_ARGS} --universal=no")
182 ENDIF( WXWIDGETS_USE_UNIV )
184 IF( WXWIDGETS_USE_UNICODE )
185 SET( LIBRARYWANT "${LIBRARYWANT}u" )
187 SET(WX_CONFIG_ARGS "${WX_CONFIG_ARGS} --unicode=yes")
188 ELSE( WXWIDGETS_USE_UNICODE )
189 SET(WX_CONFIG_ARGS "${WX_CONFIG_ARGS} --unicode=no")
190 ENDIF( WXWIDGETS_USE_UNICODE )
192 IF( WXWIDGETS_USE_DEBUG )
194 SET(WX_CONFIG_ARGS "${WX_CONFIG_ARGS} --debug=yes")
195 ELSE( WXWIDGETS_USE_DEBUG )
197 SET(WX_CONFIG_ARGS "${WX_CONFIG_ARGS} --debug=no")
198 ENDIF( WXWIDGETS_USE_DEBUG )
200 IF( WXWIDGETS_USE_SHARED )
201 SET(WX_CONFIG_ARGS "${WX_CONFIG_ARGS} --static=no")
202 ELSE( WXWIDGETS_USE_SHARED )
203 SET(WX_CONFIG_ARGS "${WX_CONFIG_ARGS} --static=yes")
204 ENDIF( WXWIDGETS_USE_SHARED )
206 # Not sure how to check this yet!!!!!
207 IF( WXWIDGETS_USE_MONO )
208 SET(WX_CONFIG_ARGS "${WX_CONFIG_ARGS}")
209 ELSE( WXWIDGETS_USE_MONO )
210 SET(WX_CONFIG_ARGS "${WX_CONFIG_ARGS}")
211 ENDIF( WXWIDGETS_USE_MONO )
213 SET(WX_CONFIG_ARGS_LIBS "${WX_CONFIG_ARGS} --libs")
216 # Platform specific method for testing installed wx Builds
218 IF( WIN32_STYLE_FIND )
221 # See if we have both release and debug wx versions
223 SET ( WX_DEBUGANDRELEASE FALSE )
224 IF( EXISTS "${LIBRARYWANT}/wx/setup.h" )
225 IF( EXISTS "${LIBRARYWANT}d/wx/setup.h" )
226 SET ( WX_DEBUGANDRELEASE TRUE )
227 ENDIF( EXISTS "${LIBRARYWANT}d/wx/setup.h" )
228 ENDIF( EXISTS "${LIBRARYWANT}/wx/setup.h" )
230 SET( LIBRARYWANT "${LIBRARYWANT}${PFDEBUG}" )
231 IF( NOT EXISTS "${LIBRARYWANT}/wx/setup.h" )
232 MESSAGE( SEND_ERROR "ERROR: WXWidgets config NOT found ${WX_CONFIG_ARGS}")
233 ENDIF( NOT EXISTS "${LIBRARYWANT}/wx/setup.h" )
235 ELSE( WIN32_STYLE_FIND )
237 EXEC_PROGRAM(${WX_WXCONFIG_EXECUTABLE}
238 ARGS ${WX_CONFIG_ARGS_LIBS}
239 OUTPUT_VARIABLE WXWIDGETS_LIBRARIES
240 RETURN_VALUE BAD_WXCONFIG )
242 MESSAGE( SEND_ERROR "ERROR: WXWidgets config NOT found ${WX_CONFIG_ARGS}")
245 ENDIF( WIN32_STYLE_FIND )
250 IF( WIN32_STYLE_FIND )
251 # Not used for Windows
252 SET( WXWIDGETS_CXX_FLAGS "" )
253 ELSE( WIN32_STYLE_FIND )
255 # Get CXXFLAGS from wx-config
257 EXEC_PROGRAM(${WX_WXCONFIG_EXECUTABLE}
259 OUTPUT_VARIABLE WXWIDGETS_CXX_FLAGS
260 RETURN_VALUE BAD_WXCONFIG )
262 MESSAGE( SEND_ERROR "ERROR: wx-config --cxxflags returned an error")
264 ENDIF( WIN32_STYLE_FIND )
267 # Find include directories (platform specific)
269 IF( WIN32_STYLE_FIND )
271 # Set non-build specific include directories
273 SET ( WX_INCLUDE_PATH ${WXWIDGETS_ROOT_DIR}/include )
274 SET ( WXWIDGETS_INCLUDE_DIR ${WX_INCLUDE_PATH} )
275 SET( WXWIDGETS_INCLUDE_DIR ${WXWIDGETS_INCLUDE_DIR} ${WXWIDGETS_INCLUDE_DIR}/../contrib/include )
277 # Append the build specific include dir for wx/setup.h:
279 IF ( EXISTS ${LIBRARYWANT}/wx/setup.h )
280 SET( WX_INCLUDE_LIB_PATH ${LIBRARYWANT})
281 SET( WXWIDGETS_INCLUDE_DIR ${WXWIDGETS_INCLUDE_DIR} ${LIBRARYWANT} )
282 ELSE ( EXISTS ${LIBRARYWANT}/wx/setup.h )
283 SET( WX_INCLUDE_LIB_PATH, "")
284 MESSAGE(SEND_ERROR "ERROR: Can't find ${LIBRARYWANT}/wx/setup.h")
285 ENDIF ( EXISTS ${LIBRARYWANT}/wx/setup.h )
287 ELSE( WIN32_STYLE_FIND )
289 # Pull out -I options
290 # evaluate wx-config output to separate include dirs
291 SET(WX_INCLUDE_DIR ${WXWIDGETS_CXX_FLAGS})
292 # extract include dirs (-I)
293 # use regular expression to match wildcard equivalent "-I*<endchar>"
294 # with <endchar> is a space or a semicolon
295 STRING(REGEX MATCHALL "[-][I]([^ ;])+" WX_INCLUDE_DIRS_WITH_PREFIX "${WX_INCLUDE_DIR}" )
296 # remove prefix -I because we need the pure directory
297 IF(WX_INCLUDE_DIRS_WITH_PREFIX)
298 STRING(REGEX REPLACE "[-][I]" ";" WXWIDGETS_INCLUDE_DIR ${WX_INCLUDE_DIRS_WITH_PREFIX} )
299 ENDIF(WX_INCLUDE_DIRS_WITH_PREFIX)
300 # replace space separated string by semicolon separated vector
301 SEPARATE_ARGUMENTS(WXWIDGETS_INCLUDE_DIR)
302 # Remove the -I options from the CXX_FLAGS no need to duplicate
303 STRING(REGEX REPLACE "[-][I]([^ ;])+" "" WXWIDGETS_CXX_FLAGS ${WXWIDGETS_CXX_FLAGS} )
308 IF( NOT CYGWIN OR MINGW )
309 INCLUDE( ${CMAKE_ROOT}/Modules/FindX11.cmake )
310 SET( WXWIDGETS_INCLUDE_DIR ${WXWIDGETS_INCLUDE_DIR} ${X11_INCLUDE_DIR} )
311 ENDIF( NOT CYGWIN OR MINGW )
312 ENDIF( WIN32_STYLE_FIND )
315 # Find library list (platform specific)
317 IF( WIN32_STYLE_FIND )
319 #Misc vars used to build lib names
321 SET( PFLIBEXT ${CMAKE_STATIC_LIBRARY_SUFFIX} )
322 SET( WXPF "${WXPF}${WXVERSIONSUFFIX}" )
323 SET( PFVERSION ${WXVERSIONSUFFIX} )
327 # Build the libraries list
329 SET( WX_TOKEN_LIBS "" )
330 SET( WX_MULTI_LIBRARIES "" )
331 SET( WX_MONO_LIBRARIES "" )
332 SET( WX_DEBUG_TOKEN "@1" )
334 #start filling library string with needed libraries for the choosen configuration.
335 #note we use tokens for debug/release and the debug suffix so we can replace later
336 SET( WXPF "${PFVERSION}${PFUNICODE}${WX_DEBUG_TOKEN}" )
337 SET(WX_MULTI_LIBRARIES ${WX_MULTI_LIBRARIES}
338 wxbase${WXPF}${PFCOMPILER}${PFLIBEXT}
339 wxbase${WXPF}_net${PFCOMPILER}${PFLIBEXT}
340 wxbase${WXPF}_xml${PFCOMPILER}${PFLIBEXT}
343 SET( WXPF "${PFVERSION}${PFUNICODE}${WX_DEBUG_TOKEN}" )
344 SET(WX_MULTI_LIBRARIES ${WX_MULTI_LIBRARIES}
345 wxmsw${WXPF}_adv${PFCOMPILER}${PFLIBEXT}
346 wxmsw${WXPF}_core${PFCOMPILER}${PFLIBEXT}
347 wxmsw${WXPF}_html${PFCOMPILER}${PFLIBEXT}
348 wxmsw${WXPF}_xrc${PFCOMPILER}${PFLIBEXT}
350 IF (WXWIDGETS_USE_MEDIA)
351 SET(WX_MULTI_LIBRARIES ${WX_MULTI_LIBRARIES}
352 wxmsw${WXPF}_media${PFCOMPILER}${PFLIBEXT}
354 ENDIF (WXWIDGETS_USE_MEDIA)
356 IF( NOT WXWIDGETS_USE_SHARED )
357 SET( WXPF "${PFVERSION}${PFUNICODE}${WX_DEBUG_TOKEN}" )
358 IF (WXWIDGETS_USE_ODBC)
359 SET(WX_MULTI_LIBRARIES ${WX_MULTI_LIBRARIES}
360 wxbase${WXPF}_odbc${PFCOMPILER}${PFLIBEXT}
362 ENDIF (WXWIDGETS_USE_ODBC)
364 SET( WXPF "${PFVERSION}${PFUNICODE}${WX_DEBUG_TOKEN}" )
365 IF (WXWIDGETS_USE_DBGRID)
366 SET(WX_MULTI_LIBRARIES ${WX_MULTI_LIBRARIES}
367 wxmsw${WXPF}_dbgrid${PFLIBEXT}
369 ENDIF (WXWIDGETS_USE_DBGRID)
370 IF (WXWIDGETS_USE_GL)
371 SET(WX_MULTI_LIBRARIES ${WX_MULTI_LIBRARIES}
372 wxmsw${WXPF}_gl${PFCOMPILER}${PFLIBEXT}
374 ENDIF (WXWIDGETS_USE_GL)
375 ENDIF( NOT WXWIDGETS_USE_SHARED )
377 IF ( WXWIDGETS_USE_UNIV )
378 SET( WXPF "${PFUNIV}${PFVERSION}${PFUNICODE}${WX_DEBUG_TOKEN}" )
379 SET(WX_MULTI_LIBRARIES ${WX_MULTI_LIBRARIES}
380 wxmsw${WXPF}_core${PFCOMPILER}${PFLIBEXT}
382 ENDIF ( WXWIDGETS_USE_UNIV )
384 SET(WX_MONO_LIBRARIES ${WX_MONO_LIBRARIES}
385 wxmsw${WXPF}${PFCOMPILER}${PFLIBEXT}
388 IF ( WXWIDGETS_USE_MONO )
389 SET(WX_TOKEN_LIBS ${WX_TOKEN_LIBS} ${WX_MONO_LIBRARIES})
390 ELSE ( WXWIDGETS_USE_MONO )
391 SET(WX_TOKEN_LIBS ${WX_TOKEN_LIBS} ${WX_MULTI_LIBRARIES})
392 ENDIF ( WXWIDGETS_USE_MONO )
394 SET( WXPF "${PFUNICODE}${WX_DEBUG_TOKEN}" )
395 SET(WX_TOKEN_LIBS ${WX_TOKEN_LIBS}
399 SET( WXPF "${WX_DEBUG_TOKEN}" )
400 SET(WX_TOKEN_LIBS ${WX_TOKEN_LIBS}
409 SET( WXWIDGETS_COMMON_LIBRARIES
410 comctl32${PFLIBEXT} wsock32${PFLIBEXT} rpcrt4${PFLIBEXT}
413 #Build release/debug lists by replacing tokens
415 SET( WXWIDGETS_RELEASE_LIBRARIES "" )
416 FOREACH(LOOPLIB ${WX_TOKEN_LIBS})
417 SET(WX_TMPLIB ${LOOPLIB})
418 STRING(REGEX REPLACE "[@][1]" "" WX_TMPLIB ${WX_TMPLIB} )
419 SET( WXWIDGETS_RELEASE_LIBRARIES ${WXWIDGETS_RELEASE_LIBRARIES}
422 ENDFOREACH(LOOPLIB ${WX_TOKEN_LIBS})
423 SET( WXWIDGETS_DEBUG_LIBRARIES "" )
424 FOREACH(LOOPLIB ${WX_TOKEN_LIBS})
425 SET(WX_TMPLIB ${LOOPLIB})
426 STRING(REGEX REPLACE "[@][1]" "d" WX_TMPLIB ${WX_TMPLIB} )
427 SET( WXWIDGETS_DEBUG_LIBRARIES ${WXWIDGETS_DEBUG_LIBRARIES}
430 ENDFOREACH(LOOPLIB ${WX_TOKEN_LIBS})
433 # Set full lib list to requested type
435 IF( WXWIDGETS_USE_DEBUG )
436 SET( WXWIDGETS_LIBRARIES ${WXWIDGETS_COMMON_LIBRARIES}
437 ${WXWIDGETS_DEBUG_LIBRARIES}
439 ELSE( WXWIDGETS_USE_DEBUG )
440 SET( WXWIDGETS_LIBRARIES ${WXWIDGETS_COMMON_LIBRARIES}
441 ${WXWIDGETS_RELEASE_LIBRARIES}
443 ENDIF( WXWIDGETS_USE_DEBUG )
445 #Not used under Windows
446 SET( WXWIDGETS_EXE_LINKER_FLAGS "" )
448 ELSE( WIN32_STYLE_FIND )
450 # Get Library list from wx-config
452 # do we need additionial wx GL stuff like GLCanvas ?
454 SET(WX_CONFIG_ARGS_LIBS "${WX_CONFIG_ARGS_LIBS} --gl-libs" )
455 ENDIF(WXWIDGETS_USE_GL)
457 EXEC_PROGRAM(${WX_WXCONFIG_EXECUTABLE}
458 ARGS ${WX_CONFIG_ARGS_LIBS}
459 OUTPUT_VARIABLE WX_CONFIGARGS
460 RETURN_VALUE BAD_WXCONFIG )
462 MESSAGE( SEND_ERROR "ERROR: Specified WXWidgets config NOT found")
465 #Pull lib dirs, linker opts, and libs from wx-config --libs return
466 SET(WXWIDGETS_LINK_DIRECTORIES "")
467 SET(WXWIDGETS_EXE_LINKER_FLAGS "")
468 SET(WXWIDGETS_LIBRARIES "")
469 SEPARATE_ARGUMENTS(WX_CONFIGARGS)
470 FILE( WRITE "${PROJECT_BINARY_DIR}/findwxw-args.log" "WXWIDGETS ARGS\n" )
471 FOREACH(WXARG ${WX_CONFIGARGS})
472 FILE( APPEND "${PROJECT_BINARY_DIR}/findwxw-args.log" "WXARG: ${WXARG}\n" )
473 IF(WXARG MATCHES "^-L")
474 SET(WXWIDGETS_LINK_DIRECTORIES ${WXWIDGETS_LINK_DIRECTORIES} ${WXARG})
475 ELSE(WXARG MATCHES "^-L")
476 IF(WXARG MATCHES "^-l")
477 SET(WXWIDGETS_LIBRARIES "${WXWIDGETS_LIBRARIES} ${WXARG}")
478 ELSE(WXARG MATCHES "^-l")
479 IF(WXARG MATCHES "^-")
480 SET(WXWIDGETS_EXE_LINKER_FLAGS "${WXWIDGETS_EXE_LINKER_FLAGS} ${WXARG}")
481 ELSE(WXARG MATCHES "^-")
482 SET(WXWIDGETS_LIBRARIES "${WXWIDGETS_LIBRARIES} ${WXARG}")
483 ENDIF(WXARG MATCHES "^-")
484 ENDIF(WXARG MATCHES "^-l")
485 ENDIF(WXARG MATCHES "^-L")
486 ENDFOREACH(WXARG ${WX_CONFIGARGS})
488 #Separate library names with ;
489 SEPARATE_ARGUMENTS(WXWIDGETS_LIBRARIES)
491 # remove prefix -L because we need the pure directory for LINK_DIRECTORIES
492 # replace -L by ; because the separator seems to be lost otherwise (bug or
494 SET(WX_LINK_DIRECTORIES_WITH_PREFIX ${WXWIDGETS_LINK_DIRECTORIES})
495 IF(WX_LINK_DIRECTORIES_WITH_PREFIX)
496 STRING(REGEX REPLACE "[-][L]" ";" WXWIDGETS_LINK_DIRECTORIES ${WX_LINK_DIRECTORIES_WITH_PREFIX} )
497 #MESSAGE("DBG WXWIDGETS_LINK_DIRECTORIES=${WXWIDGETS_LINK_DIRECTORIES}")
498 ENDIF(WX_LINK_DIRECTORIES_WITH_PREFIX)
499 # replace space separated string by semicolon separated vector to make it
500 # work with LINK_DIRECTORIES
501 SEPARATE_ARGUMENTS(WXWIDGETS_LINK_DIRECTORIES)
505 # Unix puts all the libs in the WXWIDGETS_LIBRARIES var
506 # We don't know debug/release libs under unix, so we set the
507 # common var to full set as well and leave debug/release sets blank
509 SET( WXWIDGETS_RELEASE_LIBRARIES "" )
510 SET( WXWIDGETS_DEBUG_LIBRARIES "" )
511 SET(WXWIDGETS_COMMON_LIBRARIES ${WXWIDGETS_LIBRARIES})
513 ENDIF( WIN32_STYLE_FIND )
519 SET( WXWIDGETS_RC ${WXWIDGETS_ROOT_DIR}/include/wx/msw/wx.rc )
520 IF( NOT WIN32_STYLE_FIND )
521 IF( NOT CYGWIN OR MINGW )
522 SET( WXWIDGETS_RC "" )
523 ENDIF( NOT CYGWIN OR MINGW )
524 ENDIF( NOT WIN32_STYLE_FIND )
527 # Set preprocessor defs
529 STRING(TOUPPER ${CMAKE_SYSTEM_NAME} WX_SYSNAME)
530 SET( WXWIDGETS_DEFINITIONS ${WXWIDGETS_DEFINITIONS} "-D${WX_SYSNAME}" )
533 SET( WXWIDGETS_DEFINITIONS ${WXWIDGETS_DEFINITIONS} -DWIN32 -D__WXMSW__ )
534 ELSE(WIN32_STYLE_FIND)
536 SET( WXWIDGETS_DEFINITIONS ${WXWIDGETS_DEFINITIONS} -D__GNUWIN32__ -O2 -D_WIN32_IE=0x400 -MMD -Wall )
538 ENDIF(WIN32_STYLE_FIND)
540 IF( WXWIDGETS_USE_SHARED )
541 SET( WXWIDGETS_DEFINITIONS ${WXWIDGETS_DEFINITIONS} -DWXUSINGDLL )
542 ENDIF( WXWIDGETS_USE_SHARED )
544 IF( WXWIDGETS_USE_DEBUG )
545 SET( WXWIDGETS_DEFINITIONS ${WXWIDGETS_DEFINITIONS} -D_DEBUG_ -D__WXDEBUG__ -DWXDEBUG=1 )
546 ENDIF( WXWIDGETS_USE_DEBUG )
548 IF ( WXWIDGETS_USE_UNICODE )
549 SET( WXWIDGETS_DEFINITIONS ${WXWIDGETS_DEFINITIONS} -DwxUSE_UNICODE )
550 ENDIF ( WXWIDGETS_USE_UNICODE )
553 # Set the WXWIDGETS_FOUND var
555 IF(WXWIDGETS_LIBRARIES AND WXWIDGETS_INCLUDE_DIR)
556 SET(WXWIDGETS_FOUND 1)
557 ENDIF(WXWIDGETS_LIBRARIES AND WXWIDGETS_INCLUDE_DIR)
562 MARK_AS_ADVANCED(WXWIDGETS_ROOT_DIR)
567 FILE( WRITE "${PROJECT_BINARY_DIR}/findwxw.log" "FindwxW.cmake version 1.06\n" )
568 FILE( APPEND "${PROJECT_BINARY_DIR}/findwxw.log" "WXWIDGETS_FOUND: ${WXWIDGETS_FOUND}\n" )
569 FILE( APPEND "${PROJECT_BINARY_DIR}/findwxw.log" "WXWIDGETS_LINK_DIRECTORIES: ${WXWIDGETS_LINK_DIRECTORIES}\n" )
570 FILE( APPEND "${PROJECT_BINARY_DIR}/findwxw.log" "WXWIDGETS_LIBRARIES: ${WXWIDGETS_LIBRARIES}\n" )
571 FILE( APPEND "${PROJECT_BINARY_DIR}/findwxw.log" "WXWIDGETS_RELEASE_LIBRARIES: ${WXWIDGETS_RELEASE_LIBRARIES}\n" )
572 FILE( APPEND "${PROJECT_BINARY_DIR}/findwxw.log" "WXWIDGETS_DEBUG_LIBRARIES: ${WXWIDGETS_DEBUG_LIBRARIES}\n" )
573 FILE( APPEND "${PROJECT_BINARY_DIR}/findwxw.log" "WXWIDGETS_CXX_FLAGS: ${WXWIDGETS_CXX_FLAGS}\n" )
574 FILE( APPEND "${PROJECT_BINARY_DIR}/findwxw.log" "WXWIDGETS_EXE_LINKER_FLAGS: ${WXWIDGETS_EXE_LINKER_FLAGS}\n" )
575 FILE( APPEND "${PROJECT_BINARY_DIR}/findwxw.log" "WXWIDGETS_INCLUDE_DIR: ${WXWIDGETS_INCLUDE_DIR}\n" )
576 FILE( APPEND "${PROJECT_BINARY_DIR}/findwxw.log" "WXWIDGETS_DEFINITIONS: ${WXWIDGETS_DEFINITIONS}\n" )