From 87aa990f3a89a409357261b9cbb0474aca6764bf Mon Sep 17 00:00:00 2001 From: kervala Date: Sat, 14 May 2011 14:04:03 +0200 Subject: [PATCH] Changed: Some code simplifications --- code/CMakeModules/FindExternal.cmake | 39 ++++++++++++++-------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/code/CMakeModules/FindExternal.cmake b/code/CMakeModules/FindExternal.cmake index 3ca7774ba..436997d99 100644 --- a/code/CMakeModules/FindExternal.cmake +++ b/code/CMakeModules/FindExternal.cmake @@ -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)