Added: CMake module to find external/3rd party libs
This commit is contained in:
parent
3e7d89b42c
commit
d4d94a1284
1 changed files with 48 additions and 0 deletions
48
code/CMakeModules/FindExternal.cmake
Normal file
48
code/CMakeModules/FindExternal.cmake
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
# 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")
|
||||||
|
|
||||||
|
# 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)
|
Loading…
Reference in a new issue