ENH: fix for mingw

This commit is contained in:
Bill Hoffman 2004-04-21 15:09:07 -04:00
parent b55d109864
commit 8414c65862

View File

@ -1,405 +1,414 @@
## ##
## This module finds if wxWindows is installed and determines where the ## This module finds if wxWindows is installed and determines where the
## include files and libraries are. It also determines what the name of ## include files and libraries are. It also determines what the name of
## the library is. This code sets the following variables: ## the library is. This code sets the following variables:
## ##
## ------------------------------------------------------------------ ## ------------------------------------------------------------------
## ##
## WXWINDOWS_FOUND = system has WxWindows (in desired config. build) ## WXWINDOWS_FOUND = system has WxWindows (in desired config. build)
## ##
## WXWINDOWS_LIBRARIES = full path to the wxWindows libraries ## WXWINDOWS_LIBRARIES = full path to the wxWindows libraries
## on Unix/Linux with additional linker flags from ## on Unix/Linux with additional linker flags from
## "wx-config --libs" ## "wx-config --libs"
## ##
## CMAKE_WXWINDOWS_CXX_FLAGS = Unix compiler flags for wxWindows, essentially ## CMAKE_WXWINDOWS_CXX_FLAGS = Unix compiler flags for wxWindows, essentially
## "`wx-config --cxxflags`" ## "`wx-config --cxxflags`"
## ##
## WXWINDOWS_INCLUDE_DIR = where to find headers "wx/wx.h" "wx/setup.h" ## WXWINDOWS_INCLUDE_DIR = where to find headers "wx/wx.h" "wx/setup.h"
## ##
## WXWINDOWS_LINK_DIRECTORIES = link directories, useful for rpath on Unix ## WXWINDOWS_LINK_DIRECTORIES = link directories, useful for rpath on Unix
## ##
## WXWINDOWS_DEFINITIONS = extra defines ## WXWINDOWS_DEFINITIONS = extra defines
## ##
## deprecated: ## deprecated:
## * CMAKE_WX_CAN_COMPILE ## * CMAKE_WX_CAN_COMPILE
## * WXWINDOWS_LIBRARY ## * WXWINDOWS_LIBRARY
## * CMAKE_WX_CXX_FLAGS ## * CMAKE_WX_CXX_FLAGS
## * WXWINDOWS_INCLUDE_PATH ## * WXWINDOWS_INCLUDE_PATH
## ##
## ------------------------------------------------------------------ ## ------------------------------------------------------------------
## ##
## USAGE: ## USAGE:
## # for convenience include Use_wxWindows.cmake in your projects ## # for convenience include Use_wxWindows.cmake in your projects
## CMakeLists.txt: ## CMakeLists.txt:
## ##
## # if you need OpenGL support please ## # if you need OpenGL support please
## SET(WXWINDOWS_USE_GL 1) ## SET(WXWINDOWS_USE_GL 1)
## # in your CMakeLists.txt *before* you include this file. ## # in your CMakeLists.txt *before* you include this file.
## ##
## # just include Use_wxWindows.cmake ## # just include Use_wxWindows.cmake
## # in your projects CMakeLists.txt ## # in your projects CMakeLists.txt
## INCLUDE( ${CMAKE_ROOT}/Modules/Use_wxWindows.cmake) ## INCLUDE( ${CMAKE_ROOT}/Modules/Use_wxWindows.cmake)
## ##
## ------------------------------------------------------------------ ## ------------------------------------------------------------------
## Author Jan Woetzel <http://www.mip.informatik.uni-kiel.de/~jw> (07/2003) ## Author Jan Woetzel <http://www.mip.informatik.uni-kiel.de/~jw> (07/2003)
## ------------------------------------------------------------------ ## ------------------------------------------------------------------
## ##
## -changed variable names to conventions from cmakes readme.txt (Jan Woetzel ## -changed variable names to conventions from cmakes readme.txt (Jan Woetzel
## 07/07/2003) ## 07/07/2003)
## -added definition WINVER for WIN32 (Jan Woetzel 07/07//2003) ## -added definition WINVER for WIN32 (Jan Woetzel 07/07//2003)
## -added IF(CMAKE_WXWINDOWS_CONFIG_EXECUTABLE) found and changed ## -added IF(CMAKE_WXWINDOWS_CONFIG_EXECUTABLE) found and changed
## CMAKE_WX_CONFIG to CMAKE_WXWINDOWS_CONFIG_EXECUTABLE (Jan Woetzel ## CMAKE_WX_CONFIG to CMAKE_WXWINDOWS_CONFIG_EXECUTABLE (Jan Woetzel
## 07/22/2003) ## 07/22/2003)
## -removed OPTION for CMAKE_WXWINDOWS_USE_GL. Force the developer to SET it. ## -removed OPTION for CMAKE_WXWINDOWS_USE_GL. Force the developer to SET it.
## ##
## status: ## status:
## tested with: ## tested with:
## -cmake 1.6.7, Linux (Suse 7.3), wxWindows 2.4.0, gcc 2.95 ## -cmake 1.6.7, Linux (Suse 7.3), wxWindows 2.4.0, gcc 2.95
## -cmake 1.6.7, Linux (Suse 8.2), wxWindows 2.4.0, gcc 3.3 ## -cmake 1.6.7, Linux (Suse 8.2), wxWindows 2.4.0, gcc 3.3
## -cmake 1.6.7, Linux (Suse 8.2), wxWindows 2.4.1-patch1, gcc 3.3 ## -cmake 1.6.7, Linux (Suse 8.2), wxWindows 2.4.1-patch1, gcc 3.3
## -cmake 1.6.7, MS Windows XP home, wxWindows 2.4.1, MS Visual Studio .net 7 ## -cmake 1.6.7, MS Windows XP home, wxWindows 2.4.1, MS Visual Studio .net 7
## 2002 (static build) ## 2002 (static build)
## ##
## TODO: ## TODO:
## -OPTION for unicode builds ## -OPTION for unicode builds
## -change WXWINDOWS_USE_GL to use FindOpenGL.cmake or let the user do it ## -change WXWINDOWS_USE_GL to use FindOpenGL.cmake or let the user do it
## -testing of DLL linking under MS WIN32 ## -testing of DLL linking under MS WIN32
## ##
IF(WIN32)
SET(WIN32_STYLE_FIND 1)
IF(WIN32) ENDIF(MINGW)
IF(MINGW)
## ###################################################################### SET(WIN32_STYLE_FIND 0)
## SET(UNIX_STYLE_FIND 1)
## Windows specific: ENDIF(MINGW)
## IF(UNIX)
## candidates for root/base directory of wxwindows SET(UNIX_STYLE_FIND 1)
## should have subdirs include and lib containing include/wx/wx.h ENDIF(MINGW)
## fix the root dir to avoid mixing of headers/libs from different
## versions/builds:
IF(WIN32_STYLE_FIND)
SET (WXWINDOWS_POSSIBLE_ROOT_PATHS
$ENV{WXWIN} ## ######################################################################
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\wxWindows_is1;Inno Setup: App Path]" ) ##
## Windows specific:
FIND_PATH(WXWINDOWS_ROOT_DIR include/wx/wx.h ##
${WXWINDOWS_POSSIBLE_ROOT_PATHS} ) ## candidates for root/base directory of wxwindows
## should have subdirs include and lib containing include/wx/wx.h
## MESSAGE("DBG found WXWINDOWS_ROOT_DIR: ${WXWINDOWS_ROOT_DIR}") ## fix the root dir to avoid mixing of headers/libs from different
## versions/builds:
## find libs for combination of static/shared with release/debug
SET (WXWINDOWS_POSSIBLE_LIB_PATHS SET (WXWINDOWS_POSSIBLE_ROOT_PATHS
"${WXWINDOWS_ROOT_DIR}/lib" ) $ENV{WXWIN}
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\wxWindows_is1;Inno Setup: App Path]" )
FIND_LIBRARY(WXWINDOWS_STATIC_LIBRARY
NAMES wx wxmsw FIND_PATH(WXWINDOWS_ROOT_DIR include/wx/wx.h
PATHS ${WXWINDOWS_POSSIBLE_LIB_PATHS} ${WXWINDOWS_POSSIBLE_ROOT_PATHS} )
DOC "wxWindows static release build library" )
## MESSAGE("DBG found WXWINDOWS_ROOT_DIR: ${WXWINDOWS_ROOT_DIR}")
FIND_LIBRARY(WXWINDOWS_STATIC_DEBUG_LIBRARY
NAMES wxd wxmswd ## find libs for combination of static/shared with release/debug
PATHS ${WXWINDOWS_POSSIBLE_LIB_PATHS} SET (WXWINDOWS_POSSIBLE_LIB_PATHS
DOC "wxWindows static debug build library" ) "${WXWINDOWS_ROOT_DIR}/lib" )
FIND_LIBRARY(WXWINDOWS_SHARED_LIBRARY FIND_LIBRARY(WXWINDOWS_STATIC_LIBRARY
NAMES wxmsw24 wxmsw241 wxmsw240 wx23_2 wx22_9 NAMES wx wxmsw
PATHS ${WXWINDOWS_POSSIBLE_LIB_PATHS} PATHS ${WXWINDOWS_POSSIBLE_LIB_PATHS}
DOC "wxWindows shared release build library" ) DOC "wxWindows static release build library" )
FIND_LIBRARY(WXWINDOWS_SHARED_DEBUG_LIBRARY FIND_LIBRARY(WXWINDOWS_STATIC_DEBUG_LIBRARY
NAMES wxmsw24d wxmsw241d wxmsw240d wx23_2d wx22_9d NAMES wxd wxmswd
PATHS ${WXWINDOWS_POSSIBLE_LIB_PATHS} PATHS ${WXWINDOWS_POSSIBLE_LIB_PATHS}
DOC "wxWindows shared debug build library " ) DOC "wxWindows static debug build library" )
FIND_LIBRARY(WXWINDOWS_SHARED_LIBRARY
## if there is at least one shared lib available NAMES wxmsw24 wxmsw241 wxmsw240 wx23_2 wx22_9
## let user choose wether to use shared or static wxwindows libs PATHS ${WXWINDOWS_POSSIBLE_LIB_PATHS}
IF(WXWINDOWS_SHARED_LIBRARY OR WXWINDOWS_SHARED_DEBUG_LIBRARY) DOC "wxWindows shared release build library" )
## default value OFF because wxWindows MSVS default build is static
OPTION(WXWINDOWS_USE_SHARED_LIBS FIND_LIBRARY(WXWINDOWS_SHARED_DEBUG_LIBRARY
"Use shared versions (dll) of wxWindows libraries?" OFF) NAMES wxmsw24d wxmsw241d wxmsw240d wx23_2d wx22_9d
MARK_AS_ADVANCED(WXWINDOWS_USE_SHARED_LIBS) PATHS ${WXWINDOWS_POSSIBLE_LIB_PATHS}
ENDIF(WXWINDOWS_SHARED_LIBRARY OR WXWINDOWS_SHARED_DEBUG_LIBRARY) DOC "wxWindows shared debug build library " )
## add system libraries wxwindows depends on ## if there is at least one shared lib available
SET(CMAKE_WXWINDOWS_LIBRARIES ${CMAKE_WXWINDOWS_LIBRARIES} ## let user choose wether to use shared or static wxwindows libs
comctl32 IF(WXWINDOWS_SHARED_LIBRARY OR WXWINDOWS_SHARED_DEBUG_LIBRARY)
rpcrt4 ## default value OFF because wxWindows MSVS default build is static
wsock32 OPTION(WXWINDOWS_USE_SHARED_LIBS
## presumably ctl3d32 is not neccesary (Jan Woetzel 07/2003) "Use shared versions (dll) of wxWindows libraries?" OFF)
# ctl3d32 MARK_AS_ADVANCED(WXWINDOWS_USE_SHARED_LIBS)
# debug ${WXWINDOWS_ROOT_DIR}/lib/zlibd.lib optimized ${WXWINDOWS_ROOT_DIR}/lib/zlibd.lib ENDIF(WXWINDOWS_SHARED_LIBRARY OR WXWINDOWS_SHARED_DEBUG_LIBRARY)
# debug ${WXWINDOWS_ROOT_DIR}/lib/regexd.lib optimized ${WXWINDOWS_ROOT_DIR}/lib/regexd.lib
# debug ${WXWINDOWS_ROOT_DIR}/lib/pngd.lib optimized ${WXWINDOWS_ROOT_DIR}/lib/pngd.lib
# debug ${WXWINDOWS_ROOT_DIR}/lib/jpegd.lib optimized ${WXWINDOWS_ROOT_DIR}/lib/jpegd.lib ## add system libraries wxwindows depends on
# debug ${WXWINDOWS_ROOT_DIR}/lib/tiffd.lib optimized ${WXWINDOWS_ROOT_DIR}/lib/tiff.lib SET(CMAKE_WXWINDOWS_LIBRARIES ${CMAKE_WXWINDOWS_LIBRARIES}
) comctl32
rpcrt4
# JW removed option and force the develper th SET it. wsock32
# OPTION(WXWINDOWS_USE_GL "use wxWindows with GL support (use additional ## presumably ctl3d32 is not neccesary (Jan Woetzel 07/2003)
# opengl, glu libs)?" OFF) # ctl3d32
# debug ${WXWINDOWS_ROOT_DIR}/lib/zlibd.lib optimized ${WXWINDOWS_ROOT_DIR}/lib/zlibd.lib
## opengl/glu: (TODO/FIXME: better use FindOpenGL.cmake here # debug ${WXWINDOWS_ROOT_DIR}/lib/regexd.lib optimized ${WXWINDOWS_ROOT_DIR}/lib/regexd.lib
IF (WXWINDOWS_USE_GL) # debug ${WXWINDOWS_ROOT_DIR}/lib/pngd.lib optimized ${WXWINDOWS_ROOT_DIR}/lib/pngd.lib
SET(CMAKE_WXWINDOWS_LIBRARIES ${CMAKE_WXWINDOWS_LIBRARIES} # debug ${WXWINDOWS_ROOT_DIR}/lib/jpegd.lib optimized ${WXWINDOWS_ROOT_DIR}/lib/jpegd.lib
opengl32 # debug ${WXWINDOWS_ROOT_DIR}/lib/tiffd.lib optimized ${WXWINDOWS_ROOT_DIR}/lib/tiff.lib
glu32 )
)
ENDIF (WXWINDOWS_USE_GL) # JW removed option and force the develper th SET it.
# OPTION(WXWINDOWS_USE_GL "use wxWindows with GL support (use additional
# opengl, glu libs)?" OFF)
##
## select between use of shared or static wxWindows lib then set libs to use ## opengl/glu: (TODO/FIXME: better use FindOpenGL.cmake here
## for debug and optimized build. so the user can switch between debug and IF (WXWINDOWS_USE_GL)
## release build e.g. within MS Visual Studio without running cmake with a SET(CMAKE_WXWINDOWS_LIBRARIES ${CMAKE_WXWINDOWS_LIBRARIES}
## different build directory again. opengl32
## glu32
## then add the build specific include dir for wx/setup.h )
## ENDIF (WXWINDOWS_USE_GL)
IF(WXWINDOWS_USE_SHARED_LIBS)
##MESSAGE("DBG wxWindows use shared lib selected.") ##
## select between use of shared or static wxWindows lib then set libs to use
## shared: both wx (debug and release) found? ## for debug and optimized build. so the user can switch between debug and
IF(WXWINDOWS_SHARED_DEBUG_LIBRARY AND WXWINDOWS_SHARED_LIBRARY) ## release build e.g. within MS Visual Studio without running cmake with a
##MESSAGE("DBG wx shared: debug and optimized found.") ## different build directory again.
SET(WXWINDOWS_LIBRARIES ${CMAKE_WXWINDOWS_LIBRARIES} ##
debug ${WXWINDOWS_SHARED_DEBUG_LIBRARY} ## then add the build specific include dir for wx/setup.h
optimized ${WXWINDOWS_SHARED_LIBRARY} ) ##
FIND_PATH(WXWINDOWS_INCLUDE_DIR_SETUPH wx/setup.h
${WXWINDOWS_ROOT_DIR}/lib/mswdlld IF(WXWINDOWS_USE_SHARED_LIBS)
${WXWINDOWS_ROOT_DIR}/lib/mswdll ) ##MESSAGE("DBG wxWindows use shared lib selected.")
ENDIF(WXWINDOWS_SHARED_DEBUG_LIBRARY AND WXWINDOWS_SHARED_LIBRARY)
## shared: both wx (debug and release) found?
## shared: only debug wx lib found? IF(WXWINDOWS_SHARED_DEBUG_LIBRARY AND WXWINDOWS_SHARED_LIBRARY)
IF(WXWINDOWS_SHARED_DEBUG_LIBRARY) ##MESSAGE("DBG wx shared: debug and optimized found.")
IF(NOT WXWINDOWS_SHARED_LIBRARY) SET(WXWINDOWS_LIBRARIES ${CMAKE_WXWINDOWS_LIBRARIES}
##MESSAGE("DBG wx shared: debug (but no optimized) found.") debug ${WXWINDOWS_SHARED_DEBUG_LIBRARY}
SET(WXWINDOWS_LIBRARIES ${CMAKE_WXWINDOWS_LIBRARIES} optimized ${WXWINDOWS_SHARED_LIBRARY} )
${WXWINDOWS_SHARED_DEBUG_LIBRARY} ) FIND_PATH(WXWINDOWS_INCLUDE_DIR_SETUPH wx/setup.h
FIND_PATH(WXWINDOWS_INCLUDE_DIR_SETUPH wx/setup.h ${WXWINDOWS_ROOT_DIR}/lib/mswdlld
${WXWINDOWS_ROOT_DIR}/lib/mswdlld ) ${WXWINDOWS_ROOT_DIR}/lib/mswdll )
ENDIF(NOT WXWINDOWS_SHARED_LIBRARY) ENDIF(WXWINDOWS_SHARED_DEBUG_LIBRARY AND WXWINDOWS_SHARED_LIBRARY)
ENDIF(WXWINDOWS_SHARED_DEBUG_LIBRARY)
## shared: only debug wx lib found?
## shared: only release wx lib found? IF(WXWINDOWS_SHARED_DEBUG_LIBRARY)
IF(NOT WXWINDOWS_SHARED_DEBUG_LIBRARY) IF(NOT WXWINDOWS_SHARED_LIBRARY)
IF(WXWINDOWS_SHARED_LIBRARY) ##MESSAGE("DBG wx shared: debug (but no optimized) found.")
##MESSAGE("DBG wx shared: optimized (but no debug) found.") SET(WXWINDOWS_LIBRARIES ${CMAKE_WXWINDOWS_LIBRARIES}
SET(WXWINDOWS_LIBRARIES ${CMAKE_WXWINDOWS_LIBRARIES} ${WXWINDOWS_SHARED_DEBUG_LIBRARY} )
${WXWINDOWS_SHARED_DEBUG_LIBRARY} ) FIND_PATH(WXWINDOWS_INCLUDE_DIR_SETUPH wx/setup.h
FIND_PATH(WXWINDOWS_INCLUDE_DIR_SETUPH wx/setup.h ${WXWINDOWS_ROOT_DIR}/lib/mswdlld )
${WXWINDOWS_ROOT_DIR}/lib/mswdll ) ENDIF(NOT WXWINDOWS_SHARED_LIBRARY)
ENDIF(WXWINDOWS_SHARED_LIBRARY) ENDIF(WXWINDOWS_SHARED_DEBUG_LIBRARY)
ENDIF(NOT WXWINDOWS_SHARED_DEBUG_LIBRARY)
## shared: only release wx lib found?
## shared: none found? IF(NOT WXWINDOWS_SHARED_DEBUG_LIBRARY)
IF(NOT WXWINDOWS_SHARED_DEBUG_LIBRARY) IF(WXWINDOWS_SHARED_LIBRARY)
IF(NOT WXWINDOWS_SHARED_LIBRARY) ##MESSAGE("DBG wx shared: optimized (but no debug) found.")
MESSAGE(SEND_ERROR SET(WXWINDOWS_LIBRARIES ${CMAKE_WXWINDOWS_LIBRARIES}
"No shared wxWindows lib found, but WXWINDOWS_USE_SHARED_LIBS=${WXWINDOWS_USE_SHARED_LIBS}.") ${WXWINDOWS_SHARED_DEBUG_LIBRARY} )
ENDIF(NOT WXWINDOWS_SHARED_LIBRARY) FIND_PATH(WXWINDOWS_INCLUDE_DIR_SETUPH wx/setup.h
ENDIF(NOT WXWINDOWS_SHARED_DEBUG_LIBRARY) ${WXWINDOWS_ROOT_DIR}/lib/mswdll )
ENDIF(WXWINDOWS_SHARED_LIBRARY)
ENDIF(NOT WXWINDOWS_SHARED_DEBUG_LIBRARY)
ELSE(WXWINDOWS_USE_SHARED_LIBS)
##MESSAGE("DBG wxWindows static lib selected.") ## shared: none found?
IF(NOT WXWINDOWS_SHARED_DEBUG_LIBRARY)
## static: both wx (debug and release) found? IF(NOT WXWINDOWS_SHARED_LIBRARY)
IF(WXWINDOWS_STATIC_DEBUG_LIBRARY AND WXWINDOWS_STATIC_LIBRARY) MESSAGE(SEND_ERROR
##MESSAGE("DBG wx static: debug and optimized found.") "No shared wxWindows lib found, but WXWINDOWS_USE_SHARED_LIBS=${WXWINDOWS_USE_SHARED_LIBS}.")
SET(WXWINDOWS_LIBRARIES ${CMAKE_WXWINDOWS_LIBRARIES} ENDIF(NOT WXWINDOWS_SHARED_LIBRARY)
debug ${WXWINDOWS_STATIC_DEBUG_LIBRARY} ENDIF(NOT WXWINDOWS_SHARED_DEBUG_LIBRARY)
optimized ${WXWINDOWS_STATIC_LIBRARY} )
FIND_PATH(WXWINDOWS_INCLUDE_DIR_SETUPH wx/setup.h
${WXWINDOWS_ROOT_DIR}/lib/mswd ELSE(WXWINDOWS_USE_SHARED_LIBS)
${WXWINDOWS_ROOT_DIR}/lib/msw ) ##MESSAGE("DBG wxWindows static lib selected.")
ENDIF(WXWINDOWS_STATIC_DEBUG_LIBRARY AND WXWINDOWS_STATIC_LIBRARY)
## static: both wx (debug and release) found?
## static: only debug wx lib found? IF(WXWINDOWS_STATIC_DEBUG_LIBRARY AND WXWINDOWS_STATIC_LIBRARY)
IF(WXWINDOWS_STATIC_DEBUG_LIBRARY) ##MESSAGE("DBG wx static: debug and optimized found.")
IF(NOT WXWINDOWS_STATIC_LIBRARY) SET(WXWINDOWS_LIBRARIES ${CMAKE_WXWINDOWS_LIBRARIES}
##MESSAGE("DBG wx static: debug (but no optimized) found.") debug ${WXWINDOWS_STATIC_DEBUG_LIBRARY}
SET(WXWINDOWS_LIBRARIES ${CMAKE_WXWINDOWS_LIBRARIES} optimized ${WXWINDOWS_STATIC_LIBRARY} )
${WXWINDOWS_STATIC_DEBUG_LIBRARY} ) FIND_PATH(WXWINDOWS_INCLUDE_DIR_SETUPH wx/setup.h
FIND_PATH(WXWINDOWS_INCLUDE_DIR_SETUPH wx/setup.h ${WXWINDOWS_ROOT_DIR}/lib/mswd
${WXWINDOWS_ROOT_DIR}/lib/mswd ) ${WXWINDOWS_ROOT_DIR}/lib/msw )
ENDIF(NOT WXWINDOWS_STATIC_LIBRARY) ENDIF(WXWINDOWS_STATIC_DEBUG_LIBRARY AND WXWINDOWS_STATIC_LIBRARY)
ENDIF(WXWINDOWS_STATIC_DEBUG_LIBRARY)
## static: only debug wx lib found?
## static: only release wx lib found? IF(WXWINDOWS_STATIC_DEBUG_LIBRARY)
IF(NOT WXWINDOWS_STATIC_DEBUG_LIBRARY) IF(NOT WXWINDOWS_STATIC_LIBRARY)
IF(WXWINDOWS_STATIC_LIBRARY) ##MESSAGE("DBG wx static: debug (but no optimized) found.")
##MESSAGE("DBG wx static: optimized (but no debug) found.") SET(WXWINDOWS_LIBRARIES ${CMAKE_WXWINDOWS_LIBRARIES}
SET(WXWINDOWS_LIBRARIES ${CMAKE_WXWINDOWS_LIBRARIES} ${WXWINDOWS_STATIC_DEBUG_LIBRARY} )
${WXWINDOWS_STATIC_DEBUG_LIBRARY} ) FIND_PATH(WXWINDOWS_INCLUDE_DIR_SETUPH wx/setup.h
FIND_PATH(WXWINDOWS_INCLUDE_DIR_SETUPH wx/setup.h ${WXWINDOWS_ROOT_DIR}/lib/mswd )
${WXWINDOWS_ROOT_DIR}/lib/msw ) ENDIF(NOT WXWINDOWS_STATIC_LIBRARY)
ENDIF(WXWINDOWS_STATIC_LIBRARY) ENDIF(WXWINDOWS_STATIC_DEBUG_LIBRARY)
ENDIF(NOT WXWINDOWS_STATIC_DEBUG_LIBRARY)
## static: only release wx lib found?
## static: none found? IF(NOT WXWINDOWS_STATIC_DEBUG_LIBRARY)
IF(NOT WXWINDOWS_STATIC_DEBUG_LIBRARY) IF(WXWINDOWS_STATIC_LIBRARY)
IF(NOT WXWINDOWS_STATIC_LIBRARY) ##MESSAGE("DBG wx static: optimized (but no debug) found.")
MESSAGE(SEND_ERROR SET(WXWINDOWS_LIBRARIES ${CMAKE_WXWINDOWS_LIBRARIES}
"No static wxWindows lib found, but WXWINDOWS_USE_SHARED_LIBS=${WXWINDOWS_USE_SHARED_LIBS}.") ${WXWINDOWS_STATIC_DEBUG_LIBRARY} )
ENDIF(NOT WXWINDOWS_STATIC_LIBRARY) FIND_PATH(WXWINDOWS_INCLUDE_DIR_SETUPH wx/setup.h
ENDIF(NOT WXWINDOWS_STATIC_DEBUG_LIBRARY) ${WXWINDOWS_ROOT_DIR}/lib/msw )
ENDIF(WXWINDOWS_STATIC_LIBRARY)
ENDIF(WXWINDOWS_USE_SHARED_LIBS) ENDIF(NOT WXWINDOWS_STATIC_DEBUG_LIBRARY)
## static: none found?
## not neccessary in wxWindows 2.4.1 IF(NOT WXWINDOWS_STATIC_DEBUG_LIBRARY)
## but it may fix a previous bug, see IF(NOT WXWINDOWS_STATIC_LIBRARY)
## http://lists.wxwindows.org/cgi-bin/ezmlm-cgi?8:mss:37574:200305:mpdioeneabobmgjenoap MESSAGE(SEND_ERROR
OPTION(WXWINDOWS_SET_DEFINITIONS "Set additional defines for wxWindows" OFF) "No static wxWindows lib found, but WXWINDOWS_USE_SHARED_LIBS=${WXWINDOWS_USE_SHARED_LIBS}.")
MARK_AS_ADVANCED(WXWINDOWS_SET_DEFINITIONS) ENDIF(NOT WXWINDOWS_STATIC_LIBRARY)
IF (WXWINDOWS_SET_DEFINITIONS) ENDIF(NOT WXWINDOWS_STATIC_DEBUG_LIBRARY)
SET(WXWINDOWS_DEFINITIONS "-DWINVER=0x400")
ELSE (WXWINDOWS_SET_DEFINITIONS) ENDIF(WXWINDOWS_USE_SHARED_LIBS)
# clear:
SET(WXWINDOWS_DEFINITIONS "")
ENDIF (WXWINDOWS_SET_DEFINITIONS) ## not neccessary in wxWindows 2.4.1
## but it may fix a previous bug, see
## http://lists.wxwindows.org/cgi-bin/ezmlm-cgi?8:mss:37574:200305:mpdioeneabobmgjenoap
## Find the include directories for wxwindows OPTION(WXWINDOWS_SET_DEFINITIONS "Set additional defines for wxWindows" OFF)
## the first, build specific for wx/setup.h was determined before. MARK_AS_ADVANCED(WXWINDOWS_SET_DEFINITIONS)
## add inc dir for general for "wx/wx.h" IF (WXWINDOWS_SET_DEFINITIONS)
SET (WXWINDOWS_POSSIBLE_INCLUDE_PATHS SET(WXWINDOWS_DEFINITIONS "-DWINVER=0x400")
"${WXWINDOWS_ROOT_DIR}/include" ELSE (WXWINDOWS_SET_DEFINITIONS)
) # clear:
FIND_PATH(WXWINDOWS_INCLUDE_DIR wx/wx.h SET(WXWINDOWS_DEFINITIONS "")
${WXWINDOWS_POSSIBLE_INCLUDE_PATHS} ENDIF (WXWINDOWS_SET_DEFINITIONS)
)
# append the build specific include dir for wx/setup.h:
IF (WXWINDOWS_INCLUDE_DIR_SETUPH) ## Find the include directories for wxwindows
SET(WXWINDOWS_INCLUDE_DIR ${WXWINDOWS_INCLUDE_DIR} ${WXWINDOWS_INCLUDE_DIR_SETUPH} ) ## the first, build specific for wx/setup.h was determined before.
ENDIF (WXWINDOWS_INCLUDE_DIR_SETUPH) ## add inc dir for general for "wx/wx.h"
SET (WXWINDOWS_POSSIBLE_INCLUDE_PATHS
MARK_AS_ADVANCED( "${WXWINDOWS_ROOT_DIR}/include"
WXWINDOWS_ROOT_DIR )
WXWINDOWS_INCLUDE_DIR FIND_PATH(WXWINDOWS_INCLUDE_DIR wx/wx.h
WXWINDOWS_INCLUDE_DIR_SETUPH ${WXWINDOWS_POSSIBLE_INCLUDE_PATHS}
WXWINDOWS_STATIC_LIBRARY )
WXWINDOWS_STATIC_DEBUG_LIBRARY # append the build specific include dir for wx/setup.h:
WXWINDOWS_SHARED_LIBRARY IF (WXWINDOWS_INCLUDE_DIR_SETUPH)
WXWINDOWS_SHARED_DEBUG_LIBRARY SET(WXWINDOWS_INCLUDE_DIR ${WXWINDOWS_INCLUDE_DIR} ${WXWINDOWS_INCLUDE_DIR_SETUPH} )
) ENDIF (WXWINDOWS_INCLUDE_DIR_SETUPH)
MARK_AS_ADVANCED(
ELSE(WIN32) WXWINDOWS_ROOT_DIR
IF (UNIX) WXWINDOWS_INCLUDE_DIR
WXWINDOWS_INCLUDE_DIR_SETUPH
## ###################################################################### WXWINDOWS_STATIC_LIBRARY
## WXWINDOWS_STATIC_DEBUG_LIBRARY
## UNIX/Linux specific: WXWINDOWS_SHARED_LIBRARY
## WXWINDOWS_SHARED_DEBUG_LIBRARY
## use backquoted wx-config to query and set flags and libs: )
## 06/2003 Jan Woetzel
##
ELSE(WIN32_STYLE_FIND)
OPTION(WXWINDOWS_USE_SHARED_LIBS "Use shared versions (.so) of wxWindows libraries" ON) IF (UNIX_STYLE_FIND)
MARK_AS_ADVANCED(WXWINDOWS_USE_SHARED_LIBS) ## ######################################################################
##
# JW removed option and force the develper th SET it. ## UNIX/Linux specific:
# OPTION(WXWINDOWS_USE_GL "use wxWindows with GL support (use additional ##
# --gl-libs for wx-config)?" OFF) ## use backquoted wx-config to query and set flags and libs:
## 06/2003 Jan Woetzel
# wx-config should be in your path anyhow, usually no need to set WXWIN or ##
# search in ../wx or ../../wx
FIND_PROGRAM(CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE wx-config OPTION(WXWINDOWS_USE_SHARED_LIBS "Use shared versions (.so) of wxWindows libraries" ON)
$ENV{WXWIN} MARK_AS_ADVANCED(WXWINDOWS_USE_SHARED_LIBS)
../wx/bin
../../wx/bin ) # JW removed option and force the develper th SET it.
# OPTION(WXWINDOWS_USE_GL "use wxWindows with GL support (use additional
# check wether wx-config was found: # --gl-libs for wx-config)?" OFF)
IF(CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE)
# wx-config should be in your path anyhow, usually no need to set WXWIN or
# use shared/static wx lib? # search in ../wx or ../../wx
# remember: always link shared to use systems GL etc. libs (no static FIND_PROGRAM(CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE wx-config
# linking, just link *against* static .a libs) $ENV{WXWIN}
IF(WXWINDOWS_USE_SHARED_LIBS) ../wx/bin
SET(WX_CONFIG_ARGS_LIBS "--libs") ../../wx/bin )
ELSE(WXWINDOWS_USE_SHARED_LIBS)
SET(WX_CONFIG_ARGS_LIBS "--static --libs") # check wether wx-config was found:
ENDIF(WXWINDOWS_USE_SHARED_LIBS) IF(CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE)
# do we need additionial wx GL stuff like GLCanvas ? # use shared/static wx lib?
IF(WXWINDOWS_USE_GL) # remember: always link shared to use systems GL etc. libs (no static
SET(WX_CONFIG_ARGS_LIBS "${WX_CONFIG_ARGS_LIBS} --gl-libs" ) # linking, just link *against* static .a libs)
ENDIF(WXWINDOWS_USE_GL) IF(WXWINDOWS_USE_SHARED_LIBS)
##MESSAGE("DBG: WX_CONFIG_ARGS_LIBS=${WX_CONFIG_ARGS_LIBS}===") SET(WX_CONFIG_ARGS_LIBS "--libs")
ELSE(WXWINDOWS_USE_SHARED_LIBS)
# set CXXFLAGS to be fed into CMAKE_CXX_FLAGS by the user: SET(WX_CONFIG_ARGS_LIBS "--static --libs")
SET(CMAKE_WXWINDOWS_CXX_FLAGS "`${CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE} --cxxflags`") ENDIF(WXWINDOWS_USE_SHARED_LIBS)
##MESSAGE("DBG: for compilation:
##CMAKE_WXWINDOWS_CXX_FLAGS=${CMAKE_WXWINDOWS_CXX_FLAGS}===") # do we need additionial wx GL stuff like GLCanvas ?
IF(WXWINDOWS_USE_GL)
# keep the back-quoted string for clarity SET(WX_CONFIG_ARGS_LIBS "${WX_CONFIG_ARGS_LIBS} --gl-libs" )
SET(WXWINDOWS_LIBRARIES "`${CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE} ${WX_CONFIG_ARGS_LIBS}`") ENDIF(WXWINDOWS_USE_GL)
##MESSAGE("DBG2: for linking: ##MESSAGE("DBG: WX_CONFIG_ARGS_LIBS=${WX_CONFIG_ARGS_LIBS}===")
##WXWINDOWS_LIBRARIES=${WXWINDOWS_LIBRARIES}===")
# set CXXFLAGS to be fed into CMAKE_CXX_FLAGS by the user:
# evaluate wx-config output to separate linker flags and linkdirs for SET(CMAKE_WXWINDOWS_CXX_FLAGS "`${CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE} --cxxflags`")
# rpath: ##MESSAGE("DBG: for compilation:
EXEC_PROGRAM(${CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE} ##CMAKE_WXWINDOWS_CXX_FLAGS=${CMAKE_WXWINDOWS_CXX_FLAGS}===")
ARGS ${WX_CONFIG_ARGS_LIBS}
OUTPUT_VARIABLE WX_CONFIG_LIBS ) # keep the back-quoted string for clarity
SET(WXWINDOWS_LIBRARIES "`${CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE} ${WX_CONFIG_ARGS_LIBS}`")
## extract linkdirs (-L) for rpath ##MESSAGE("DBG2: for linking:
## use regular expression to match wildcard equivalent "-L*<endchar>" ##WXWINDOWS_LIBRARIES=${WXWINDOWS_LIBRARIES}===")
## with <endchar> is a space or a semicolon
STRING(REGEX MATCHALL "[-][L]([^ ;])+" WXWINDOWS_LINK_DIRECTORIES_WITH_PREFIX "${WX_CONFIG_LIBS}" ) # evaluate wx-config output to separate linker flags and linkdirs for
#MESSAGE("DBG WXWINDOWS_LINK_DIRECTORIES_WITH_PREFIX=${WXWINDOWS_LINK_DIRECTORIES_WITH_PREFIX}") # rpath:
EXEC_PROGRAM(${CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE}
## remove prefix -L because we need the pure directory for LINK_DIRECTORIES ARGS ${WX_CONFIG_ARGS_LIBS}
## replace -L by ; because the separator seems to be lost otherwise (bug or OUTPUT_VARIABLE WX_CONFIG_LIBS )
## feature?)
IF(WXWINDOWS_LINK_DIRECTORIES_WITH_PREFIX) ## extract linkdirs (-L) for rpath
STRING(REGEX REPLACE "[-][L]" ";" WXWINDOWS_LINK_DIRECTORIES ${WXWINDOWS_LINK_DIRECTORIES_WITH_PREFIX} ) ## use regular expression to match wildcard equivalent "-L*<endchar>"
#MESSAGE("DBG WXWINDOWS_LINK_DIRECTORIES=${WXWINDOWS_LINK_DIRECTORIES}") ## with <endchar> is a space or a semicolon
ENDIF(WXWINDOWS_LINK_DIRECTORIES_WITH_PREFIX) STRING(REGEX MATCHALL "[-][L]([^ ;])+" WXWINDOWS_LINK_DIRECTORIES_WITH_PREFIX "${WX_CONFIG_LIBS}" )
#MESSAGE("DBG WXWINDOWS_LINK_DIRECTORIES_WITH_PREFIX=${WXWINDOWS_LINK_DIRECTORIES_WITH_PREFIX}")
## replace space separated string by semicolon separated vector to make it ## remove prefix -L because we need the pure directory for LINK_DIRECTORIES
## work with LINK_DIRECTORIES ## replace -L by ; because the separator seems to be lost otherwise (bug or
SEPARATE_ARGUMENTS(WXWINDOWS_LINK_DIRECTORIES) ## feature?)
IF(WXWINDOWS_LINK_DIRECTORIES_WITH_PREFIX)
MARK_AS_ADVANCED( STRING(REGEX REPLACE "[-][L]" ";" WXWINDOWS_LINK_DIRECTORIES ${WXWINDOWS_LINK_DIRECTORIES_WITH_PREFIX} )
CMAKE_WXWINDOWS_CXX_FLAGS #MESSAGE("DBG WXWINDOWS_LINK_DIRECTORIES=${WXWINDOWS_LINK_DIRECTORIES}")
WXWINDOWS_INCLUDE_DIR ENDIF(WXWINDOWS_LINK_DIRECTORIES_WITH_PREFIX)
WXWINDOWS_LIBRARIES
CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE
) ## replace space separated string by semicolon separated vector to make it
## work with LINK_DIRECTORIES
SEPARATE_ARGUMENTS(WXWINDOWS_LINK_DIRECTORIES)
# we really need wx-config...
ELSE(CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE) MARK_AS_ADVANCED(
MESSAGE(SEND_ERROR "Cannot find wx-config anywhere on the system. Please put the file into your path or specify it in CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE.") CMAKE_WXWINDOWS_CXX_FLAGS
MARK_AS_ADVANCED(CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE) WXWINDOWS_INCLUDE_DIR
ENDIF(CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE) WXWINDOWS_LIBRARIES
CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE
)
ELSE(UNIX)
MESSAGE(SEND_ERROR "FindwxWindows.cmake: Platform unknown/unsupported by FindwxWindows.cmake. It's neither WIN32 nor UNIX") # we really need wx-config...
ENDIF(UNIX) ELSE(CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE)
ENDIF(WIN32) MESSAGE(SEND_ERROR "Cannot find wx-config anywhere on the system. Please put the file into your path or specify it in CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE.")
MARK_AS_ADVANCED(CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE)
ENDIF(CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE)
IF(WXWINDOWS_LIBRARIES)
IF(WXWINDOWS_INCLUDE_DIR OR CMAKE_WXWINDOWS_CXX_FLAGS)
## found all we need. ELSE(UNIX_STYLE_FIND)
SET(WXWINDOWS_FOUND 1) MESSAGE(SEND_ERROR "FindwxWindows.cmake: Platform unknown/unsupported by FindwxWindows.cmake. It's neither WIN32 nor UNIX")
ENDIF(UNIX_STYLE_FIND)
## set deprecated variables for backward compatibility: ENDIF(WIN32_STYLE_FIND)
SET(CMAKE_WX_CAN_COMPILE ${WXWINDOWS_FOUND})
SET(WXWINDOWS_LIBRARY ${WXWINDOWS_LIBRARIES})
SET(WXWINDOWS_INCLUDE_PATH ${WXWINDOWS_INCLUDE_DIR}) IF(WXWINDOWS_LIBRARIES)
SET(CMAKE_WX_CXX_FLAGS ${CMAKE_WXWINDOWS_CXX_FLAGS}) IF(WXWINDOWS_INCLUDE_DIR OR CMAKE_WXWINDOWS_CXX_FLAGS)
ENDIF(WXWINDOWS_INCLUDE_DIR OR CMAKE_WXWINDOWS_CXX_FLAGS) ## found all we need.
ENDIF(WXWINDOWS_LIBRARIES) SET(WXWINDOWS_FOUND 1)
## set deprecated variables for backward compatibility:
SET(CMAKE_WX_CAN_COMPILE ${WXWINDOWS_FOUND})
SET(WXWINDOWS_LIBRARY ${WXWINDOWS_LIBRARIES})
SET(WXWINDOWS_INCLUDE_PATH ${WXWINDOWS_INCLUDE_DIR})
SET(CMAKE_WX_CXX_FLAGS ${CMAKE_WXWINDOWS_CXX_FLAGS})
ENDIF(WXWINDOWS_INCLUDE_DIR OR CMAKE_WXWINDOWS_CXX_FLAGS)
ENDIF(WXWINDOWS_LIBRARIES)