diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-09-14 05:02:57 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-09-14 05:02:57 +0400 |
commit | 21253def7ca013b60b87b6063b932121e65dae0a (patch) | |
tree | 04c65684cf168c71d9cbc525f14357c9461062ca /build_files/cmake/Modules | |
parent | 1741269d30d30886422986d737324ddf3794432c (diff) |
- removed some duplicate library links from cmake (which were needed because of bad level calls)
- FindXML2 we had copied from another project was always running and not using cached value, rewrote based on template used for most of our other find modules which makes use of 'FindPackageHandleStandardArgs'
- mark statuc collada libs as advanced.
Diffstat (limited to 'build_files/cmake/Modules')
-rw-r--r-- | build_files/cmake/Modules/FindOpenCOLLADA.cmake | 2 | ||||
-rw-r--r-- | build_files/cmake/Modules/FindXML2.cmake | 134 |
2 files changed, 58 insertions, 78 deletions
diff --git a/build_files/cmake/Modules/FindOpenCOLLADA.cmake b/build_files/cmake/Modules/FindOpenCOLLADA.cmake index a9a1d544507..0c8d8c8d841 100644 --- a/build_files/cmake/Modules/FindOpenCOLLADA.cmake +++ b/build_files/cmake/Modules/FindOpenCOLLADA.cmake @@ -119,8 +119,8 @@ FOREACH(COMPONENT ${_opencollada_FIND_STATIC_COMPONENTS}) # Ubuntu ppa needs this. lib64/opencollada lib/opencollada ) + MARK_AS_ADVANCED(OPENCOLLADA_${UPPERCOMPONENT}_LIBRARY) IF(OPENCOLLADA_${UPPERCOMPONENT}_LIBRARY) - MARK_AS_ADVANCED(OPENCOLLADA_${UPPERCOMPONENT}_LIBRARY) LIST(APPEND _opencollada_LIBRARIES "${OPENCOLLADA_${UPPERCOMPONENT}_LIBRARY}") ENDIF() ENDFOREACH() diff --git a/build_files/cmake/Modules/FindXML2.cmake b/build_files/cmake/Modules/FindXML2.cmake index e9f9fb3ca74..40cc332fb88 100644 --- a/build_files/cmake/Modules/FindXML2.cmake +++ b/build_files/cmake/Modules/FindXML2.cmake @@ -1,88 +1,68 @@ -# - Try to find XML2 -# Once done this will define +# - Find XML2 library +# Find the native XML2 includes and library +# This module defines +# XML2_INCLUDE_DIRS, where to find xml2.h, Set when +# XML2_INCLUDE_DIR is found. +# XML2_LIBRARIES, libraries to link against to use XML2. +# XML2_ROOT_DIR, The base directory to search for XML2. +# This can also be an environment variable. +# XML2_FOUND, If false, do not try to use XML2. # -# XML2_FOUND - system has XML2 -# XML2_INCLUDE_DIRS - the XML2 include directory -# XML2_LIBRARIES - Link these to use XML2 -# XML2_DEFINITIONS - Compiler switches required for using XML2 -# -# Copyright (c) 2008 Andreas Schneider <mail@cynapses.org> +# also defined, but not for general use are +# XML2_LIBRARY, where to find the XML2 library. + +#============================================================================= +# Copyright 2011 Blender Foundation. # -# Redistribution and use is allowed according to the terms of the New -# BSD license. +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. # +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# If XML2_ROOT_DIR was defined in the environment, use it. +IF(NOT XML2_ROOT_DIR AND NOT $ENV{XML2_ROOT_DIR} STREQUAL "") + SET(XML2_ROOT_DIR $ENV{XML2_ROOT_DIR}) +ENDIF() -if (XML2_LIBRARIES AND XML2_INCLUDE_DIRS) - # in cache already - set(XML2_FOUND TRUE) -else (XML2_LIBRARIES AND XML2_INCLUDE_DIRS) - # use pkg-config to get the directories and then use these values - # in the FIND_PATH() and FIND_LIBRARY() calls - if (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4) - include(UsePkgConfig) - pkgconfig(libxml-2.0 _XML2_INCLUDEDIR _XML2_LIBDIR _XML2_LDFLAGS _XML2_CFLAGS) - else (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4) - find_package(PkgConfig) - if (PKG_CONFIG_FOUND) - pkg_check_modules(_XML2 libxml-2.0) - endif (PKG_CONFIG_FOUND) - endif (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4) - find_path(XML2_INCLUDE_DIR - NAMES - libxml/xpath.h - PATHS - ${_XML2_INCLUDEDIR} - /usr/include - /usr/local/include - /opt/local/include - /sw/include - PATH_SUFFIXES - libxml2 - ) - - find_library(XML2_LIBRARY - NAMES - xml2 - PATHS - ${_XML2_LIBDIR} - /usr/lib - /usr/local/lib - /opt/local/lib - /sw/lib - ) +SET(_xml2_SEARCH_DIRS + ${XML2_ROOT_DIR} + /usr/local + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave +) - if (XML2_LIBRARY) - set(XML2_FOUND TRUE) - endif (XML2_LIBRARY) +FIND_PATH(XML2_INCLUDE_DIR libxml2/libxml/xpath.h + HINTS + ${_xml2_SEARCH_DIRS} + PATH_SUFFIXES + include +) - set(XML2_INCLUDE_DIRS - ${XML2_INCLUDE_DIR} +FIND_LIBRARY(XML2_LIBRARY + NAMES + xml2 + HINTS + ${_xml2_SEARCH_DIRS} + PATH_SUFFIXES + lib64 lib ) - if (XML2_FOUND) - set(XML2_LIBRARIES - ${XML2_LIBRARIES} - ${XML2_LIBRARY} - ) - endif (XML2_FOUND) - - if (XML2_INCLUDE_DIRS AND XML2_LIBRARIES) - set(XML2_FOUND TRUE) - endif (XML2_INCLUDE_DIRS AND XML2_LIBRARIES) - - if (XML2_FOUND) - if (NOT XML2_FIND_QUIETLY) - message(STATUS "Found XML2: ${XML2_LIBRARIES}") - endif (NOT XML2_FIND_QUIETLY) - else (XML2_FOUND) - if (XML2_FIND_REQUIRED) - message(FATAL_ERROR "Could not find XML2") - endif (XML2_FIND_REQUIRED) - endif (XML2_FOUND) - - # show the XML2_INCLUDE_DIRS and XML2_LIBRARIES variables only in the advanced view - mark_as_advanced(XML2_INCLUDE_DIRS XML2_LIBRARIES) +# handle the QUIETLY and REQUIRED arguments and set XML2_FOUND to TRUE if +# all listed variables are TRUE +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(XML2 DEFAULT_MSG + XML2_LIBRARY XML2_INCLUDE_DIR) -endif (XML2_LIBRARIES AND XML2_INCLUDE_DIRS) +IF(XML2_FOUND) + SET(XML2_LIBRARIES ${XML2_LIBRARY}) + SET(XML2_INCLUDE_DIRS ${XML2_INCLUDE_DIR}) +ENDIF(XML2_FOUND) +MARK_AS_ADVANCED( + XML2_INCLUDE_DIR + XML2_LIBRARY +) |