Fix comparing same variable twice in CRingAccess
[ryzomcore.git] / CMakeModules / FindExternal.cmake
blob8364026cd2b7995e5bc6f8e7741a29d6aef3b1c6
1 # Look for a directory containing external libraries.\r
2 #\r
3 # The following values are defined\r
4 # EXTERNAL_PATH         - where to find external\r
5 # EXTERNAL_INCLUDE_PATH - where to find external includes\r
6 # EXTERNAL_BINARY_PATH  - where to find external binaries\r
7 # EXTERNAL_LIBRARY_PATH - where to find external libraries\r
8 # EXTERNAL_FOUND        - True if the external libraries are available\r
9 \r
10 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})\r
11 SET(EXTERNAL_TEMP_FILE "include/zlib.h")\r
12 SET(EXTERNAL_NAME "external")\r
14 # If using STLport preprend external_stlport\r
15 IF(WITH_STLPORT)\r
16   SET(EXTERNAL_TEMP_PATH ${CMAKE_CURRENT_SOURCE_DIR}/external_stlport ${CMAKE_CURRENT_SOURCE_DIR}/../external_stlport ${EXTERNAL_TEMP_PATH})\r
17   SET(EXTERNAL_TEMP_FILE "include/stlport/string")\r
18   SET(EXTERNAL_NAME "external with STLport")\r
19 ENDIF()\r
21 FIND_PATH(EXTERNAL_PATH\r
22   ${EXTERNAL_TEMP_FILE}\r
23   PATHS\r
24   $ENV{EXTERNAL_PATH}\r
25   ${EXTERNAL_TEMP_PATH}\r
26   /usr/local\r
27   /usr\r
28   /sw\r
29   /opt/local\r
30   /opt/csw\r
31   /opt\r
32 )\r
34 IF(EXTERNAL_PATH)\r
35   SET(EXTERNAL_FOUND TRUE)\r
36   SET(EXTERNAL_INCLUDE_PATH "${EXTERNAL_PATH}/include")\r
38   # Using 32 or 64 bits binaries\r
39   IF(TARGET_X64 AND WIN32)\r
40     SET(EXTERNAL_BINARY_PATH "${EXTERNAL_PATH}/bin64")\r
41   ELSE()\r
42     SET(EXTERNAL_BINARY_PATH "${EXTERNAL_PATH}/bin")\r
43   ENDIF()\r
45   # Using 32 or 64 bits libraries\r
46   IF(TARGET_X64 AND WIN32)\r
47     SET(EXTERNAL_LIBRARY_PATH "${EXTERNAL_PATH}/lib64")\r
48   ELSE()\r
49     SET(EXTERNAL_LIBRARY_PATH "${EXTERNAL_PATH}/lib")\r
50   ENDIF()\r
52   SET(CMAKE_INCLUDE_PATH "${EXTERNAL_INCLUDE_PATH};${CMAKE_INCLUDE_PATH}")\r
53   # Stupid hack for FindOpenAL.cmake\r
54   SET(CMAKE_INCLUDE_PATH "${EXTERNAL_PATH};${CMAKE_INCLUDE_PATH}")\r
55   SET(CMAKE_LIBRARY_PATH "${EXTERNAL_LIBRARY_PATH};${CMAKE_LIBRARY_PATH}")\r
56 ENDIF()\r
58 IF(EXTERNAL_FOUND)\r
59   IF(NOT External_FIND_QUIETLY)\r
60     MESSAGE(STATUS "Found ${EXTERNAL_NAME}: ${EXTERNAL_PATH}")\r
61   ENDIF()\r
62 ELSE()\r
63   IF(External_FIND_REQUIRED)\r
64     MESSAGE(FATAL_ERROR "Unable to find ${EXTERNAL_NAME}!")\r
65   ELSE()\r
66     IF(NOT External_FIND_QUIETLY)\r
67       MESSAGE(STATUS "Warning: Unable to find ${EXTERNAL_NAME}!")\r
68     ENDIF()\r
69   ENDIF()\r
70 ENDIF()\r
72 MARK_AS_ADVANCED(EXTERNAL_INCLUDE_PATH EXTERNAL_BINARY_PATH EXTERNAL_LIBRARY_PATH)\r