2006-09-15 17:05:20 +00:00
#
# Copyright (c) 2006, Peter K<> mmel, <syntheticpp@gmx.net>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
2006-06-11 11:57:25 +00:00
# - Try to find ASPELL
# Once done this will define
#
2006-06-15 15:11:25 +00:00
# ASPELL_FOUND - system has ASPELL
# ASPELL_INCLUDE_DIR - the ASPELL include directory
# ASPELL_LIBRARY - The libraries needed to use ASPELL
# ASPELL_DEFINITIONS - Compiler switches required for using ASPELL
2006-06-11 11:57:25 +00:00
#
2007-08-28 19:54:42 +00:00
set ( CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true )
2006-06-15 15:11:25 +00:00
if ( WIN32 )
file ( TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _program_FILES_DIR )
2007-08-28 18:30:02 +00:00
endif ( )
2006-06-15 15:11:25 +00:00
2007-08-28 18:30:02 +00:00
if ( ASPELL_INCLUDE_DIR AND ASPELL_LIBRARY )
2006-06-15 15:11:25 +00:00
# Already in cache, be silent
set ( ASPELL_FIND_QUIETLY TRUE )
2007-08-28 18:30:02 +00:00
endif ( )
2006-06-11 11:57:25 +00:00
FIND_PATH ( ASPELL_INCLUDE_DIR aspell.h
2006-06-15 15:11:25 +00:00
/ u s r / i n c l u d e
/ u s r / l o c a l / i n c l u d e
/ u s r / l o c a l / i n c l u d e / a s p e l l
$ { _ p r o g r a m _ F I L E S _ D I R } / g n u w i n 3 2 / i n c l u d e
2006-06-11 11:57:25 +00:00
)
2008-04-16 16:47:12 +00:00
FIND_LIBRARY ( ASPELL_LIBRARY_RELEASE NAMES aspell aspell-15 libaspell libaspell-15
2006-06-15 15:11:25 +00:00
P A T H S
2011-05-24 06:58:40 +00:00
$ { S Y S T E M _ L I B _ D I R S }
2006-06-11 11:57:25 +00:00
)
2006-06-15 15:11:25 +00:00
# msvc makes a difference between debug and release
if ( MSVC )
2008-04-16 16:47:12 +00:00
find_library ( ASPELL_LIBRARY_DEBUG NAMES aspelld libaspelld libaspell-15
2006-06-15 15:11:25 +00:00
P A T H S
$ { _ p r o g r a m _ F I L E S _ D I R } / k d e w i n 3 2 / l i b )
if ( MSVC_IDE )
if ( NOT ASPELL_LIBRARY_DEBUG OR NOT ASPELL_LIBRARY_RELEASE )
2007-08-28 18:30:02 +00:00
set ( ASPELL_LIBRARY )
else ( )
set ( ASPELL_LIBRARY optimized ${ ASPELL_LIBRARY_RELEASE } debug ${ ASPELL_LIBRARY_DEBUG } )
endif ( )
else ( )
2006-06-15 15:11:25 +00:00
string ( TOLOWER ${ CMAKE_BUILD_TYPE } CMAKE_BUILD_TYPE_TOLOWER )
if ( CMAKE_BUILD_TYPE_TOLOWER MATCHES debug )
set ( ASPELL_LIBRARY ${ ASPELL_LIBRARY_DEBUG } )
2007-08-28 18:30:02 +00:00
else ( )
2006-06-15 15:11:25 +00:00
set ( ASPELL_LIBRARY ${ ASPELL_LIBRARY_RELEASE } )
2007-08-28 18:30:02 +00:00
endif ( )
endif ( )
else ( )
2010-07-17 23:12:50 +00:00
set ( ASPELL_LIBRARY ${ ASPELL_LIBRARY_RELEASE } CACHE STRING "Aspell library" FORCE )
2007-08-28 18:30:02 +00:00
endif ( )
2006-06-11 11:57:25 +00:00
2007-08-28 18:30:02 +00:00
if ( ASPELL_INCLUDE_DIR AND ASPELL_LIBRARY )
2006-06-15 15:11:25 +00:00
set ( ASPELL_FOUND TRUE )
2007-08-28 18:30:02 +00:00
endif ( )
2006-06-11 11:57:25 +00:00
2007-08-28 18:30:02 +00:00
if ( ASPELL_FOUND )
2006-06-15 15:11:25 +00:00
if ( NOT ASPELL_FIND_QUIETLY )
message ( STATUS "Found ASPELL: ${ASPELL_LIBRARY}" )
2007-08-28 18:30:02 +00:00
endif ( )
else ( )
2006-06-15 15:11:25 +00:00
if ( ASPELL_FIND_REQUIRED )
message ( "aspell header : ${ASPELL_INCLUDE_DIR}" )
message ( "aspell lib release : ${ASPELL_LIBRARY_RELEASE}" )
message ( "aspell lib debug : ${ASPELL_LIBRARY_DEBUG}" )
if ( MSVC_IDE )
# the ide needs the debug and release version
if ( NOT ASPELL_LIBRARY_DEBUG OR NOT ASPELL_LIBRARY_RELEASE )
message ( FATAL_ERROR "\nCould NOT find the debug AND release version of the aspell library.\nYou need to have both to use MSVC projects.\nPlease build and install both kdelibs/win/ libraries first.\n" )
2007-08-28 18:30:02 +00:00
endif ( )
endif ( )
2006-06-15 15:11:25 +00:00
message ( FATAL_ERROR "Could NOT find ASPELL" )
2007-08-28 18:30:02 +00:00
endif ( )
endif ( )
2006-06-11 11:57:25 +00:00
2010-07-18 06:47:01 +00:00
MARK_AS_ADVANCED ( ASPELL_INCLUDE_DIR ASPELL_LIBRARY ASPELL_LIBRARY_RELEASE ASPELL_LIBRARY_DEBUG )