From 865a7c63df278214f2585804374089ad126da271 Mon Sep 17 00:00:00 2001 From: Tom Mason Date: Mon, 19 Aug 2013 19:59:58 +0100 Subject: [PATCH] cmake for system libunshield --- CMakeLists.txt | 8 +++++- apps/launcher/CMakeLists.txt | 4 +-- cmake/FindLibUnshield.cmake | 48 ++++++++++++++++++++++++++++++++++++ 3 files changed, 56 insertions(+), 4 deletions(-) create mode 100644 cmake/FindLibUnshield.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 99a7e85a46..148a56d3cd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -499,7 +499,6 @@ endif(WIN32) add_subdirectory (extern/shiny) add_subdirectory (extern/oics) add_subdirectory (extern/sdl4ogre) -add_subdirectory (extern/unshield) # Components add_subdirectory (components) @@ -516,6 +515,13 @@ if (BUILD_ESMTOOL) endif() if (BUILD_LAUNCHER) + if(NOT WIN32) + find_package(LIBUNSHIELD REQUIRED) + if(NOT LIBUNSHIELD_FOUND) + message(SEND_ERROR "Failed to find libunshield") + endif(NOT LIBUNSHIELD_FOUND) + endif(NOT WIN32) + add_subdirectory( apps/launcher ) endif() diff --git a/apps/launcher/CMakeLists.txt b/apps/launcher/CMakeLists.txt index e11b713bc4..9b812e4bab 100644 --- a/apps/launcher/CMakeLists.txt +++ b/apps/launcher/CMakeLists.txt @@ -71,8 +71,6 @@ QT4_WRAP_CPP(MOC_SRCS ${LAUNCHER_HEADER_MOC}) QT4_WRAP_UI(UI_HDRS ${LAUNCHER_UI}) -message(STATUS "hello ${LIBUNSHIELD_INCLUDE}") - include(${QT_USE_FILE}) include_directories(${CMAKE_CURRENT_BINARY_DIR} ${LIBUNSHIELD_INCLUDE}) @@ -102,7 +100,7 @@ target_link_libraries(omwlauncher ${SDL2_LIBRARY} ${QT_LIBRARIES} components - libunshield + ${LIBUNSHIELD_LIBRARY} ) diff --git a/cmake/FindLibUnshield.cmake b/cmake/FindLibUnshield.cmake new file mode 100644 index 0000000000..4f4e98a1cd --- /dev/null +++ b/cmake/FindLibUnshield.cmake @@ -0,0 +1,48 @@ +# Locate LIBUNSHIELD +# This module defines +# LIBUNSHIELD_LIBRARY +# LIBUNSHIELD_FOUND, if false, do not try to link to LibUnshield +# LIBUNSHIELD_INCLUDE_DIR, where to find the headers +# +# Created by Tom Mason (wheybags) for OpenMW (http://openmw.com), based on FindMPG123.cmake +# +# Ripped off from other sources. In fact, this file is so generic (I +# just did a search and replace on another file) that I wonder why the +# CMake guys haven't wrapped this entire thing in a single +# function. Do we really need to repeat this stuff for every single +# library when they all work the same? + +FIND_PATH(LIBUNSHIELD_INCLUDE_DIR libunshield.h + HINTS + PATHS + ~/Library/Frameworks + /Library/Frameworks + /usr/local + /usr + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave + /opt + /usr/include +) + +FIND_LIBRARY(LIBUNSHIELD_LIBRARY + unshield + HINTS +# PATH_SUFFIXES lib64 lib libs64 libs libs/Win32 libs/Win64 + PATHS + ~/Library/Frameworks + /Library/Frameworks + /usr/local + /usr + /sw + /opt/local + /opt/csw + /opt + /usr/lib +) + +IF(LIBUNSHIELD_LIBRARY AND LIBUNSHIELD_INCLUDE_DIR) + SET(LIBUNSHIELD_FOUND "YES") +ENDIF(LIBUNSHIELD_LIBRARY AND LIBUNSHIELD_INCLUDE_DIR) +