1# Distributed under the OSI-approved BSD 3-Clause License. See accompanying 2# file Copyright.txt or https://cmake.org/licensing for details. 3 4#[=======================================================================[.rst: 5FindwxWindows 6------------- 7 8.. deprecated:: 3.0 9 10 Replaced by :module:`FindwxWidgets`. 11 12Find wxWindows (wxWidgets) installation 13 14This module finds if wxWindows/wxWidgets is installed and determines 15where the include files and libraries are. It also determines what 16the name of the library is. This code sets the following variables: 17 18:: 19 20 WXWINDOWS_FOUND = system has WxWindows 21 WXWINDOWS_LIBRARIES = path to the wxWindows libraries 22 on Unix/Linux with additional 23 linker flags from 24 "wx-config --libs" 25 CMAKE_WXWINDOWS_CXX_FLAGS = Compiler flags for wxWindows, 26 essentially "`wx-config --cxxflags`" 27 on Linux 28 WXWINDOWS_INCLUDE_DIR = where to find "wx/wx.h" and "wx/setup.h" 29 WXWINDOWS_LINK_DIRECTORIES = link directories, useful for rpath on 30 Unix 31 WXWINDOWS_DEFINITIONS = extra defines 32 33 34 35OPTIONS If you need OpenGL support please 36 37:: 38 39 set(WXWINDOWS_USE_GL 1) 40 41in your CMakeLists.txt *before* you include this file. 42 43:: 44 45 HAVE_ISYSTEM - true required to replace -I by -isystem on g++ 46 47 48 49For convenience include Use_wxWindows.cmake in your project's 50CMakeLists.txt using 51include(${CMAKE_CURRENT_LIST_DIR}/Use_wxWindows.cmake). 52 53USAGE 54 55:: 56 57 set(WXWINDOWS_USE_GL 1) 58 find_package(wxWindows) 59 60 61 62NOTES wxWidgets 2.6.x is supported for monolithic builds e.g. 63compiled in wx/build/msw dir as: 64 65:: 66 67 nmake -f makefile.vc BUILD=debug SHARED=0 USE_OPENGL=1 MONOLITHIC=1 68 69 70 71DEPRECATED 72 73:: 74 75 CMAKE_WX_CAN_COMPILE 76 WXWINDOWS_LIBRARY 77 CMAKE_WX_CXX_FLAGS 78 WXWINDOWS_INCLUDE_PATH 79 80 81 82AUTHOR Jan Woetzel <http://www.mip.informatik.uni-kiel.de/~jw> 83(07/2003-01/2006) 84#]=======================================================================] 85 86# ------------------------------------------------------------------ 87# 88# -removed OPTION for CMAKE_WXWINDOWS_USE_GL. Force the developer to SET it before calling this. 89# -major update for wx 2.6.2 and monolithic build option. (10/2005) 90# 91# STATUS 92# tested with: 93# cmake 1.6.7, Linux (Suse 7.3), wxWindows 2.4.0, gcc 2.95 94# cmake 1.6.7, Linux (Suse 8.2), wxWindows 2.4.0, gcc 3.3 95# cmake 1.6.7, Linux (Suse 8.2), wxWindows 2.4.1-patch1, gcc 3.3 96# cmake 1.6.7, MS Windows XP home, wxWindows 2.4.1, MS Visual Studio .net 7 2002 (static build) 97# cmake 2.0.5 on Windows XP and Suse Linux 9.2 98# cmake 2.0.6 on Windows XP and Suse Linux 9.2, wxWidgets 2.6.2 MONOLITHIC build 99# cmake 2.2.2 on Windows XP, MS Visual Studio .net 2003 7.1 wxWidgets 2.6.2 MONOLITHIC build 100# 101# TODO 102# -OPTION for unicode builds 103# -further testing of DLL linking under MS WIN32 104# -better support for non-monolithic builds 105# 106 107 108if(WIN32) 109 set(WIN32_STYLE_FIND 1) 110endif() 111if(MINGW) 112 set(WIN32_STYLE_FIND 0) 113 set(UNIX_STYLE_FIND 1) 114endif() 115if(UNIX) 116 set(UNIX_STYLE_FIND 1) 117endif() 118 119 120if(WIN32_STYLE_FIND) 121 122 ## ###################################################################### 123 ## 124 ## Windows specific: 125 ## 126 ## candidates for root/base directory of wxwindows 127 ## should have subdirs include and lib containing include/wx/wx.h 128 ## fix the root dir to avoid mixing of headers/libs from different 129 ## versions/builds: 130 131 ## WX supports monolithic and multiple smaller libs (since 2.5.x), we prefer monolithic for now. 132 ## monolithic = WX is built as a single big library 133 ## e.g. compile on WIN32 as "nmake -f makefile.vc MONOLITHIC=1 BUILD=debug SHARED=0 USE_OPENGL=1" (JW) 134 option(WXWINDOWS_USE_MONOLITHIC "Use monolithic build of WX??" ON) 135 mark_as_advanced(WXWINDOWS_USE_MONOLITHIC) 136 137 ## GL libs used? 138 option(WXWINDOWS_USE_GL "Use Wx with GL support(glcanvas)?" ON) 139 mark_as_advanced(WXWINDOWS_USE_GL) 140 141 142 ## avoid mixing of headers and libs between multiple installed WX versions, 143 ## select just one tree here: 144 find_path(WXWINDOWS_ROOT_DIR include/wx/wx.h 145 HINTS 146 ENV WXWIN 147 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\wxWidgets_is1;Inno Setup: App Path]" ## WX 2.6.x 148 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\wxWindows_is1;Inno Setup: App Path]" ## WX 2.4.x 149 PATHS 150 C:/wxWidgets-2.6.2 151 D:/wxWidgets-2.6.2 152 C:/wxWidgets-2.6.1 153 D:/wxWidgets-2.6.1 154 C:/wxWindows-2.4.2 155 D:/wxWindows-2.4.2 156 ) 157 # message("DBG found WXWINDOWS_ROOT_DIR: ${WXWINDOWS_ROOT_DIR}") 158 159 160 ## find libs for combination of static/shared with release/debug 161 ## be careful if you add something here, 162 ## avoid mixing of headers and libs of different wx versions, 163 ## there may be multiple WX versions installed. 164 set (WXWINDOWS_POSSIBLE_LIB_PATHS 165 "${WXWINDOWS_ROOT_DIR}/lib" 166 ) 167 168 ## monolithic? 169 if (WXWINDOWS_USE_MONOLITHIC) 170 171 find_library(WXWINDOWS_STATIC_LIBRARY 172 NAMES wx wxmsw wxmsw26 173 PATHS 174 "${WXWINDOWS_ROOT_DIR}/lib/vc_lib" 175 ${WXWINDOWS_POSSIBLE_LIB_PATHS} 176 DOC "wxWindows static release build library" ) 177 178 find_library(WXWINDOWS_STATIC_DEBUG_LIBRARY 179 NAMES wxd wxmswd wxmsw26d 180 PATHS 181 "${WXWINDOWS_ROOT_DIR}/lib/vc_lib" 182 ${WXWINDOWS_POSSIBLE_LIB_PATHS} 183 DOC "wxWindows static debug build library" ) 184 185 find_library(WXWINDOWS_SHARED_LIBRARY 186 NAMES wxmsw26 wxmsw262 wxmsw24 wxmsw242 wxmsw241 wxmsw240 wx23_2 wx22_9 187 PATHS 188 "${WXWINDOWS_ROOT_DIR}/lib/vc_dll" 189 ${WXWINDOWS_POSSIBLE_LIB_PATHS} 190 DOC "wxWindows shared release build library" ) 191 192 find_library(WXWINDOWS_SHARED_DEBUG_LIBRARY 193 NAMES wxmsw26d wxmsw262d wxmsw24d wxmsw241d wxmsw240d wx23_2d wx22_9d 194 PATHS 195 "${WXWINDOWS_ROOT_DIR}/lib/vc_dll" 196 ${WXWINDOWS_POSSIBLE_LIB_PATHS} 197 DOC "wxWindows shared debug build library " ) 198 199 200 ## 201 ## required for WXWINDOWS_USE_GL 202 ## gl lib is always build separate: 203 ## 204 find_library(WXWINDOWS_STATIC_LIBRARY_GL 205 NAMES wx_gl wxmsw_gl wxmsw26_gl 206 PATHS 207 "${WXWINDOWS_ROOT_DIR}/lib/vc_lib" 208 ${WXWINDOWS_POSSIBLE_LIB_PATHS} 209 DOC "wxWindows static release build GL library" ) 210 211 find_library(WXWINDOWS_STATIC_DEBUG_LIBRARY_GL 212 NAMES wxd_gl wxmswd_gl wxmsw26d_gl 213 PATHS 214 "${WXWINDOWS_ROOT_DIR}/lib/vc_lib" 215 ${WXWINDOWS_POSSIBLE_LIB_PATHS} 216 DOC "wxWindows static debug build GL library" ) 217 218 219 find_library(WXWINDOWS_STATIC_DEBUG_LIBRARY_PNG 220 NAMES wxpngd 221 PATHS 222 "${WXWINDOWS_ROOT_DIR}/lib/vc_lib" 223 ${WXWINDOWS_POSSIBLE_LIB_PATHS} 224 DOC "wxWindows static debug png library" ) 225 226 find_library(WXWINDOWS_STATIC_LIBRARY_PNG 227 NAMES wxpng 228 PATHS 229 "${WXWINDOWS_ROOT_DIR}/lib/vc_lib" 230 ${WXWINDOWS_POSSIBLE_LIB_PATHS} 231 DOC "wxWindows static png library" ) 232 233 find_library(WXWINDOWS_STATIC_DEBUG_LIBRARY_TIFF 234 NAMES wxtiffd 235 PATHS 236 "${WXWINDOWS_ROOT_DIR}/lib/vc_lib" 237 ${WXWINDOWS_POSSIBLE_LIB_PATHS} 238 DOC "wxWindows static debug tiff library" ) 239 240 find_library(WXWINDOWS_STATIC_LIBRARY_TIFF 241 NAMES wxtiff 242 PATHS 243 "${WXWINDOWS_ROOT_DIR}/lib/vc_lib" 244 ${WXWINDOWS_POSSIBLE_LIB_PATHS} 245 DOC "wxWindows static tiff library" ) 246 247 find_library(WXWINDOWS_STATIC_DEBUG_LIBRARY_JPEG 248 NAMES wxjpegd wxjpgd 249 PATHS 250 "${WXWINDOWS_ROOT_DIR}/lib/vc_lib" 251 ${WXWINDOWS_POSSIBLE_LIB_PATHS} 252 DOC "wxWindows static debug jpeg library" ) 253 254 find_library(WXWINDOWS_STATIC_LIBRARY_JPEG 255 NAMES wxjpeg wxjpg 256 PATHS 257 "${WXWINDOWS_ROOT_DIR}/lib/vc_lib" 258 ${WXWINDOWS_POSSIBLE_LIB_PATHS} 259 DOC "wxWindows static jpeg library" ) 260 261 find_library(WXWINDOWS_STATIC_DEBUG_LIBRARY_ZLIB 262 NAMES wxzlibd 263 PATHS 264 "${WXWINDOWS_ROOT_DIR}/lib/vc_lib" 265 ${WXWINDOWS_POSSIBLE_LIB_PATHS} 266 DOC "wxWindows static debug zlib library" ) 267 268 find_library(WXWINDOWS_STATIC_LIBRARY_ZLIB 269 NAMES wxzlib 270 PATHS 271 "${WXWINDOWS_ROOT_DIR}/lib/vc_lib" 272 ${WXWINDOWS_POSSIBLE_LIB_PATHS} 273 DOC "wxWindows static zib library" ) 274 275 find_library(WXWINDOWS_STATIC_DEBUG_LIBRARY_REGEX 276 NAMES wxregexd 277 PATHS 278 "${WXWINDOWS_ROOT_DIR}/lib/vc_lib" 279 ${WXWINDOWS_POSSIBLE_LIB_PATHS} 280 DOC "wxWindows static debug regex library" ) 281 282 find_library(WXWINDOWS_STATIC_LIBRARY_REGEX 283 NAMES wxregex 284 PATHS 285 "${WXWINDOWS_ROOT_DIR}/lib/vc_lib" 286 ${WXWINDOWS_POSSIBLE_LIB_PATHS} 287 DOC "wxWindows static regex library" ) 288 289 290 291 ## untested: 292 find_library(WXWINDOWS_SHARED_LIBRARY_GL 293 NAMES wx_gl wxmsw_gl wxmsw26_gl 294 PATHS 295 "${WXWINDOWS_ROOT_DIR}/lib/vc_dll" 296 ${WXWINDOWS_POSSIBLE_LIB_PATHS} 297 DOC "wxWindows shared release build GL library" ) 298 299 find_library(WXWINDOWS_SHARED_DEBUG_LIBRARY_GL 300 NAMES wxd_gl wxmswd_gl wxmsw26d_gl 301 PATHS 302 "${WXWINDOWS_ROOT_DIR}/lib/vc_dll" 303 ${WXWINDOWS_POSSIBLE_LIB_PATHS} 304 DOC "wxWindows shared debug build GL library" ) 305 306 307 else () 308 ## WX is built as multiple small pieces libraries instead of monolithic 309 310 ## DEPRECATED (jw) replaced by more general WXWINDOWS_USE_MONOLITHIC ON/OFF 311 # option(WXWINDOWS_SEPARATE_LIBS_BUILD "Is wxWindows build with separate libs?" OFF) 312 313 ## HACK: This is very dirty. 314 ## because the libs of a particular version are explicitly listed 315 ## and NOT searched/verified. 316 ## TODO: Really search for each lib, then decide for 317 ## monolithic x debug x shared x GL (=16 combinations) for at least 18 libs 318 ## --> about 288 combinations 319 ## thus we need a different approach so solve this correctly ... 320 321 message(STATUS "Warning: You are trying to use wxWidgets without monolithic build (WXWINDOWS_SEPARATE_LIBS_BUILD). This is a HACK, libraries are not verified! (JW).") 322 323 set(WXWINDOWS_STATIC_LIBS ${WXWINDOWS_STATIC_LIBS} 324 wxbase26 325 wxbase26_net 326 wxbase26_odbc 327 wxbase26_xml 328 wxmsw26_adv 329 wxmsw26_core 330 wxmsw26_dbgrid 331 wxmsw26_gl 332 wxmsw26_html 333 wxmsw26_media 334 wxmsw26_qa 335 wxmsw26_xrc 336 wxexpat 337 wxjpeg 338 wxpng 339 wxregex 340 wxtiff 341 wxzlib 342 comctl32 343 rpcrt4 344 wsock32 345 ) 346 ## HACK: feed in to optimized / debug libraries if both were FOUND. 347 set(WXWINDOWS_STATIC_DEBUG_LIBS ${WXWINDOWS_STATIC_DEBUG_LIBS} 348 wxbase26d 349 wxbase26d_net 350 wxbase26d_odbc 351 wxbase26d_xml 352 wxmsw26d_adv 353 wxmsw26d_core 354 wxmsw26d_dbgrid 355 wxmsw26d_gl 356 wxmsw26d_html 357 wxmsw26d_media 358 wxmsw26d_qa 359 wxmsw26d_xrc 360 wxexpatd 361 wxjpegd 362 wxpngd 363 wxregexd 364 wxtiffd 365 wxzlibd 366 comctl32 367 rpcrt4 368 wsock32 369 ) 370 endif () 371 372 373 ## 374 ## now we should have found all WX libs available on the system. 375 ## let the user decide which of the available onse to use. 376 ## 377 378 ## if there is at least one shared lib available 379 ## let user choose whether to use shared or static wxwindows libs 380 if(WXWINDOWS_SHARED_LIBRARY OR WXWINDOWS_SHARED_DEBUG_LIBRARY) 381 ## default value OFF because wxWindows MSVS default build is static 382 option(WXWINDOWS_USE_SHARED_LIBS 383 "Use shared versions (dll) of wxWindows libraries?" OFF) 384 mark_as_advanced(WXWINDOWS_USE_SHARED_LIBS) 385 endif() 386 387 ## add system libraries wxwindows always seems to depend on 388 set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES} 389 comctl32 390 rpcrt4 391 wsock32 392 ) 393 394 if (NOT WXWINDOWS_USE_SHARED_LIBS) 395 set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES} 396 ## these ones don't seem required, in particular ctl3d32 is not necessary (Jan Woetzel 07/2003) 397 # ctl3d32 398 debug ${WXWINDOWS_STATIC_DEBUG_LIBRARY_ZLIB} optimized ${WXWINDOWS_STATIC_LIBRARY_ZLIB} 399 debug ${WXWINDOWS_STATIC_DEBUG_LIBRARY_REGEX} optimized ${WXWINDOWS_STATIC_LIBRARY_REGEX} 400 debug ${WXWINDOWS_STATIC_DEBUG_LIBRARY_PNG} optimized ${WXWINDOWS_STATIC_LIBRARY_PNG} 401 debug ${WXWINDOWS_STATIC_DEBUG_LIBRARY_JPEG} optimized ${WXWINDOWS_STATIC_LIBRARY_JPEG} 402 debug ${WXWINDOWS_STATIC_DEBUG_LIBRARY_TIFF} optimized ${WXWINDOWS_STATIC_LIBRARY_TIFF} 403 ) 404 endif () 405 406 ## opengl/glu: TODO/FIXME: better use FindOpenGL.cmake here 407 ## assume release versions of glu an dopengl, here. 408 if (WXWINDOWS_USE_GL) 409 set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES} 410 opengl32 411 glu32 ) 412 endif () 413 414 ## 415 ## select between use of shared or static wxWindows lib then set libs to use 416 ## for debug and optimized build. so the user can switch between debug and 417 ## release build e.g. within MS Visual Studio without running cmake with a 418 ## different build directory again. 419 ## 420 ## then add the build specific include dir for wx/setup.h 421 ## 422 423 if(WXWINDOWS_USE_SHARED_LIBS) 424 ##message("DBG wxWindows use shared lib selected.") 425 ## assume that both builds use the same setup(.h) for simplicity 426 427 ## shared: both wx (debug and release) found? 428 ## assume that both builds use the same setup(.h) for simplicity 429 if(WXWINDOWS_SHARED_DEBUG_LIBRARY AND WXWINDOWS_SHARED_LIBRARY) 430 ##message("DBG wx shared: debug and optimized found.") 431 find_path(WXWINDOWS_INCLUDE_DIR_SETUPH wx/setup.h 432 ${WXWINDOWS_ROOT_DIR}/lib/mswdlld 433 ${WXWINDOWS_ROOT_DIR}/lib/mswdll 434 ${WXWINDOWS_ROOT_DIR}/lib/vc_dll/mswd 435 ${WXWINDOWS_ROOT_DIR}/lib/vc_dll/msw ) 436 set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES} 437 debug ${WXWINDOWS_SHARED_DEBUG_LIBRARY} 438 optimized ${WXWINDOWS_SHARED_LIBRARY} ) 439 if (WXWINDOWS_USE_GL) 440 set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES} 441 debug ${WXWINDOWS_SHARED_DEBUG_LIBRARY_GL} 442 optimized ${WXWINDOWS_SHARED_LIBRARY_GL} ) 443 endif () 444 endif() 445 446 ## shared: only debug wx lib found? 447 if(WXWINDOWS_SHARED_DEBUG_LIBRARY) 448 if(NOT WXWINDOWS_SHARED_LIBRARY) 449 ##message("DBG wx shared: debug (but no optimized) found.") 450 find_path(WXWINDOWS_INCLUDE_DIR_SETUPH wx/setup.h 451 ${WXWINDOWS_ROOT_DIR}/lib/mswdlld 452 ${WXWINDOWS_ROOT_DIR}/lib/vc_dll/mswd ) 453 set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES} 454 ${WXWINDOWS_SHARED_DEBUG_LIBRARY} ) 455 if (WXWINDOWS_USE_GL) 456 set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES} 457 ${WXWINDOWS_SHARED_DEBUG_LIBRARY_GL} ) 458 endif () 459 endif() 460 endif() 461 462 ## shared: only release wx lib found? 463 if(NOT WXWINDOWS_SHARED_DEBUG_LIBRARY) 464 if(WXWINDOWS_SHARED_LIBRARY) 465 ##message("DBG wx shared: optimized (but no debug) found.") 466 find_path(WXWINDOWS_INCLUDE_DIR_SETUPH wx/setup.h 467 ${WXWINDOWS_ROOT_DIR}/lib/mswdll 468 ${WXWINDOWS_ROOT_DIR}/lib/vc_dll/msw ) 469 set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES} 470 ${WXWINDOWS_SHARED_DEBUG_LIBRARY} ) 471 if (WXWINDOWS_USE_GL) 472 set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES} 473 ${WXWINDOWS_SHARED_DEBUG_LIBRARY_GL} ) 474 endif () 475 endif() 476 endif() 477 478 ## shared: none found? 479 if(NOT WXWINDOWS_SHARED_DEBUG_LIBRARY) 480 if(NOT WXWINDOWS_SHARED_LIBRARY) 481 message(STATUS 482 "No shared wxWindows lib found, but WXWINDOWS_USE_SHARED_LIBS=${WXWINDOWS_USE_SHARED_LIBS}.") 483 endif() 484 endif() 485 486 ######################################################################################### 487 else() 488 489 ##jw: DEPRECATED if(NOT WXWINDOWS_SEPARATE_LIBS_BUILD) 490 491 ## static: both wx (debug and release) found? 492 ## assume that both builds use the same setup(.h) for simplicity 493 if(WXWINDOWS_STATIC_DEBUG_LIBRARY AND WXWINDOWS_STATIC_LIBRARY) 494 ##message("DBG wx static: debug and optimized found.") 495 find_path(WXWINDOWS_INCLUDE_DIR_SETUPH wx/setup.h 496 ${WXWINDOWS_ROOT_DIR}/lib/mswd 497 ${WXWINDOWS_ROOT_DIR}/lib/msw 498 ${WXWINDOWS_ROOT_DIR}/lib/vc_lib/mswd 499 ${WXWINDOWS_ROOT_DIR}/lib/vc_lib/msw ) 500 set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES} 501 debug ${WXWINDOWS_STATIC_DEBUG_LIBRARY} 502 optimized ${WXWINDOWS_STATIC_LIBRARY} ) 503 if (WXWINDOWS_USE_GL) 504 set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES} 505 debug ${WXWINDOWS_STATIC_DEBUG_LIBRARY_GL} 506 optimized ${WXWINDOWS_STATIC_LIBRARY_GL} ) 507 endif () 508 endif() 509 510 ## static: only debug wx lib found? 511 if(WXWINDOWS_STATIC_DEBUG_LIBRARY) 512 if(NOT WXWINDOWS_STATIC_LIBRARY) 513 ##message("DBG wx static: debug (but no optimized) found.") 514 find_path(WXWINDOWS_INCLUDE_DIR_SETUPH wx/setup.h 515 ${WXWINDOWS_ROOT_DIR}/lib/mswd 516 ${WXWINDOWS_ROOT_DIR}/lib/vc_lib/mswd ) 517 set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES} 518 ${WXWINDOWS_STATIC_DEBUG_LIBRARY} ) 519 if (WXWINDOWS_USE_GL) 520 set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES} 521 ${WXWINDOWS_STATIC_DEBUG_LIBRARY_GL} ) 522 endif () 523 endif() 524 endif() 525 526 ## static: only release wx lib found? 527 if(NOT WXWINDOWS_STATIC_DEBUG_LIBRARY) 528 if(WXWINDOWS_STATIC_LIBRARY) 529 ##message("DBG wx static: optimized (but no debug) found.") 530 find_path(WXWINDOWS_INCLUDE_DIR_SETUPH wx/setup.h 531 ${WXWINDOWS_ROOT_DIR}/lib/msw 532 ${WXWINDOWS_ROOT_DIR}/lib/vc_lib/msw ) 533 set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES} 534 ${WXWINDOWS_STATIC_LIBRARY} ) 535 if (WXWINDOWS_USE_GL) 536 set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES} 537 ${WXWINDOWS_STATIC_LIBRARY_GL} ) 538 endif () 539 endif() 540 endif() 541 542 ## static: none found? 543 if(NOT WXWINDOWS_STATIC_DEBUG_LIBRARY AND NOT WXWINDOWS_SEPARATE_LIBS_BUILD) 544 if(NOT WXWINDOWS_STATIC_LIBRARY) 545 message(STATUS 546 "No static wxWindows lib found, but WXWINDOWS_USE_SHARED_LIBS=${WXWINDOWS_USE_SHARED_LIBS}.") 547 endif() 548 endif() 549 endif() 550 551 552 ## not necessary in wxWindows 2.4.1 and 2.6.2 553 ## but it may fix a previous bug, see 554 ## http://lists.wxwindows.org/cgi-bin/ezmlm-cgi?8:mss:37574:200305:mpdioeneabobmgjenoap 555 option(WXWINDOWS_SET_DEFINITIONS "Set additional defines for wxWindows" OFF) 556 mark_as_advanced(WXWINDOWS_SET_DEFINITIONS) 557 if (WXWINDOWS_SET_DEFINITIONS) 558 set(WXWINDOWS_DEFINITIONS "-DWINVER=0x400") 559 else () 560 # clear: 561 set(WXWINDOWS_DEFINITIONS "") 562 endif () 563 564 565 566 ## Find the include directories for wxwindows 567 ## the first, build specific for wx/setup.h was determined before. 568 ## add inc dir for general for "wx/wx.h" 569 find_path(WXWINDOWS_INCLUDE_DIR wx/wx.h 570 "${WXWINDOWS_ROOT_DIR}/include" ) 571 ## append the build specific include dir for wx/setup.h: 572 if (WXWINDOWS_INCLUDE_DIR_SETUPH) 573 set(WXWINDOWS_INCLUDE_DIR ${WXWINDOWS_INCLUDE_DIR} ${WXWINDOWS_INCLUDE_DIR_SETUPH} ) 574 endif () 575 576 577 578 mark_as_advanced( 579 WXWINDOWS_ROOT_DIR 580 WXWINDOWS_INCLUDE_DIR 581 WXWINDOWS_INCLUDE_DIR_SETUPH 582 WXWINDOWS_STATIC_LIBRARY 583 WXWINDOWS_STATIC_LIBRARY_GL 584 WXWINDOWS_STATIC_DEBUG_LIBRARY 585 WXWINDOWS_STATIC_DEBUG_LIBRARY_GL 586 WXWINDOWS_STATIC_LIBRARY_ZLIB 587 WXWINDOWS_STATIC_DEBUG_LIBRARY_ZLIB 588 WXWINDOWS_STATIC_LIBRARY_REGEX 589 WXWINDOWS_STATIC_DEBUG_LIBRARY_REGEX 590 WXWINDOWS_STATIC_LIBRARY_PNG 591 WXWINDOWS_STATIC_DEBUG_LIBRARY_PNG 592 WXWINDOWS_STATIC_LIBRARY_JPEG 593 WXWINDOWS_STATIC_DEBUG_LIBRARY_JPEG 594 WXWINDOWS_STATIC_DEBUG_LIBRARY_TIFF 595 WXWINDOWS_STATIC_LIBRARY_TIFF 596 WXWINDOWS_SHARED_LIBRARY 597 WXWINDOWS_SHARED_DEBUG_LIBRARY 598 WXWINDOWS_SHARED_LIBRARY_GL 599 WXWINDOWS_SHARED_DEBUG_LIBRARY_GL 600 ) 601 602 603else() 604 605 if (UNIX_STYLE_FIND) 606 ## ###################################################################### 607 ## 608 ## UNIX/Linux specific: 609 ## 610 ## use backquoted wx-config to query and set flags and libs: 611 ## 06/2003 Jan Woetzel 612 ## 613 614 option(WXWINDOWS_USE_SHARED_LIBS "Use shared versions (.so) of wxWindows libraries" ON) 615 mark_as_advanced(WXWINDOWS_USE_SHARED_LIBS) 616 617 # JW removed option and force the develper th SET it. 618 # option(WXWINDOWS_USE_GL "use wxWindows with GL support (use additional 619 # --gl-libs for wx-config)?" OFF) 620 621 # wx-config should be in your path anyhow, usually no need to set WXWIN or 622 # search in ../wx or ../../wx 623 find_program(CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE 624 NAMES $ENV{WX_CONFIG} wx-config 625 HINTS 626 ENV WXWIN 627 $ENV{WXWIN}/bin 628 PATHS 629 ../wx/bin 630 ../../wx/bin ) 631 632 # check whether wx-config was found: 633 if(CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE) 634 635 # use shared/static wx lib? 636 # remember: always link shared to use systems GL etc. libs (no static 637 # linking, just link *against* static .a libs) 638 if(WXWINDOWS_USE_SHARED_LIBS) 639 set(WX_CONFIG_ARGS_LIBS "--libs") 640 else() 641 set(WX_CONFIG_ARGS_LIBS "--static --libs") 642 endif() 643 644 # do we need additionial wx GL stuff like GLCanvas ? 645 if(WXWINDOWS_USE_GL) 646 string(APPEND WX_CONFIG_ARGS_LIBS " --gl-libs" ) 647 endif() 648 ##message("DBG: WX_CONFIG_ARGS_LIBS=${WX_CONFIG_ARGS_LIBS}===") 649 650 # set CXXFLAGS to be fed into CMAKE_CXX_FLAGS by the user: 651 if (HAVE_ISYSTEM) # does the compiler support -isystem ? 652 if (NOT APPLE) # -isystem seem sto be unsuppored on Mac 653 if(CMAKE_COMPILER_IS_GNUCC AND CMAKE_COMPILER_IS_GNUCXX ) 654 if (CMAKE_CXX_COMPILER MATCHES g\\+\\+) 655 set(CMAKE_WXWINDOWS_CXX_FLAGS "`${CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE} --cxxflags|sed -e s/-I/-isystem/g`") 656 else() 657 set(CMAKE_WXWINDOWS_CXX_FLAGS "`${CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE} --cxxflags`") 658 endif() 659 endif() 660 endif () 661 endif () 662 ##message("DBG: for compilation: 663 ##CMAKE_WXWINDOWS_CXX_FLAGS=${CMAKE_WXWINDOWS_CXX_FLAGS}===") 664 665 # keep the back-quoted string for clarity 666 set(WXWINDOWS_LIBRARIES "`${CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE} ${WX_CONFIG_ARGS_LIBS}`") 667 ##message("DBG2: for linking: 668 ##WXWINDOWS_LIBRARIES=${WXWINDOWS_LIBRARIES}===") 669 670 # evaluate wx-config output to separate linker flags and linkdirs for 671 # rpath: 672 exec_program(${CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE} 673 ARGS ${WX_CONFIG_ARGS_LIBS} 674 OUTPUT_VARIABLE WX_CONFIG_LIBS ) 675 676 ## extract linkdirs (-L) for rpath 677 ## use regular expression to match wildcard equivalent "-L*<endchar>" 678 ## with <endchar> is a space or a semicolon 679 string(REGEX MATCHALL "[-][L]([^ ;])+" WXWINDOWS_LINK_DIRECTORIES_WITH_PREFIX "${WX_CONFIG_LIBS}" ) 680 # message("DBG WXWINDOWS_LINK_DIRECTORIES_WITH_PREFIX=${WXWINDOWS_LINK_DIRECTORIES_WITH_PREFIX}") 681 682 ## remove prefix -L because we need the pure directory for LINK_DIRECTORIES 683 ## replace -L by ; because the separator seems to be lost otherwise (bug or 684 ## feature?) 685 if(WXWINDOWS_LINK_DIRECTORIES_WITH_PREFIX) 686 string(REGEX REPLACE "[-][L]" ";" WXWINDOWS_LINK_DIRECTORIES ${WXWINDOWS_LINK_DIRECTORIES_WITH_PREFIX} ) 687 # message("DBG WXWINDOWS_LINK_DIRECTORIES=${WXWINDOWS_LINK_DIRECTORIES}") 688 endif() 689 690 691 ## replace space separated string by semicolon separated vector to make it 692 ## work with LINK_DIRECTORIES 693 separate_arguments(WXWINDOWS_LINK_DIRECTORIES) 694 695 mark_as_advanced( 696 CMAKE_WXWINDOWS_CXX_FLAGS 697 WXWINDOWS_INCLUDE_DIR 698 WXWINDOWS_LIBRARIES 699 CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE 700 ) 701 702 703 ## we really need wx-config... 704 else() 705 message(STATUS "Cannot find wx-config anywhere on the system. Please put the file into your path or specify it in CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE.") 706 mark_as_advanced(CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE) 707 endif() 708 709 710 711 else() 712 message(STATUS "FindwxWindows.cmake: Platform unknown/unsupported by FindwxWindows.cmake. It's neither WIN32 nor UNIX") 713 endif() 714endif() 715 716 717if(WXWINDOWS_LIBRARIES) 718 if(WXWINDOWS_INCLUDE_DIR OR CMAKE_WXWINDOWS_CXX_FLAGS) 719 ## found all we need. 720 set(WXWINDOWS_FOUND 1) 721 722 ## set deprecated variables for backward compatibility: 723 set(CMAKE_WX_CAN_COMPILE ${WXWINDOWS_FOUND}) 724 set(WXWINDOWS_LIBRARY ${WXWINDOWS_LIBRARIES}) 725 set(WXWINDOWS_INCLUDE_PATH ${WXWINDOWS_INCLUDE_DIR}) 726 set(WXWINDOWS_LINK_DIRECTORIES ${WXWINDOWS_LINK_DIRECTORIES}) 727 set(CMAKE_WX_CXX_FLAGS ${CMAKE_WXWINDOWS_CXX_FLAGS}) 728 729 endif() 730endif() 731