khanat-code-old/code/CMakeModules/FindExternal.cmake

56 lines
1.8 KiB
CMake
Raw Normal View History

# Look for a directory containing external libraries.
#
# The following values are defined
# EXTERNAL_INCLUDE_PATH - where to find external includes
# EXTERNAL_LIBRARY_PATH - where to find external libraries
# EXTERNAL_FOUND - True if the external libraries are available
# also defined, but not for general use are
IF(EXTERNAL_PATH)
# in cache already
SET(EXTERNAL_FIND_QUIETLY TRUE)
ENDIF(EXTERNAL_PATH)
FIND_PATH(EXTERNAL_PATH
include/png.h
PATHS
${CMAKE_CURRENT_SOURCE_DIR}/3rdParty
${CMAKE_CURRENT_SOURCE_DIR}/../3rdParty
${CMAKE_CURRENT_SOURCE_DIR}/external
${CMAKE_CURRENT_SOURCE_DIR}/../external
)
IF(EXTERNAL_PATH)
SET(EXTERNAL_FOUND TRUE)
SET(EXTERNAL_INCLUDE_PATH "${EXTERNAL_PATH}/include")
IF(NOT CMAKE_SIZEOF_VOID_P)
2010-09-27 22:16:12 +00:00
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)
SET(EXTERNAL_LIBRARY_PATH "${EXTERNAL_PATH}/lib64")
ELSE(CMAKE_SIZEOF_VOID_P EQUAL 8)
SET(EXTERNAL_LIBRARY_PATH "${EXTERNAL_PATH}/lib")
ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 8)
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_PATH)
IF(EXTERNAL_FOUND)
IF(NOT EXTERNAL_FIND_QUIETLY)
MESSAGE(STATUS "Found external: ${EXTERNAL_PATH}")
ENDIF(NOT EXTERNAL_FIND_QUIETLY)
ELSE(EXTERNAL_FOUND)
IF(NOT EXTERNAL_FIND_QUIETLY)
MESSAGE(STATUS "Warning: Unable to find external!")
ENDIF(NOT EXTERNAL_FIND_QUIETLY)
ENDIF(EXTERNAL_FOUND)
MARK_AS_ADVANCED(EXTERNAL_INCLUDE_PATH EXTERNAL_LIBRARY_PATH)