|
From: <ai...@us...> - 2009-01-24 20:32:24
|
Revision: 9382
http://plplot.svn.sourceforge.net/plplot/?rev=9382&view=rev
Author: airwin
Date: 2009-01-24 20:32:18 +0000 (Sat, 24 Jan 2009)
Log Message:
-----------
Standardize FindAGG.cmake. This solves a wxwidgets linking bug (missing
aggfontfreetype_pic library in libraries that were linked) that occurred
whenever cmake was run from cached results (i.e., whenever the user did not
use a fresh build tree). The bad linking lead to widespread segfaults for
wxwidgets which should now be gone.
Modified Paths:
--------------
trunk/cmake/modules/FindAGG.cmake
trunk/cmake/modules/agg.cmake
trunk/cmake/modules/wxwidgets.cmake
Modified: trunk/cmake/modules/FindAGG.cmake
===================================================================
--- trunk/cmake/modules/FindAGG.cmake 2009-01-24 13:38:21 UTC (rev 9381)
+++ trunk/cmake/modules/FindAGG.cmake 2009-01-24 20:32:18 UTC (rev 9382)
@@ -1,75 +1,71 @@
# - Try to find the AGG graphics library
-# Once done this will define
+# Once done this will define in uncached variables
#
# AGG_FOUND - system has AGG
-# AGG_INCLUDE_DIR - the AGG include directory
-# AGG_LIBRARIES - Link these to use AGG
+# AGG_INCLUDE_DIRS - the AGG include directories
# AGG_DEFINITIONS - Compiler switches required for using AGG
+# AGG_LIBRARIES - Link these to use AGG
#
-if (AGG_INCLUDE_DIR AND AGG_LIBRARIES)
+if(PKG_CONFIG_EXECUTABLE)
+ # Use pkg-config (if available) to provide location of AGG headers and
+ # libraries and also provide basis for defining AGG_DEFINITIONS.
+ pkg_check_pkgconfig(libagg _AGGIncDir _AGGLinkDir _AGGLinkFlags _AGGCflags _AGG)
+ #message(STATUS "_AGGIncDir = ${_AGGIncDir}")
+ #message(STATUS "_AGGLinkDir = ${_AGGLinkDir}")
+ #message(STATUS "_AGGLinkFlags = ${_AGGLinkFlags}")
+ #message(STATUS "_AGGCflags = ${_AGGCflags}")
+endif(PKG_CONFIG_EXECUTABLE)
- # in cache already
- SET(AGG_FOUND TRUE)
+FIND_PATH(AGG_INCLUDE_DIR agg2/agg_pixfmt_gray.h
+ ${_AGGIncDir}
+ /usr/local/include
+ /usr/include
+ )
-else (AGG_INCLUDE_DIR AND AGG_LIBRARIES)
-
- if(PKG_CONFIG_EXECUTABLE)
- pkg_check_pkgconfig(libagg _AGGIncDir _AGGLinkDir _AGGLinkFlags _AGGCflags _AGG)
- #message(STATUS "_AGGIncDir = ${_AGGIncDir}")
- #message(STATUS "_AGGLinkDir = ${_AGGLinkDir}")
- #message(STATUS "_AGGLinkFlags = ${_AGGLinkFlags}")
- #message(STATUS "_AGGCflags = ${_AGGCflags}")
-
- # Blank-delimited is required.
- string(REGEX REPLACE ";" " " AGG_DEFINITIONS "${_AGGCflags}")
- endif(PKG_CONFIG_EXECUTABLE)
-
- FIND_PATH(AGG_INCLUDE_DIR agg2/agg_pixfmt_gray.h
- ${_AGGIncDir}
- /usr/local/include
- /usr/include
+# Prefer _pic variant of library name for shared libraries case, and
+# plain name for static libraries case.
+if(BUILD_SHARED_LIBS)
+ set(AGGLIB_NAMES = "agg_pic;agg")
+ set(AGGFONTLIB_NAMES = "aggfontfreetype_pic;aggfontfreetype")
+else(BUILD_SHARED_LIBS)
+ set(AGGLIB_NAMES = "agg;agg_pic")
+ set(AGGFONTLIB_NAMES = "aggfontfreetype;aggfontfreetype_pic;")
+endif(BUILD_SHARED_LIBS)
+FIND_LIBRARY(AGG_LIBRARY NAMES ${AGGLIB_NAMES}
+ PATHS
+ ${_AGGLinkDir}
+ /usr/local/lib
+ /usr/lib
)
-
- # Prefer _pic variant of library name for shared libraries case, and
- # plain name for static libraries case.
- if(BUILD_SHARED_LIBS)
- set(AGGLIB_NAMES = "agg_pic;agg")
- set(AGGFONTLIB_NAMES = "aggfontfreetype_pic;aggfontfreetype")
- else(BUILD_SHARED_LIBS)
- set(AGGLIB_NAMES = "agg;agg_pic")
- set(AGGFONTLIB_NAMES = "aggfontfreetype;aggfontfreetype_pic;")
- endif(BUILD_SHARED_LIBS)
- FIND_LIBRARY(AGG_LIBRARIES NAMES ${AGGLIB_NAMES}
- PATHS
- ${_AGGLinkDir}
- /usr/local/lib
- /usr/lib
+FIND_LIBRARY(AGGFONT_LIBRARY NAMES ${AGGFONTLIB_NAMES}
+ PATHS
+ ${_AGGLinkDir}
+ /usr/local/lib
+ /usr/lib
)
- FIND_LIBRARY(AGGFONT_LIBRARIES NAMES ${AGGFONTLIB_NAMES}
- PATHS
- ${_AGGLinkDir}
- /usr/local/lib
- /usr/lib
- )
- if (AGGFONT_LIBRARIES AND AGG_LIBRARIES)
- set(AGG_LIBRARIES ${AGG_LIBRARIES} ${AGGFONT_LIBRARIES})
- endif (AGGFONT_LIBRARIES AND AGG_LIBRARIES)
+
+MARK_AS_ADVANCED(AGG_INCLUDE_DIR AGG_LIBRARY AGGFONT_LIBRARY)
+
+# Set uncached variable AGG_LIBRARIES (needed by user and also
+# by FIND_PACKAGE_HANDLE_STANDARD_ARGS)
+if(AGG_LIBRARY AND AGGFONT_LIBRARY)
+ set(AGG_LIBRARIES ${AGG_LIBRARY} ${AGGFONT_LIBRARY})
+elseif(AGG_LIBRARY)
+ set(AGG_LIBRARIES ${AGG_LIBRARY})
+endif(AGG_LIBRARY AND AGGFONT_LIBRARY)
+
+# Standard 2.6.x method of handling QUIETLY and REQUIRED arguments and set
+# AGG_FOUND to TRUE if all listed variables are TRUE
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(AGG DEFAULT_MSG AGG_LIBRARIES AGG_INCLUDE_DIR)
+
+if(AGG_FOUND)
+ # Set additional uncached variables that users of this module should use.
+
+ set(AGG_INCLUDE_DIRS ${AGG_INCLUDE_DIR})
- if (AGG_INCLUDE_DIR AND AGG_LIBRARIES)
- set(AGG_FOUND TRUE)
- endif (AGG_INCLUDE_DIR AND AGG_LIBRARIES)
-
- if (AGG_FOUND)
- if (NOT AGG_FIND_QUIETLY)
- message(STATUS "Found AGG: ${AGG_LIBRARIES}")
- endif (NOT AGG_FIND_QUIETLY)
- else (AGG_FOUND)
- if (AGG_FIND_REQUIRED)
- message(FATAL_ERROR "Could NOT find AGG")
- endif (AGG_FIND_REQUIRED)
- endif (AGG_FOUND)
-
- MARK_AS_ADVANCED(AGG_INCLUDE_DIR AGG_LIBRARIES)
-
-endif (AGG_INCLUDE_DIR AND AGG_LIBRARIES)
+ # Blank-delimited is required.
+ string(REGEX REPLACE ";" " " AGG_DEFINITIONS "${_AGGCflags}")
+
+endif(AGG_FOUND)
Modified: trunk/cmake/modules/agg.cmake
===================================================================
--- trunk/cmake/modules/agg.cmake 2009-01-24 13:38:21 UTC (rev 9381)
+++ trunk/cmake/modules/agg.cmake 2009-01-24 20:32:18 UTC (rev 9382)
@@ -25,17 +25,6 @@
ON
)
-#if(HAVE_AGG)
-# if(NOT PKG_CONFIG_EXECUTABLE)
-# message(STATUS
-# "WARNING: pkg-config not found. Setting HAVE_AGG to OFF."
-# )
-# set(HAVE_AGG OFF
-# CACHE BOOL "Enable driver options for using AGG library for antializing"
-# FORCE
-# )
-# endif(NOT PKG_CONFIG_EXECUTABLE)
-#endif(HAVE_AGG)
# Look for agg libraries
if (HAVE_AGG)
find_package(AGG)
Modified: trunk/cmake/modules/wxwidgets.cmake
===================================================================
--- trunk/cmake/modules/wxwidgets.cmake 2009-01-24 13:38:21 UTC (rev 9381)
+++ trunk/cmake/modules/wxwidgets.cmake 2009-01-24 20:32:18 UTC (rev 9382)
@@ -29,76 +29,62 @@
# when ENABLE_DYNDRIVERS OFF.
# Find wxWidgets needed for driver and bindings
-if(
- PLD_wxwidgets
-OR PLD_wxpng
-)
+if(PLD_wxwidgets OR PLD_wxpng)
find_package(wxWidgets QUIET)
if(NOT wxWidgets_FOUND)
message(STATUS
- "WARNING: wxWidgets not found so "
- "setting PLD_wxwidgets to OFF."
- )
+ "WARNING: wxWidgets not found so "
+ "setting PLD_wxwidgets to OFF."
+ )
set(PLD_wxwidgets OFF CACHE BOOL "Enable wxwidgets device" FORCE)
set(PLD_wxpng OFF CACHE BOOL "Enable wxwidgets png device" FORCE)
else(NOT wxWidgets_FOUND)
- # Check if stdint.h can be used from c++ (HAVE_CXX_STDINT_H)
- include(TestForStdintCXX)
+ # Check if stdint.h can be used from c++ (HAVE_CXX_STDINT_H)
+ include(TestForStdintCXX)
endif(NOT wxWidgets_FOUND)
-endif(
- PLD_wxwidgets
-OR PLD_wxpng
-)
-
-if(
- PLD_wxwidgets
-OR PLD_wxpng
-)
+endif(PLD_wxwidgets OR PLD_wxpng)
+if(PLD_wxwidgets OR PLD_wxpng)
string(REGEX REPLACE ";" " -I"
- wxwidgets_COMPILE_FLAGS
- "-I${wxWidgets_INCLUDE_DIRS}"
- )
+ wxwidgets_COMPILE_FLAGS
+ "-I${wxWidgets_INCLUDE_DIRS}"
+ )
# For case (cvs version of CMake as of 2008-03-23, but not cmake-2.4.8)
# when wxWidgets_DEFINITIONS is a list.
string(REGEX REPLACE ";" " "
- wxwidgets_COMPILE_FLAGS
- ${wxwidgets_COMPILE_FLAGS}
- " ${wxWidgets_DEFINITIONS}"
- )
+ wxwidgets_COMPILE_FLAGS
+ ${wxwidgets_COMPILE_FLAGS}
+ " ${wxWidgets_DEFINITIONS}"
+ )
# Convert wxWidgets_LIBRARIES to full pathname form.
cmake_link_flags(wxwidgets_LINK_FLAGS "${wxWidgets_LIBRARIES}")
include(agg)
if(HAVE_AGG)
set(
- wxwidgets_COMPILE_FLAGS
- "${wxwidgets_COMPILE_FLAGS} -I${AGG_INCLUDE_DIR}"
- )
+ wxwidgets_COMPILE_FLAGS
+ "${wxwidgets_COMPILE_FLAGS} -I${AGG_INCLUDE_DIRS}"
+ )
set(
- wxwidgets_LINK_FLAGS
- ${wxwidgets_LINK_FLAGS}
- ${AGG_LIBRARIES}
- )
+ wxwidgets_LINK_FLAGS
+ ${wxwidgets_LINK_FLAGS}
+ ${AGG_LIBRARIES}
+ )
endif(HAVE_AGG)
if(WITH_FREETYPE)
set(
- wxwidgets_COMPILE_FLAGS
- "${wxwidgets_COMPILE_FLAGS} -I${FREETYPE_INCLUDE_DIR}"
- )
+ wxwidgets_COMPILE_FLAGS
+ "${wxwidgets_COMPILE_FLAGS} -I${FREETYPE_INCLUDE_DIR}"
+ )
set(
- wxwidgets_LINK_FLAGS
- ${wxwidgets_LINK_FLAGS}
- ${FREETYPE_LIBRARIES}
- )
+ wxwidgets_LINK_FLAGS
+ ${wxwidgets_LINK_FLAGS}
+ ${FREETYPE_LIBRARIES}
+ )
endif(WITH_FREETYPE)
set(DRIVERS_LINK_FLAGS
- ${DRIVERS_LINK_FLAGS}
- ${wxwidgets_LINK_FLAGS}
- )
-endif(
- PLD_wxwidgets
-OR PLD_wxpng
-)
-
+ ${DRIVERS_LINK_FLAGS}
+ ${wxwidgets_LINK_FLAGS}
+ )
+endif(PLD_wxwidgets OR PLD_wxpng)
if(DEFAULT_NO_BINDINGS)
option(ENABLE_wxwidgets "Enable wxwidgets bindings" OFF)
else(DEFAULT_NO_BINDINGS)
@@ -107,17 +93,17 @@
if(ENABLE_wxwidgets AND NOT PLD_wxwidgets)
message(STATUS
- "WARNING: PLD_wxwidgets is OFF so "
- "setting ENABLE_wxwidgets to OFF."
- )
+ "WARNING: PLD_wxwidgets is OFF so "
+ "setting ENABLE_wxwidgets to OFF."
+ )
set(ENABLE_wxwidgets OFF CACHE BOOL "Enable wxwidgets bindings" FORCE)
endif(ENABLE_wxwidgets AND NOT PLD_wxwidgets)
if(ENABLE_wxwidgets AND NOT ENABLE_cxx)
message(STATUS
- "WARNING: ENABLE_cxx is OFF so "
- "setting ENABLE_wxwidgets to OFF."
- )
+ "WARNING: ENABLE_cxx is OFF so "
+ "setting ENABLE_wxwidgets to OFF."
+ )
set(ENABLE_wxwidgets OFF CACHE BOOL "Enable wxwidgets bindings" FORCE)
endif(ENABLE_wxwidgets AND NOT ENABLE_cxx)
if(ENABLE_wxwidgets)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|