aboutsummaryrefslogtreecommitdiff
path: root/cmake/Modules
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2011-02-16 09:43:04 +0200
committerPerttu Ahola <celeron55@gmail.com>2011-02-16 09:43:04 +0200
commitdcda4794344f27541d9cfaa221f8167d061e67dd (patch)
tree778373f0048268a314be121a188fa49bf5e8a6bd /cmake/Modules
parentff6a348bb1975dd2e181d006abfff3c7e0ecdc72 (diff)
downloadminetest-dcda4794344f27541d9cfaa221f8167d061e67dd.tar.gz
minetest-dcda4794344f27541d9cfaa221f8167d061e67dd.tar.bz2
minetest-dcda4794344f27541d9cfaa221f8167d061e67dd.zip
Hopefully fixed some of the errors in cmake's finding of irrlicht
Diffstat (limited to 'cmake/Modules')
-rw-r--r--cmake/Modules/FindIrrlicht.cmake59
1 files changed, 42 insertions, 17 deletions
diff --git a/cmake/Modules/FindIrrlicht.cmake b/cmake/Modules/FindIrrlicht.cmake
index a5d0bdd0b..f37d3f1de 100644
--- a/cmake/Modules/FindIrrlicht.cmake
+++ b/cmake/Modules/FindIrrlicht.cmake
@@ -8,34 +8,59 @@ else( UNIX )
# Windows
endif( UNIX )
+set(IRRLICHT_INCLUDE_DIR "" CACHE PATH "")
+set(IRRLICHT_LIBRARY "" CACHE FILEPATH "")
+
# Find include directory
if(NOT IRRLICHT_SOURCE_DIR STREQUAL "")
set(IRRLICHT_SOURCE_DIR_INCLUDE
"${IRRLICHT_SOURCE_DIR}/include"
)
- set(IRRLICHT_SOURCE_DIR_LIBS
- "${IRRLICHT_SOURCE_DIR}/lib/Win32-visualstudio"
- "${IRRLICHT_SOURCE_DIR}/lib/Win32-gcc"
+
+ set(IRRLICHT_LIBRARY_NAMES libIrrlicht.a Irrlicht Irrlicht.lib)
+
+ if(WIN32)
+ if(MSVC)
+ set(IRRLICHT_SOURCE_DIR_LIBS "${IRRLICHT_SOURCE_DIR}/lib/Win32-visualstudio")
+ set(IRRLICHT_LIBRARY_NAMES Irrlicht.lib)
+ else()
+ set(IRRLICHT_SOURCE_DIR_LIBS "${IRRLICHT_SOURCE_DIR}/lib/Win32-gcc")
+ set(IRRLICHT_LIBRARY_NAMES libIrrlicht.a)
+ endif()
+ else()
+ set(IRRLICHT_SOURCE_DIR_LIBS "${IRRLICHT_SOURCE_DIR}/lib/Linux")
+ set(IRRLICHT_LIBRARY_NAMES libIrrlicht.a)
+ endif()
+
+ FIND_PATH(IRRLICHT_INCLUDE_DIR NAMES irrlicht.h
+ PATHS
+ ${IRRLICHT_SOURCE_DIR_INCLUDE}
+ NO_DEFAULT_PATH
+ )
+
+ FIND_LIBRARY(IRRLICHT_LIBRARY NAMES ${IRRLICHT_LIBRARY_NAMES}
+ PATHS
+ ${IRRLICHT_SOURCE_DIR_LIBS}
+ NO_DEFAULT_PATH
)
-endif()
-FIND_PATH(IRRLICHT_INCLUDE_DIR NAMES irrlicht.h
- PATHS
- ${IRRLICHT_SOURCE_DIR_INCLUDE}
- /usr/local/include/irrlicht
- /usr/include/irrlicht
-)
+else()
-# Find library directory
+ FIND_PATH(IRRLICHT_INCLUDE_DIR NAMES irrlicht.h
+ PATHS
+ /usr/local/include/irrlicht
+ /usr/include/irrlicht
+ )
-FIND_LIBRARY(IRRLICHT_LIBRARY NAMES libIrrlicht.a Irrlicht
- PATHS
- ${IRRLICHT_SOURCE_DIR_LIBS}
- /usr/local/lib
- /usr/lib
-)
+ FIND_LIBRARY(IRRLICHT_LIBRARY NAMES libIrrlicht.a Irrlicht
+ PATHS
+ /usr/local/lib
+ /usr/lib
+ )
+endif()
+MESSAGE(STATUS "IRRLICHT_SOURCE_DIR = ${IRRLICHT_SOURCE_DIR}")
MESSAGE(STATUS "IRRLICHT_INCLUDE_DIR = ${IRRLICHT_INCLUDE_DIR}")
MESSAGE(STATUS "IRRLICHT_LIBRARY = ${IRRLICHT_LIBRARY}")