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 #DFCH: If x64 architecture
131 IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
132 IF( WXWIDGETS_USE_SHARED )
133 SET(WXWIDGETS_LIB_PATH "${WXWIDGETS_ROOT_DIR}/lib/vc_amd64_dll" )
134 ELSE( WXWIDGETS_USE_SHARED )
135 SET(WXWIDGETS_LIB_PATH "${WXWIDGETS_ROOT_DIR}/lib/vc_amd64_lib" )
136 ENDIF( WXWIDGETS_USE_SHARED )
137 ELSE (CMAKE_SIZEOF_VOID_P EQUAL 8)
138 IF( WXWIDGETS_USE_SHARED )
139 SET(WXWIDGETS_LIB_PATH "${WXWIDGETS_ROOT_DIR}/lib/vc_dll" )
140 ELSE( WXWIDGETS_USE_SHARED )
141 SET(WXWIDGETS_LIB_PATH "${WXWIDGETS_ROOT_DIR}/lib/vc_lib" )
142 ENDIF( WXWIDGETS_USE_SHARED )
143 ENDIF (CMAKE_SIZEOF_VOID_P EQUAL 8)
144 SET( WXWIDGETS_LINK_DIRECTORIES ${WXWIDGETS_LIB_PATH} )
146 ELSE( WIN32_STYLE_FIND )
150 # Unix uses a config specific directory under the install path
151 # specified in the WXWINCFG environment variable.
152 # If the WXWINCFG variable isn't set, we try a sym link within
153 # the WX root dir called wx-config, or the current PATH
155 FIND_PROGRAM( WX_WXCONFIG_EXECUTABLE
157 "${WXWIDGETS_ROOT_DIR}/$ENV{WXWINCFG}"
158 "${WXWIDGETS_ROOT_DIR}/wx-config" )
160 # Check wether wx-config can be found
162 IF(NOT EXISTS ${WX_WXCONFIG_EXECUTABLE})
163 # we really need wx-config...
164 MESSAGE(FATAL_ERROR "FATAL_ERROR: Cannot find wx-config. Set WXWIN and WXWINCFG environment variables.")
165 ENDIF(NOT EXISTS ${WX_WXCONFIG_EXECUTABLE})
167 GET_FILENAME_COMPONENT( WXWIDGETS_CONFIG_PATH
168 WX_WXCONFIG_EXECUTABLE
171 SET(WXWIDGETS_LIB_PATH "${WXWIDGETS_CONFIG_PATH}/lib" )
172 SET( WXWIDGETS_LINK_DIRECTORIES ${WXWIDGETS_LIB_PATH} )
174 ELSE(UNIX_STYLE_FIND)
175 MESSAGE(FATAL_ERROR "FATAL_ERROR: FindwxWindows.cmake: Platform unsupported by FindwxW.cmake. It's neither WIN32 nor UNIX")
176 ENDIF(UNIX_STYLE_FIND)
177 ENDIF( WIN32_STYLE_FIND )
180 # Check options against installed libraries
182 SET(WX_CONFIG_ARGS "")
183 SET( LIBRARYWANT "${WXWIDGETS_LIB_PATH}/msw" )
185 IF( WXWIDGETS_USE_UNIV )
186 SET( LIBRARYWANT "${LIBRARYWANT}univ")
188 SET(WX_CONFIG_ARGS "${WX_CONFIG_ARGS} --universal=yes")
189 ELSE( WXWIDGETS_USE_UNIV )
190 SET(WX_CONFIG_ARGS "${WX_CONFIG_ARGS} --universal=no")
191 ENDIF( WXWIDGETS_USE_UNIV )
193 IF( WXWIDGETS_USE_UNICODE )
194 SET( LIBRARYWANT "${LIBRARYWANT}u" )
196 SET(WX_CONFIG_ARGS "${WX_CONFIG_ARGS} --unicode=yes")
197 ELSE( WXWIDGETS_USE_UNICODE )
198 SET(WX_CONFIG_ARGS "${WX_CONFIG_ARGS} --unicode=no")
199 ENDIF( WXWIDGETS_USE_UNICODE )
201 IF( WXWIDGETS_USE_DEBUG )
203 SET(WX_CONFIG_ARGS "${WX_CONFIG_ARGS} --debug=yes")
204 ELSE( WXWIDGETS_USE_DEBUG )
206 SET(WX_CONFIG_ARGS "${WX_CONFIG_ARGS} --debug=no")
207 ENDIF( WXWIDGETS_USE_DEBUG )
209 IF( WXWIDGETS_USE_SHARED )
210 SET(WX_CONFIG_ARGS "${WX_CONFIG_ARGS} --static=no")
211 ELSE( WXWIDGETS_USE_SHARED )
212 SET(WX_CONFIG_ARGS "${WX_CONFIG_ARGS} --static=yes")
213 ENDIF( WXWIDGETS_USE_SHARED )
215 # Not sure how to check this yet!!!!!
216 IF( WXWIDGETS_USE_MONO )
217 SET(WX_CONFIG_ARGS "${WX_CONFIG_ARGS}")
218 ELSE( WXWIDGETS_USE_MONO )
219 SET(WX_CONFIG_ARGS "${WX_CONFIG_ARGS}")
220 ENDIF( WXWIDGETS_USE_MONO )
222 SET(WX_CONFIG_ARGS_LIBS "${WX_CONFIG_ARGS} --libs")
225 # Platform specific method for testing installed wx Builds
227 IF( WIN32_STYLE_FIND )
230 # See if we have both release and debug wx versions
232 SET ( WX_DEBUGANDRELEASE FALSE )
233 IF( EXISTS "${LIBRARYWANT}/wx/setup.h" )
234 IF( EXISTS "${LIBRARYWANT}d/wx/setup.h" )
235 SET ( WX_DEBUGANDRELEASE TRUE )
236 ENDIF( EXISTS "${LIBRARYWANT}d/wx/setup.h" )
237 ENDIF( EXISTS "${LIBRARYWANT}/wx/setup.h" )
239 SET( LIBRARYWANT "${LIBRARYWANT}${PFDEBUG}" )
240 IF( NOT EXISTS "${LIBRARYWANT}/wx/setup.h" )
241 MESSAGE( SEND_ERROR "ERROR: WXWidgets config NOT found ${WX_CONFIG_ARGS}")
242 ENDIF( NOT EXISTS "${LIBRARYWANT}/wx/setup.h" )
244 ELSE( WIN32_STYLE_FIND )
246 EXEC_PROGRAM(${WX_WXCONFIG_EXECUTABLE}
247 ARGS ${WX_CONFIG_ARGS_LIBS}
248 OUTPUT_VARIABLE WXWIDGETS_LIBRARIES
249 RETURN_VALUE BAD_WXCONFIG )
251 MESSAGE( SEND_ERROR "ERROR: WXWidgets config NOT found ${WX_CONFIG_ARGS}")
254 ENDIF( WIN32_STYLE_FIND )
259 IF( WIN32_STYLE_FIND )
260 # Not used for Windows
261 SET( WXWIDGETS_CXX_FLAGS "" )
262 ELSE( WIN32_STYLE_FIND )
264 # Get CXXFLAGS from wx-config
266 EXEC_PROGRAM(${WX_WXCONFIG_EXECUTABLE}
268 OUTPUT_VARIABLE WXWIDGETS_CXX_FLAGS
269 RETURN_VALUE BAD_WXCONFIG )
271 MESSAGE( SEND_ERROR "ERROR: wx-config --cxxflags returned an error")
273 ENDIF( WIN32_STYLE_FIND )
276 # Find include directories (platform specific)
278 IF( WIN32_STYLE_FIND )
280 # Set non-build specific include directories
282 SET ( WX_INCLUDE_PATH ${WXWIDGETS_ROOT_DIR}/include )
283 SET ( WXWIDGETS_INCLUDE_DIR ${WX_INCLUDE_PATH} )
284 SET( WXWIDGETS_INCLUDE_DIR ${WXWIDGETS_INCLUDE_DIR} ${WXWIDGETS_INCLUDE_DIR}/../contrib/include )
286 # Append the build specific include dir for wx/setup.h:
288 IF ( EXISTS ${LIBRARYWANT}/wx/setup.h )
289 SET( WX_INCLUDE_LIB_PATH ${LIBRARYWANT})
290 SET( WXWIDGETS_INCLUDE_DIR ${WXWIDGETS_INCLUDE_DIR} ${LIBRARYWANT} )
291 ELSE ( EXISTS ${LIBRARYWANT}/wx/setup.h )
292 SET( WX_INCLUDE_LIB_PATH, "")
293 MESSAGE(SEND_ERROR "ERROR: Can't find ${LIBRARYWANT}/wx/setup.h")
294 ENDIF ( EXISTS ${LIBRARYWANT}/wx/setup.h )
296 ELSE( WIN32_STYLE_FIND )
298 # Pull out -I options
299 # evaluate wx-config output to separate include dirs
300 SET(WX_INCLUDE_DIR ${WXWIDGETS_CXX_FLAGS})
301 # extract include dirs (-I)
302 # use regular expression to match wildcard equivalent "-I*<endchar>"
303 # with <endchar> is a space or a semicolon
304 STRING(REGEX MATCHALL "[-][I]([^ ;])+" WX_INCLUDE_DIRS_WITH_PREFIX "${WX_INCLUDE_DIR}" )
305 # remove prefix -I because we need the pure directory
306 IF(WX_INCLUDE_DIRS_WITH_PREFIX)
307 STRING(REGEX REPLACE "[-][I]" ";" WXWIDGETS_INCLUDE_DIR ${WX_INCLUDE_DIRS_WITH_PREFIX} )
308 ENDIF(WX_INCLUDE_DIRS_WITH_PREFIX)
309 # replace space separated string by semicolon separated vector
310 SEPARATE_ARGUMENTS(WXWIDGETS_INCLUDE_DIR)
311 # Remove the -I options from the CXX_FLAGS no need to duplicate
312 STRING(REGEX REPLACE "[-][I]([^ ;])+" "" WXWIDGETS_CXX_FLAGS ${WXWIDGETS_CXX_FLAGS} )
317 IF( NOT CYGWIN OR MINGW )
318 INCLUDE( ${CMAKE_ROOT}/Modules/FindX11.cmake )
319 SET( WXWIDGETS_INCLUDE_DIR ${WXWIDGETS_INCLUDE_DIR} ${X11_INCLUDE_DIR} )
320 ENDIF( NOT CYGWIN OR MINGW )
321 ENDIF( WIN32_STYLE_FIND )
324 # Find library list (platform specific)
326 IF( WIN32_STYLE_FIND )
328 #Misc vars used to build lib names
330 SET( PFLIBEXT ${CMAKE_STATIC_LIBRARY_SUFFIX} )
331 SET( WXPF "${WXPF}${WXVERSIONSUFFIX}" )
332 SET( PFVERSION ${WXVERSIONSUFFIX} )
336 # Build the libraries list
338 SET( WX_TOKEN_LIBS "" )
339 SET( WX_MULTI_LIBRARIES "" )
340 SET( WX_MONO_LIBRARIES "" )
341 SET( WX_DEBUG_TOKEN "@1" )
343 #start filling library string with needed libraries for the choosen configuration.
344 #note we use tokens for debug/release and the debug suffix so we can replace later
345 SET( WXPF "${PFVERSION}${PFUNICODE}${WX_DEBUG_TOKEN}" )
346 SET(WX_MULTI_LIBRARIES ${WX_MULTI_LIBRARIES}
347 wxbase${WXPF}${PFCOMPILER}${PFLIBEXT}
348 wxbase${WXPF}_net${PFCOMPILER}${PFLIBEXT}
349 wxbase${WXPF}_xml${PFCOMPILER}${PFLIBEXT}
352 SET( WXPF "${PFVERSION}${PFUNICODE}${WX_DEBUG_TOKEN}" )
353 SET(WX_MULTI_LIBRARIES ${WX_MULTI_LIBRARIES}
354 wxmsw${WXPF}_adv${PFCOMPILER}${PFLIBEXT}
355 wxmsw${WXPF}_core${PFCOMPILER}${PFLIBEXT}
356 wxmsw${WXPF}_html${PFCOMPILER}${PFLIBEXT}
357 wxmsw${WXPF}_xrc${PFCOMPILER}${PFLIBEXT}
359 IF (WXWIDGETS_USE_MEDIA)
360 SET(WX_MULTI_LIBRARIES ${WX_MULTI_LIBRARIES}
361 wxmsw${WXPF}_media${PFCOMPILER}${PFLIBEXT}
363 ENDIF (WXWIDGETS_USE_MEDIA)
365 IF( NOT WXWIDGETS_USE_SHARED )
366 SET( WXPF "${PFVERSION}${PFUNICODE}${WX_DEBUG_TOKEN}" )
367 IF (WXWIDGETS_USE_ODBC)
368 SET(WX_MULTI_LIBRARIES ${WX_MULTI_LIBRARIES}
369 wxbase${WXPF}_odbc${PFCOMPILER}${PFLIBEXT}
371 ENDIF (WXWIDGETS_USE_ODBC)
373 SET( WXPF "${PFVERSION}${PFUNICODE}${WX_DEBUG_TOKEN}" )
374 IF (WXWIDGETS_USE_DBGRID)
375 SET(WX_MULTI_LIBRARIES ${WX_MULTI_LIBRARIES}
376 wxmsw${WXPF}_dbgrid${PFLIBEXT}
378 ENDIF (WXWIDGETS_USE_DBGRID)
379 IF (WXWIDGETS_USE_GL)
380 SET(WX_MULTI_LIBRARIES ${WX_MULTI_LIBRARIES}
381 wxmsw${WXPF}_gl${PFCOMPILER}${PFLIBEXT}
383 ENDIF (WXWIDGETS_USE_GL)
384 ENDIF( NOT WXWIDGETS_USE_SHARED )
386 IF ( WXWIDGETS_USE_UNIV )
387 SET( WXPF "${PFUNIV}${PFVERSION}${PFUNICODE}${WX_DEBUG_TOKEN}" )
388 SET(WX_MULTI_LIBRARIES ${WX_MULTI_LIBRARIES}
389 wxmsw${WXPF}_core${PFCOMPILER}${PFLIBEXT}
391 ENDIF ( WXWIDGETS_USE_UNIV )
393 SET(WX_MONO_LIBRARIES ${WX_MONO_LIBRARIES}
394 wxmsw${WXPF}${PFCOMPILER}${PFLIBEXT}
397 IF ( WXWIDGETS_USE_MONO )
398 SET(WX_TOKEN_LIBS ${WX_TOKEN_LIBS} ${WX_MONO_LIBRARIES})
399 ELSE ( WXWIDGETS_USE_MONO )
400 SET(WX_TOKEN_LIBS ${WX_TOKEN_LIBS} ${WX_MULTI_LIBRARIES})
401 ENDIF ( WXWIDGETS_USE_MONO )
403 SET( WXPF "${PFUNICODE}${WX_DEBUG_TOKEN}" )
404 SET(WX_TOKEN_LIBS ${WX_TOKEN_LIBS}
408 SET( WXPF "${WX_DEBUG_TOKEN}" )
409 SET(WX_TOKEN_LIBS ${WX_TOKEN_LIBS}
418 SET( WXWIDGETS_COMMON_LIBRARIES
419 comctl32${PFLIBEXT} wsock32${PFLIBEXT} rpcrt4${PFLIBEXT}
422 #Build release/debug lists by replacing tokens
424 SET( WXWIDGETS_RELEASE_LIBRARIES "" )
425 FOREACH(LOOPLIB ${WX_TOKEN_LIBS})
426 SET(WX_TMPLIB ${LOOPLIB})
427 STRING(REGEX REPLACE "[@][1]" "" WX_TMPLIB ${WX_TMPLIB} )
428 SET( WXWIDGETS_RELEASE_LIBRARIES ${WXWIDGETS_RELEASE_LIBRARIES}
431 ENDFOREACH(LOOPLIB ${WX_TOKEN_LIBS})
432 SET( WXWIDGETS_DEBUG_LIBRARIES "" )
433 FOREACH(LOOPLIB ${WX_TOKEN_LIBS})
434 SET(WX_TMPLIB ${LOOPLIB})
435 STRING(REGEX REPLACE "[@][1]" "d" WX_TMPLIB ${WX_TMPLIB} )
436 SET( WXWIDGETS_DEBUG_LIBRARIES ${WXWIDGETS_DEBUG_LIBRARIES}
439 ENDFOREACH(LOOPLIB ${WX_TOKEN_LIBS})
442 # Set full lib list to requested type
444 IF( WXWIDGETS_USE_DEBUG )
445 SET( WXWIDGETS_LIBRARIES ${WXWIDGETS_COMMON_LIBRARIES}
446 ${WXWIDGETS_DEBUG_LIBRARIES}
448 ELSE( WXWIDGETS_USE_DEBUG )
449 SET( WXWIDGETS_LIBRARIES ${WXWIDGETS_COMMON_LIBRARIES}
450 ${WXWIDGETS_RELEASE_LIBRARIES}
452 ENDIF( WXWIDGETS_USE_DEBUG )
454 #Not used under Windows
455 SET( WXWIDGETS_EXE_LINKER_FLAGS "" )
457 ELSE( WIN32_STYLE_FIND )
459 # Get Library list from wx-config
461 # do we need additionial wx GL stuff like GLCanvas ?
463 SET(WX_CONFIG_ARGS_LIBS "${WX_CONFIG_ARGS_LIBS} --gl-libs" )
464 ENDIF(WXWIDGETS_USE_GL)
466 EXEC_PROGRAM(${WX_WXCONFIG_EXECUTABLE}
467 ARGS ${WX_CONFIG_ARGS_LIBS}
468 OUTPUT_VARIABLE WX_CONFIGARGS
469 RETURN_VALUE BAD_WXCONFIG )
471 MESSAGE( SEND_ERROR "ERROR: Specified WXWidgets config NOT found")
474 #Pull lib dirs, linker opts, and libs from wx-config --libs return
475 SET(WXWIDGETS_LINK_DIRECTORIES "")
476 SET(WXWIDGETS_EXE_LINKER_FLAGS "")
477 SET(WXWIDGETS_LIBRARIES "")
478 SEPARATE_ARGUMENTS(WX_CONFIGARGS)
479 FILE( WRITE "${PROJECT_BINARY_DIR}/findwxw-args.log" "WXWIDGETS ARGS\n" )
480 FOREACH(WXARG ${WX_CONFIGARGS})
481 FILE( APPEND "${PROJECT_BINARY_DIR}/findwxw-args.log" "WXARG: ${WXARG}\n" )
482 IF(WXARG MATCHES "^-L")
483 SET(WXWIDGETS_LINK_DIRECTORIES ${WXWIDGETS_LINK_DIRECTORIES} ${WXARG})
484 ELSE(WXARG MATCHES "^-L")
485 IF(WXARG MATCHES "^-l")
486 SET(WXWIDGETS_LIBRARIES "${WXWIDGETS_LIBRARIES} ${WXARG}")
487 ELSE(WXARG MATCHES "^-l")
488 IF(WXARG MATCHES "^-")
489 SET(WXWIDGETS_EXE_LINKER_FLAGS "${WXWIDGETS_EXE_LINKER_FLAGS} ${WXARG}")
490 ELSE(WXARG MATCHES "^-")
491 SET(WXWIDGETS_LIBRARIES "${WXWIDGETS_LIBRARIES} ${WXARG}")
492 ENDIF(WXARG MATCHES "^-")
493 ENDIF(WXARG MATCHES "^-l")
494 ENDIF(WXARG MATCHES "^-L")
495 ENDFOREACH(WXARG ${WX_CONFIGARGS})
497 #Separate library names with ;
498 SEPARATE_ARGUMENTS(WXWIDGETS_LIBRARIES)
500 # remove prefix -L because we need the pure directory for LINK_DIRECTORIES
501 # replace -L by ; because the separator seems to be lost otherwise (bug or
503 SET(WX_LINK_DIRECTORIES_WITH_PREFIX ${WXWIDGETS_LINK_DIRECTORIES})
504 IF(WX_LINK_DIRECTORIES_WITH_PREFIX)
505 STRING(REGEX REPLACE "[-][L]" ";" WXWIDGETS_LINK_DIRECTORIES ${WX_LINK_DIRECTORIES_WITH_PREFIX} )
506 #MESSAGE("DBG WXWIDGETS_LINK_DIRECTORIES=${WXWIDGETS_LINK_DIRECTORIES}")
507 ENDIF(WX_LINK_DIRECTORIES_WITH_PREFIX)
508 # replace space separated string by semicolon separated vector to make it
509 # work with LINK_DIRECTORIES
510 SEPARATE_ARGUMENTS(WXWIDGETS_LINK_DIRECTORIES)
514 # Unix puts all the libs in the WXWIDGETS_LIBRARIES var
515 # We don't know debug/release libs under unix, so we set the
516 # common var to full set as well and leave debug/release sets blank
518 SET( WXWIDGETS_RELEASE_LIBRARIES "" )
519 SET( WXWIDGETS_DEBUG_LIBRARIES "" )
520 SET(WXWIDGETS_COMMON_LIBRARIES ${WXWIDGETS_LIBRARIES})
522 ENDIF( WIN32_STYLE_FIND )
528 SET( WXWIDGETS_RC ${WXWIDGETS_ROOT_DIR}/include/wx/msw/wx.rc )
529 IF( NOT WIN32_STYLE_FIND )
530 IF( NOT CYGWIN OR MINGW )
531 SET( WXWIDGETS_RC "" )
532 ENDIF( NOT CYGWIN OR MINGW )
533 ENDIF( NOT WIN32_STYLE_FIND )
536 # Set preprocessor defs
538 STRING(TOUPPER ${CMAKE_SYSTEM_NAME} WX_SYSNAME)
539 SET( WXWIDGETS_DEFINITIONS ${WXWIDGETS_DEFINITIONS} "-D${WX_SYSNAME}" )
542 SET( WXWIDGETS_DEFINITIONS ${WXWIDGETS_DEFINITIONS} -DWIN32 -D__WXMSW__ )
543 ELSE(WIN32_STYLE_FIND)
545 SET( WXWIDGETS_DEFINITIONS ${WXWIDGETS_DEFINITIONS} -D__GNUWIN32__ -O2 -D_WIN32_IE=0x400 -MMD -Wall )
547 ENDIF(WIN32_STYLE_FIND)
549 IF( WXWIDGETS_USE_SHARED )
550 SET( WXWIDGETS_DEFINITIONS ${WXWIDGETS_DEFINITIONS} -DWXUSINGDLL )
551 ENDIF( WXWIDGETS_USE_SHARED )
553 IF( WXWIDGETS_USE_DEBUG )
554 SET( WXWIDGETS_DEFINITIONS ${WXWIDGETS_DEFINITIONS} -D_DEBUG_ -D__WXDEBUG__ -DWXDEBUG=1 )
555 ENDIF( WXWIDGETS_USE_DEBUG )
557 IF ( WXWIDGETS_USE_UNICODE )
558 SET( WXWIDGETS_DEFINITIONS ${WXWIDGETS_DEFINITIONS} -DwxUSE_UNICODE )
559 ENDIF ( WXWIDGETS_USE_UNICODE )
562 # Set the WXWIDGETS_FOUND var
564 IF(WXWIDGETS_LIBRARIES AND WXWIDGETS_INCLUDE_DIR)
565 SET(WXWIDGETS_FOUND 1)
566 ENDIF(WXWIDGETS_LIBRARIES AND WXWIDGETS_INCLUDE_DIR)
571 MARK_AS_ADVANCED(WXWIDGETS_ROOT_DIR)
576 FILE( WRITE "${PROJECT_BINARY_DIR}/findwxw.log" "FindwxW.cmake version 1.06\n" )
577 FILE( APPEND "${PROJECT_BINARY_DIR}/findwxw.log" "WXWIDGETS_FOUND: ${WXWIDGETS_FOUND}\n" )
578 FILE( APPEND "${PROJECT_BINARY_DIR}/findwxw.log" "WXWIDGETS_LINK_DIRECTORIES: ${WXWIDGETS_LINK_DIRECTORIES}\n" )
579 FILE( APPEND "${PROJECT_BINARY_DIR}/findwxw.log" "WXWIDGETS_LIBRARIES: ${WXWIDGETS_LIBRARIES}\n" )
580 FILE( APPEND "${PROJECT_BINARY_DIR}/findwxw.log" "WXWIDGETS_RELEASE_LIBRARIES: ${WXWIDGETS_RELEASE_LIBRARIES}\n" )
581 FILE( APPEND "${PROJECT_BINARY_DIR}/findwxw.log" "WXWIDGETS_DEBUG_LIBRARIES: ${WXWIDGETS_DEBUG_LIBRARIES}\n" )
582 FILE( APPEND "${PROJECT_BINARY_DIR}/findwxw.log" "WXWIDGETS_CXX_FLAGS: ${WXWIDGETS_CXX_FLAGS}\n" )
583 FILE( APPEND "${PROJECT_BINARY_DIR}/findwxw.log" "WXWIDGETS_EXE_LINKER_FLAGS: ${WXWIDGETS_EXE_LINKER_FLAGS}\n" )
584 FILE( APPEND "${PROJECT_BINARY_DIR}/findwxw.log" "WXWIDGETS_INCLUDE_DIR: ${WXWIDGETS_INCLUDE_DIR}\n" )
585 FILE( APPEND "${PROJECT_BINARY_DIR}/findwxw.log" "WXWIDGETS_DEFINITIONS: ${WXWIDGETS_DEFINITIONS}\n" )