[cmake-commits] miguelf committed FindwxWidgets.cmake 1.14 1.15

cmake-commits at cmake.org cmake-commits at cmake.org
Sat Dec 22 10:15:06 EST 2007


Update of /cvsroot/CMake/CMake/Modules
In directory public:/mounts/ram/cvs-serv7940

Modified Files:
	FindwxWidgets.cmake 
Log Message:
STYLE: Refactored common libs into a variable, modified comments, and cleaned use of monolithic build.


Index: FindwxWidgets.cmake
===================================================================
RCS file: /cvsroot/CMake/CMake/Modules/FindwxWidgets.cmake,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- FindwxWidgets.cmake	2 Dec 2007 14:15:40 -0000	1.14
+++ FindwxWidgets.cmake	22 Dec 2007 15:15:04 -0000	1.15
@@ -60,14 +60,16 @@
 #   INCLUDE(${wxWidgets_USE_FILE})
 #   # and for each of your dependant executable/library targets:
 #   TARGET_LINK_LIBRARIES(<YourTarget> ${wxWidgets_LIBRARIES})
-#
 
+#
 # FIXME: check this and provide a correct sample usage...
+#        Remember to connect back to the upper text.
 # Sample usage with monolithic wx build:
 #
-#   SET(wxWidgets_USE_LIBS msw26 expat jpeg gl png regex tiff zlib)
+#   FIND_PACKAGE(wxWidgets COMPONENTS mono)
 #   ...
 
+
 # NOTES
 #
 # This module has been tested on the WIN32 platform with wxWidgets
@@ -130,7 +132,7 @@
 SET(wxWidgets_LIBRARY_DIRS "")
 SET(wxWidgets_CXX_FLAGS    "")
 
-# FIXME: This is a patch to support the DEPRECATED use of
+# DEPRECATED: This is a patch to support the DEPRECATED use of
 # wxWidgets_USE_LIBS.
 #
 # If wxWidgets_USE_LIBS is set:
@@ -175,28 +177,20 @@
 # WIN32_STYLE_FIND
 #=====================================================================
 IF(WIN32_STYLE_FIND)
-  # FIXME: I think this should be removed... how difficult is it to
-  # do with out it?
-  #   FIND_PACKAGE(wxWidgets COMPONENTS msw25d)
-  # If the user knows enough to want monolithic, then he probably
-  # knows enough to do the above...
-  #
-  # BTW, what happens in this case?
-  #   FIND_PACKAGE(wxWidgets)
-  # Check these out and then remove comment. However, I think this
-  # will probably have to stay for backward compatibility, but in
-  # that case document it as a variable or list as deprecated.
-  # 
-  # global settings for std and common wx libs logic could determine
-  # _USE_MONOLITHIC automatically but let the user decide for now.
-  IF(wxWidgets_USE_MONOLITHIC)
-    SET(wxWidgets_STD_LIBRARIES mono)
-  ELSE(wxWidgets_USE_MONOLITHIC)
-    SET(wxWidgets_STD_LIBRARIES base core) # this is default
-  ENDIF(wxWidgets_USE_MONOLITHIC)
+  # Useful common wx libs needed by almost all components.
+  SET(wxWidgets_COMMON_LIBRARIES png tiff jpeg zlib regex expat)
 
-  #useful common wx libs needed by almost all components
-  SET(wxWidgets_COMMON_LIBRARIES  png tiff jpeg zlib regex expat)
+  # DEPRECATED: Use FIND_PACKAGE(wxWidgets COMPONENTS mono) instead.
+  IF(NOT wxWidgets_FIND_COMPONENTS)
+    IF(wxWidgets_USE_MONOLITHIC)
+      SET(wxWidgets_FIND_COMPONENTS mono)
+    ELSE(wxWidgets_USE_MONOLITHIC)
+      SET(wxWidgets_FIND_COMPONENTS base core) # this is default
+    ENDIF(wxWidgets_USE_MONOLITHIC)
+  ENDIF(NOT wxWidgets_FIND_COMPONENTS)
+
+  # Always add the common required libs.
+  LIST(APPEND wxWidgets_FIND_COMPONENTS ${wxWidgets_COMMON_LIBRARIES})
 
   #-------------------------------------------------------------------
   # WIN32: Helper MACROS
@@ -223,8 +217,10 @@
     DBG_MSG_V("m_ucd = ${_UCD}")
     DBG_MSG_V("m_dbg = ${_DBG}")
 
-    # Find wxWidgets common libraries
-    FOREACH(LIB png tiff jpeg zlib regex expat)
+    # FIXME: What if both regex libs are available. regex should be
+    # found outside the loop and only wx${LIB}${_UCD}${_DBG}.
+    # Find wxWidgets common libraries.
+    FOREACH(LIB ${wxWidgets_COMMON_LIBRARIES})
       FIND_LIBRARY(WX_${LIB}${_DBG}
         NAMES
         wx${LIB}${_UCD}${_DBG} # for regex
@@ -235,7 +231,7 @@
       MARK_AS_ADVANCED(WX_${LIB}${_DBG})
     ENDFOREACH(LIB)
 
-    # Find wxWidgets multilib base libraries
+    # Find wxWidgets multilib base libraries.
     FIND_LIBRARY(WX_base${_DBG}
       NAMES
       wxbase29${_UCD}${_DBG}
@@ -261,7 +257,7 @@
       MARK_AS_ADVANCED(WX_${LIB}${_DBG})
     ENDFOREACH(LIB)
 
-    # Find wxWidgets monolithic library
+    # Find wxWidgets monolithic library.
     FIND_LIBRARY(WX_mono${_DBG}
       NAMES
       wxmsw${_UNV}29${_UCD}${_DBG}
@@ -274,7 +270,7 @@
       )
     MARK_AS_ADVANCED(WX_mono${_DBG})
 
-    # Find wxWidgets multilib libraries
+    # Find wxWidgets multilib libraries.
     FOREACH(LIB core adv aui html media xrc dbgrid gl qa)
       FIND_LIBRARY(WX_${LIB}${_DBG}
         NAMES
@@ -301,21 +297,21 @@
   ENDMACRO(WX_CLEAR_LIB)
   # Clear all debug or release library paths (arguments are "d" or "").
   MACRO(WX_CLEAR_ALL_LIBS _DBG)
-    # Clear wxWidgets common libraries
-    FOREACH(LIB png tiff jpeg zlib regex expat)
+    # Clear wxWidgets common libraries.
+    FOREACH(LIB ${wxWidgets_COMMON_LIBRARIES})
       WX_CLEAR_LIB(WX_${LIB}${_DBG})
     ENDFOREACH(LIB)
 
-    # Clear wxWidgets multilib base libraries
+    # Clear wxWidgets multilib base libraries.
     WX_CLEAR_LIB(WX_base${_DBG})
     FOREACH(LIB net odbc xml)
       WX_CLEAR_LIB(WX_${LIB}${_DBG})
     ENDFOREACH(LIB)
 
-    # Clear wxWidgets monolithic library
+    # Clear wxWidgets monolithic library.
     WX_CLEAR_LIB(WX_mono${_DBG})
 
-    # Clear wxWidgets multilib libraries
+    # Clear wxWidgets multilib libraries.
     FOREACH(LIB core adv aui html media xrc dbgrid gl qa)
       WX_CLEAR_LIB(WX_${LIB}${_DBG})
     ENDFOREACH(LIB)
@@ -417,8 +413,10 @@
 
   # If wxWidgets_ROOT_DIR changed, clear lib dir.
   IF(NOT WX_ROOT_DIR STREQUAL wxWidgets_ROOT_DIR)
-    SET(WX_ROOT_DIR ${wxWidgets_ROOT_DIR} CACHE INTERNAL "wxWidgets_ROOT_DIR")
-    SET(wxWidgets_LIB_DIR "wxWidgets_LIB_DIR-NOTFOUND" CACHE PATH "Cleared." FORCE)
+    SET(WX_ROOT_DIR ${wxWidgets_ROOT_DIR}
+        CACHE INTERNAL "wxWidgets_ROOT_DIR")
+    SET(wxWidgets_LIB_DIR "wxWidgets_LIB_DIR-NOTFOUND"
+        CACHE PATH "Cleared." FORCE)
   ENDIF(NOT WX_ROOT_DIR STREQUAL wxWidgets_ROOT_DIR)
 
   IF(WX_ROOT_DIR)
@@ -525,15 +523,6 @@
           WX_FIND_LIBS("${UNV}" "${UCD}" "d")
         ENDIF(WX_USE_REL_AND_DBG)
 
-        # If no library was requested, set default minimum set (i.e.,
-        # link to only core,base or mono).
-        IF(NOT wxWidgets_FIND_COMPONENTS)
-          SET(wxWidgets_FIND_COMPONENTS ${wxWidgets_STD_LIBRARIES})
-        ENDIF(NOT wxWidgets_FIND_COMPONENTS)
-
-        # Always add the common required libs.
-        LIST(APPEND wxWidgets_FIND_COMPONENTS ${wxWidgets_COMMON_LIBRARIES})
-
         # Settings for requested libs (i.e., include dir, libraries, etc.).
         WX_SET_LIBRARIES(wxWidgets_FIND_COMPONENTS "${DBG}")
 
@@ -755,6 +744,8 @@
 #=====================================================================
 INCLUDE(FindPackageHandleStandardArgs)
 FIND_PACKAGE_HANDLE_STANDARD_ARGS(wxWidgets DEFAULT_MSG wxWidgets_FOUND)
+# Maintain consistency with all other variables.
+SET(wxWidgets_FOUND ${WXWIDGETS_FOUND})
 
 #=====================================================================
 # Macros for use in wxWidgets apps.



More information about the Cmake-commits mailing list