cmake: sparsehash moves header file in newer version! Detect the 2 include pathes and add a define. Fix issue 1222

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5117 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
gregory.hainaut 2012-03-06 19:42:59 +00:00
parent 30e538a3c6
commit 6a0953ab94
5 changed files with 40 additions and 0 deletions

View File

@ -0,0 +1,18 @@
# Try to find SparseHash
# Once done, this will define
#
# SPARSEHASE_NEW_FOUND - system has SparseHash
# SPARSEHASE_NEW_INCLUDE_DIR - the SparseHash include directories
if(SPARSEHASE_NEW_INCLUDE_DIR)
set(SPARSEHASE_NEW_FIND_QUIETLY TRUE)
endif(SPARSEHASE_NEW_INCLUDE_DIR)
find_path(SPARSEHASE_NEW_INCLUDE_DIR sparsehash/internal/densehashtable.h)
# handle the QUIETLY and REQUIRED arguments and set SPARSEHASE_NEW_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(SparseHash_new DEFAULT_MSG SPARSEHASE_NEW_INCLUDE_DIR)
mark_as_advanced(SPARSEHASE_NEW_INCLUDE_DIR)

View File

@ -61,6 +61,7 @@ if(NOT FORCE_INTERNAL_SOUNDTOUCH)
include(FindSoundTouch)
endif(NOT FORCE_INTERNAL_SOUNDTOUCH)
include(FindSparseHash)
include(FindSparseHash_NEW)
# Note for include_directory: The order is important to avoid a mess between include file from your system and the one of pcsx2
# If you include first 3rdparty, all 3rdpary include will have a higer priority...
@ -166,6 +167,11 @@ endif(SOUNDTOUCH_FOUND AND NOT projectSoundTouch)
if(SPARSEHASH_FOUND)
include_directories(${SPARSEHASH_INCLUDE_DIR})
endif(SPARSEHASH_FOUND)
if(SPARSEHASH_NEW_FOUND)
include_directories(${SPARSEHASH_NEW_INCLUDE_DIR})
# allow to build parts that depend on sparsehash
set(SPARSEHASH_FOUND TRUE)
endif(SPARSEHASH_NEW_FOUND)
# Wx
if(wxWidgets_FOUND)

View File

@ -15,10 +15,18 @@
#pragma once
// They move include file in version 2.0.2 of google sparsehash...
#ifdef SPARSEHASH_NEW_INCLUDE_DIR
#include <sparsehash/type_traits.h>
#include <sparsehash/dense_hash_set>
#include <sparsehash/dense_hash_map>
#include <sparsehash/internal/densehashtable.h>
#else
#include <google/type_traits.h>
#include <google/dense_hash_set>
#include <google/dense_hash_map>
#include <google/sparsehash/densehashtable.h>
#endif
#include <wx/string.h>

View File

@ -20,6 +20,10 @@ set(CommonFlags
-pipe
-Wunused-variable)
if (SPARSEHASH_NEW_FOUND)
set(CommonFlags "${CommonFlags} -DSPARSEHASH_NEW_INCLUDE_DIR ")
endif (SPARSEHASH_NEW_FOUND)
# set warning flags
set(DebugFlags
-g

View File

@ -22,6 +22,10 @@ set(CommonFlags
-Wstrict-aliasing # Allow to track strict aliasing issue.
-pipe)
if (SPARSEHASH_NEW_FOUND)
set(CommonFlags "${CommonFlags} -DSPARSEHASH_NEW_INCLUDE_DIR ")
endif (SPARSEHASH_NEW_FOUND)
# set warning flags
set(DebugFlags
-W