ENH: Patch from Jan for bug#3453. Cleans up find script and enables -isystem feature for use script.

This commit is contained in:
Brad King 2006-10-19 10:07:41 -04:00
parent bfe885f6ef
commit 2fd1b374c1
2 changed files with 43 additions and 41 deletions

View File

@ -17,9 +17,6 @@
# FIND_PACKAGE(wxWidgets REQUIRED # FIND_PACKAGE(wxWidgets REQUIRED
# <components>) # <components>)
# #
# HAVE_ISYSTEM - if true wx warnings are suppressed on g++
# by replacing -I with -isystem
#
# The following are set after configuration is done: # The following are set after configuration is done:
# #
# wxWidgets_FOUND - Set to TRUE if wxWidgets was found. # wxWidgets_FOUND - Set to TRUE if wxWidgets was found.
@ -117,7 +114,7 @@ IF (NOT wxWidgets_FIND_COMPONENTS)
jpeg jpeg
html html
media media
msw msw26 msw27 msw28 msw msw28 msw27 msw26
mono mono
net net
odbc odbc
@ -215,6 +212,8 @@ IF(WIN32_STYLE_FIND)
# Find wxWidgets multilib base libraries # Find wxWidgets multilib base libraries
FIND_LIBRARY(WX_base${_DBG} FIND_LIBRARY(WX_base${_DBG}
NAMES NAMES
wxbase28${_UCD}${_DBG}
wxbase27${_UCD}${_DBG}
wxbase26${_UCD}${_DBG} wxbase26${_UCD}${_DBG}
wxbase25${_UCD}${_DBG} wxbase25${_UCD}${_DBG}
PATHS ${WX_LIB_DIR} PATHS ${WX_LIB_DIR}
@ -224,6 +223,8 @@ IF(WIN32_STYLE_FIND)
FOREACH(LIB net odbc xml) FOREACH(LIB net odbc xml)
FIND_LIBRARY(WX_${LIB}${_DBG} FIND_LIBRARY(WX_${LIB}${_DBG}
NAMES NAMES
wxbase28${_UCD}${_DBG}_${LIB}
wxbase27${_UCD}${_DBG}_${LIB}
wxbase26${_UCD}${_DBG}_${LIB} wxbase26${_UCD}${_DBG}_${LIB}
wxbase25${_UCD}${_DBG}_${LIB} wxbase25${_UCD}${_DBG}_${LIB}
PATHS ${WX_LIB_DIR} PATHS ${WX_LIB_DIR}
@ -235,6 +236,8 @@ IF(WIN32_STYLE_FIND)
# Find wxWidgets monolithic library # Find wxWidgets monolithic library
FIND_LIBRARY(WX_mono${_DBG} FIND_LIBRARY(WX_mono${_DBG}
NAMES NAMES
wxmsw${_UNV}28${_UCD}${_DBG}
wxmsw${_UNV}27${_UCD}${_DBG}
wxmsw${_UNV}26${_UCD}${_DBG} wxmsw${_UNV}26${_UCD}${_DBG}
wxmsw${_UNV}25${_UCD}${_DBG} wxmsw${_UNV}25${_UCD}${_DBG}
PATHS ${WX_LIB_DIR} PATHS ${WX_LIB_DIR}
@ -246,6 +249,8 @@ IF(WIN32_STYLE_FIND)
FOREACH(LIB core adv html media xrc dbgrid gl qa) FOREACH(LIB core adv html media xrc dbgrid gl qa)
FIND_LIBRARY(WX_${LIB}${_DBG} FIND_LIBRARY(WX_${LIB}${_DBG}
NAMES NAMES
wxmsw${_UNV}28${_UCD}${_DBG}_${LIB}
wxmsw${_UNV}27${_UCD}${_DBG}_${LIB}
wxmsw${_UNV}26${_UCD}${_DBG}_${LIB} wxmsw${_UNV}26${_UCD}${_DBG}_${LIB}
wxmsw${_UNV}25${_UCD}${_DBG}_${LIB} wxmsw${_UNV}25${_UCD}${_DBG}_${LIB}
PATHS ${WX_LIB_DIR} PATHS ${WX_LIB_DIR}
@ -357,30 +362,38 @@ IF(WIN32_STYLE_FIND)
# #
# Look for an installation tree. # Look for an installation tree.
# #
FIND_PATH(wxWidgets_ROOT_DIR include/wx/wx.h FIND_PATH(wxWidgets_ROOT_DIR
NAMES include/wx/wx.h
PATHS
$ENV{wxWidgets_ROOT_DIR}
$ENV{WXWIN} $ENV{WXWIN}
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\wxWidgets_is1;Inno Setup: App Path]" ## WX 2.6.x "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\wxWidgets_is1;Inno Setup: App Path]" # WX 2.6.x
C:/wxWidgets-2.6.3 C:/
D:/wxWidgets-2.6.3 D:/
C:/wxWidgets-2.6.2 $ENV{ProgramFiles}
D:/wxWidgets-2.6.2 PATH_SUFFIXES
C:/wxWidgets-2.6.1 wxWidgets-2.8.4
D:/wxWidgets-2.6.1 wxWidgets-2.8.3
C:/wxWidgets-2.6.0 wxWidgets-2.8.2
D:/wxWidgets-2.6.0 wxWidgets-2.8.1
C:/wxWidgets-2.5.5 wxWidgets-2.8.0
D:/wxWidgets-2.5.5 wxWidgets-2.7.4
C:/wxWidgets-2.5.4 wxWidgets-2.7.3
D:/wxWidgets-2.5.4 wxWidgets-2.7.2
C:/wxWidgets-2.5.3 wxWidgest-2.7.1
D:/wxWidgets-2.5.3 wxWidgets-2.7.0
C:/wxWidgets-2.5.2 wxWidgets-2.7.0-1
D:/wxWidgets-2.5.2 wxWidgets-2.6.3
C:/wxWidgets-2.5.1 wxWidgets-2.6.2
D:/wxWidgets-2.5.1 wxWidgets-2.6.1
wxWidgets-2.5.4
wxWidgets-2.5.3
wxWidgets-2.5.2
wxWidgets-2.5.1
wxWidgets
DOC "wxWidgets base/installation directory?" DOC "wxWidgets base/installation directory?"
) )
# If wxWidgets_ROOT_DIR changed, clear all libraries and lib dir. # If wxWidgets_ROOT_DIR changed, clear all libraries and lib dir.
IF(NOT WX_ROOT_DIR STREQUAL wxWidgets_ROOT_DIR) IF(NOT WX_ROOT_DIR STREQUAL wxWidgets_ROOT_DIR)
SET(WX_ROOT_DIR ${wxWidgets_ROOT_DIR} CACHE INTERNAL "wxWidgets_ROOT_DIR") SET(WX_ROOT_DIR ${wxWidgets_ROOT_DIR} CACHE INTERNAL "wxWidgets_ROOT_DIR")
@ -556,21 +569,6 @@ ELSE(WIN32_STYLE_FIND)
# convert space to semicolons for list # convert space to semicolons for list
STRING(REGEX REPLACE " " ";" wxWidgets_INCLUDE_DIRS "${wxWidgets_INCLUDE_DIRS}") STRING(REGEX REPLACE " " ";" wxWidgets_INCLUDE_DIRS "${wxWidgets_INCLUDE_DIRS}")
# drop -I* from CXXFLAGS - postponed until -isystem is available to INCLUDE_DIRECTORIES to avoid pedantic warnings
#STRING(REGEX REPLACE "-I[^ ;]*" "" wxWidgets_CXX_FLAGS ${wxWidgets_CXX_FLAGS})
IF (HAVE_ISYSTEM) # does the compiler support -isystem ?
IF (NOT APPLE) # -isystem seem unsuppored on Mac
IF(CMAKE_COMPILER_IS_GNUCC AND CMAKE_COMPILER_IS_GNUCXX )
IF (CMAKE_CXX_COMPILER MATCHES g\\+\\+) # just to be sure
# handle WX include dirs as system directories - ignores pedantic warnings with gcc
# replace -I by -isystem
STRING(REGEX REPLACE "-I" "-isystem" wxWidgets_CXX_FLAGS ${wxWidgets_CXX_FLAGS})
ENDIF(CMAKE_CXX_COMPILER MATCHES g\\+\\+)
ENDIF(CMAKE_COMPILER_IS_GNUCC AND CMAKE_COMPILER_IS_GNUCXX )
ENDIF(NOT APPLE)
ENDIF(HAVE_ISYSTEM)
ELSE(RET EQUAL 0) ELSE(RET EQUAL 0)
DBG_MSG("${wxWidgets_CONFIG_EXECUTABLE} --cxxflags FAILED with RET=${RET}") DBG_MSG("${wxWidgets_CONFIG_EXECUTABLE} --cxxflags FAILED with RET=${RET}")
SET(wxWidgets_FOUND FALSE) SET(wxWidgets_FOUND FALSE)

View File

@ -32,7 +32,11 @@ ENDMACRO(MSG)
MSG("wxWidgets_FOUND=${wxWidgets_FOUND}") MSG("wxWidgets_FOUND=${wxWidgets_FOUND}")
IF (wxWidgets_FOUND) IF (wxWidgets_FOUND)
IF (wxWidgets_INCLUDE_DIRS) IF (wxWidgets_INCLUDE_DIRS)
INCLUDE_DIRECTORIES( ${wxWidgets_INCLUDE_DIRS} ) IF(wxWidgets_INCLUDE_DIRS_NO_SYSTEM)
INCLUDE_DIRECTORIES(${wxWidgets_INCLUDE_DIRS})
ELSE(wxWidgets_INCLUDE_DIRS_NO_SYSTEM)
INCLUDE_DIRECTORIES(SYSTEM ${wxWidgets_INCLUDE_DIRS})
ENDIF(wxWidgets_INCLUDE_DIRS_NO_SYSTEM)
MSG("wxWidgets_INCLUDE_DIRS=${wxWidgets_INCLUDE_DIRS}") MSG("wxWidgets_INCLUDE_DIRS=${wxWidgets_INCLUDE_DIRS}")
ENDIF(wxWidgets_INCLUDE_DIRS) ENDIF(wxWidgets_INCLUDE_DIRS)