Changed: Some code simplifications

This commit is contained in:
kervala 2011-05-14 14:04:03 +02:00
parent bbbf8754fb
commit 144410cfd4

View file

@ -7,7 +7,7 @@
# EXTERNAL_FOUND - True if the external libraries are available
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})
SET(EXTERNAL_TEMP_FILE "include/png.h")
SET(EXTERNAL_TEMP_FILE "include/zlib.h")
SET(EXTERNAL_NAME "external")
# If using STLport preprend external_stlport
@ -17,36 +17,35 @@ IF(WITH_STLPORT)
SET(EXTERNAL_NAME "external with STLport")
ENDIF(WITH_STLPORT)
SET(EXTERNAL_FOUND FALSE)
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})
FIND_PATH(EXTERNAL_PATH
${EXTERNAL_TEMP_FILE}
PATHS
$ENV{EXTERNAL_PATH}
${EXTERNAL_TEMP_PATH}
/usr/local
/usr
/sw
/opt/local
/opt/csw
/opt
)
IF(EXTERNAL_FOUND)
IF(EXTERNAL_PATH)
SET(EXTERNAL_FOUND TRUE)
SET(EXTERNAL_INCLUDE_PATH "${EXTERNAL_PATH}/include")
IF(NOT CMAKE_SIZEOF_VOID_P)
INCLUDE (CheckTypeSize)
CHECK_TYPE_SIZE("void*" CMAKE_SIZEOF_VOID_P)
ENDIF(NOT CMAKE_SIZEOF_VOID_P)
# Using 32 or 64 bits libraries
IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
IF(TARGET_X64)
SET(EXTERNAL_LIBRARY_PATH "${EXTERNAL_PATH}/lib64")
ELSE(CMAKE_SIZEOF_VOID_P EQUAL 8)
ELSE(TARGET_X64)
SET(EXTERNAL_LIBRARY_PATH "${EXTERNAL_PATH}/lib")
ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 8)
ENDIF(TARGET_X64)
SET(CMAKE_INCLUDE_PATH "${EXTERNAL_INCLUDE_PATH};${CMAKE_INCLUDE_PATH}")
# Stupid hack for FindOpenAL.cmake
SET(CMAKE_INCLUDE_PATH "${EXTERNAL_PATH};${CMAKE_INCLUDE_PATH}")
SET(CMAKE_LIBRARY_PATH "${EXTERNAL_LIBRARY_PATH};${CMAKE_LIBRARY_PATH}")
ENDIF(EXTERNAL_FOUND)
ENDIF(EXTERNAL_PATH)
IF(EXTERNAL_FOUND)
IF(NOT External_FIND_QUIETLY)