Changed: User can now have 2 externals: external and external_stlport, it will use the correct one

This commit is contained in:
kervala 2010-09-28 15:27:32 +02:00
parent 2b938639cc
commit fcd0f82660
2 changed files with 33 additions and 22 deletions

View file

@ -141,6 +141,7 @@ moc_*.cpp
*.patch *.patch
*.7z *.7z
external external
external_stlport
3rdParty 3rdParty
.svn .svn

View file

@ -1,27 +1,33 @@
# Look for a directory containing external libraries. # Look for a directory containing external libraries.
# #
# The following values are defined # The following values are defined
# EXTERNAL_PATH - where to find external
# EXTERNAL_INCLUDE_PATH - where to find external includes # EXTERNAL_INCLUDE_PATH - where to find external includes
# EXTERNAL_LIBRARY_PATH - where to find external libraries # EXTERNAL_LIBRARY_PATH - where to find external libraries
# EXTERNAL_FOUND - True if the external libraries are available # EXTERNAL_FOUND - True if the external libraries are available
# also defined, but not for general use are SET(EXTERNAL_TEMP_PATH ${CMAKE_CURRENT_SOURCE_DIR}/external ${CMAKE_CURRENT_SOURCE_DIR}/../external ${CMAKE_CURRENT_SOURCE_DIR}/3rdParty ${CMAKE_CURRENT_SOURCE_DIR}/../3rdParty ${EXTERNAL_PATH})
IF(EXTERNAL_PATH) SET(EXTERNAL_TEMP_FILE "include/png.h")
# in cache already SET(EXTERNAL_NAME "external")
SET(EXTERNAL_FIND_QUIETLY TRUE)
ENDIF(EXTERNAL_PATH)
FIND_PATH(EXTERNAL_PATH # If using STLport preprend external_stlport
include/png.h IF(WITH_STLPORT)
PATHS SET(EXTERNAL_TEMP_PATH ${CMAKE_CURRENT_SOURCE_DIR}/external_stlport ${CMAKE_CURRENT_SOURCE_DIR}/../external_stlport ${EXTERNAL_TEMP_PATH})
${CMAKE_CURRENT_SOURCE_DIR}/3rdParty SET(EXTERNAL_TEMP_FILE "include/stlport/string")
${CMAKE_CURRENT_SOURCE_DIR}/../3rdParty SET(EXTERNAL_NAME "external with STLport")
${CMAKE_CURRENT_SOURCE_DIR}/external ENDIF(WITH_STLPORT)
${CMAKE_CURRENT_SOURCE_DIR}/../external
)
IF(EXTERNAL_PATH) SET(EXTERNAL_FOUND FALSE)
SET(EXTERNAL_FOUND TRUE) FOREACH(ITEM ${EXTERNAL_TEMP_PATH})
IF(EXISTS "${ITEM}/${EXTERNAL_TEMP_FILE}" AND NOT EXTERNAL_FOUND)
SET(EXTERNAL_FOUND TRUE)
# Get absolute path to avoid ..
GET_FILENAME_COMPONENT(ITEM ${ITEM} ABSOLUTE)
SET(EXTERNAL_PATH ${ITEM} CACHE PATH "" FORCE)
ENDIF(EXISTS "${ITEM}/${EXTERNAL_TEMP_FILE}" AND NOT EXTERNAL_FOUND)
ENDFOREACH(ITEM ${EXTERNAL_TEMP_PATH})
IF(EXTERNAL_FOUND)
SET(EXTERNAL_INCLUDE_PATH "${EXTERNAL_PATH}/include") SET(EXTERNAL_INCLUDE_PATH "${EXTERNAL_PATH}/include")
IF(NOT CMAKE_SIZEOF_VOID_P) IF(NOT CMAKE_SIZEOF_VOID_P)
@ -40,16 +46,20 @@ IF(EXTERNAL_PATH)
# Stupid hack for FindOpenAL.cmake # Stupid hack for FindOpenAL.cmake
SET(CMAKE_INCLUDE_PATH "${EXTERNAL_PATH};${CMAKE_INCLUDE_PATH}") SET(CMAKE_INCLUDE_PATH "${EXTERNAL_PATH};${CMAKE_INCLUDE_PATH}")
SET(CMAKE_LIBRARY_PATH "${EXTERNAL_LIBRARY_PATH};${CMAKE_LIBRARY_PATH}") SET(CMAKE_LIBRARY_PATH "${EXTERNAL_LIBRARY_PATH};${CMAKE_LIBRARY_PATH}")
ENDIF(EXTERNAL_PATH) ENDIF(EXTERNAL_FOUND)
IF(EXTERNAL_FOUND) IF(EXTERNAL_FOUND)
IF(NOT EXTERNAL_FIND_QUIETLY) IF(NOT External_FIND_QUIETLY)
MESSAGE(STATUS "Found external: ${EXTERNAL_PATH}") MESSAGE(STATUS "Found ${EXTERNAL_NAME}: ${EXTERNAL_PATH}")
ENDIF(NOT EXTERNAL_FIND_QUIETLY) ENDIF(NOT External_FIND_QUIETLY)
ELSE(EXTERNAL_FOUND) ELSE(EXTERNAL_FOUND)
IF(NOT EXTERNAL_FIND_QUIETLY) IF(External_FIND_REQUIRED)
MESSAGE(STATUS "Warning: Unable to find external!") MESSAGE(FATAL_ERROR "Unable to find ${EXTERNAL_NAME}!")
ENDIF(NOT EXTERNAL_FIND_QUIETLY) ELSE(External_FIND_REQUIRED)
IF(NOT External_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find ${EXTERNAL_NAME}!")
ENDIF(NOT External_FIND_QUIETLY)
ENDIF(External_FIND_REQUIRED)
ENDIF(EXTERNAL_FOUND) ENDIF(EXTERNAL_FOUND)
MARK_AS_ADVANCED(EXTERNAL_INCLUDE_PATH EXTERNAL_LIBRARY_PATH) MARK_AS_ADVANCED(EXTERNAL_INCLUDE_PATH EXTERNAL_LIBRARY_PATH)