]> git.lyx.org Git - lyx.git/blobdiff - development/cmake/modules/FindASPELL.cmake
Fix EOLs
[lyx.git] / development / cmake / modules / FindASPELL.cmake
index f43de1970a6fe2de11836ff31bd72b405f5703bd..6054d6adfe2ab6939c6743481b9f579b07ba2f23 100644 (file)
 #      ASPELL_DEFINITIONS - Compiler switches required for using ASPELL
 #
 
+set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
+
 if(WIN32)
        file(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _program_FILES_DIR)
-endif(WIN32)
+endif()
 
 
-if (ASPELL_INCLUDE_DIR AND ASPELL_LIBRARY)
+if(ASPELL_INCLUDE_DIR AND ASPELL_LIBRARY)
        # Already in cache, be silent
        set(ASPELL_FIND_QUIETLY TRUE)
-endif (ASPELL_INCLUDE_DIR AND ASPELL_LIBRARY)
+endif()
 
 FIND_PATH(ASPELL_INCLUDE_DIR aspell.h
        /usr/include
@@ -50,45 +52,44 @@ FIND_PATH(ASPELL_INCLUDE_DIR aspell.h
        ${_program_FILES_DIR}/gnuwin32/include
 )
 
-FIND_LIBRARY(ASPELL_LIBRARY_RELEASE NAMES aspell aspell-15
+FIND_LIBRARY(ASPELL_LIBRARY_RELEASE NAMES aspell aspell-15 libaspell libaspell-15
        PATHS
-       /usr/lib
-       /usr/local/lib
+       ${SYSTEM_LIB_DIRS}
 )
 
 # msvc makes a difference between debug and release
 if(MSVC)
-       find_library(ASPELL_LIBRARY_DEBUG NAMES aspelld
+       find_library(ASPELL_LIBRARY_DEBUG NAMES aspelld libaspelld libaspell-15
                 PATHS 
                 ${_program_FILES_DIR}/kdewin32/lib)
                                
        if(MSVC_IDE)
                if(NOT ASPELL_LIBRARY_DEBUG OR NOT ASPELL_LIBRARY_RELEASE)
-                       SET(ASPELL_LIBRARY)
-               else(NOT ASPELL_LIBRARY_DEBUG OR NOT ASPELL_LIBRARY_RELEASE)    
-                       SET(ASPELL_LIBRARY optimized ${ASPELL_LIBRARY_RELEASE} debug ${ASPELL_LIBRARY_DEBUG})
-               endif(NOT ASPELL_LIBRARY_DEBUG OR NOT ASPELL_LIBRARY_RELEASE)   
-       else(MSVC_IDE)
+                       set(ASPELL_LIBRARY)
+               else()  
+                       set(ASPELL_LIBRARY optimized ${ASPELL_LIBRARY_RELEASE} debug ${ASPELL_LIBRARY_DEBUG})
+               endif() 
+       else()
                string(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_TOLOWER)
                if(CMAKE_BUILD_TYPE_TOLOWER MATCHES debug)
                        set(ASPELL_LIBRARY ${ASPELL_LIBRARY_DEBUG})
-               else(CMAKE_BUILD_TYPE_TOLOWER MATCHES debug)
+               else()
                        set(ASPELL_LIBRARY ${ASPELL_LIBRARY_RELEASE})
-               endif(CMAKE_BUILD_TYPE_TOLOWER MATCHES debug)
-       endif(MSVC_IDE)
-else(MSVC)
-       set(ASPELL_LIBRARY ${ASPELL_LIBRARY_RELEASE})
-endif(MSVC)
+               endif()
+       endif()
+else()
+       set(ASPELL_LIBRARY ${ASPELL_LIBRARY_RELEASE} CACHE STRING "Aspell library" FORCE)
+endif()
 
-if (ASPELL_INCLUDE_DIR AND ASPELL_LIBRARY)
+if(ASPELL_INCLUDE_DIR AND ASPELL_LIBRARY)
         set(ASPELL_FOUND TRUE)
-endif (ASPELL_INCLUDE_DIR AND ASPELL_LIBRARY)
+endif()
 
-if (ASPELL_FOUND)
+if(ASPELL_FOUND)
        if (NOT ASPELL_FIND_QUIETLY)
        message(STATUS "Found ASPELL: ${ASPELL_LIBRARY}")
-       endif (NOT ASPELL_FIND_QUIETLY)
-else (ASPELL_FOUND)
+       endif()
+else()
        if (ASPELL_FIND_REQUIRED)
        message("aspell header      : ${ASPELL_INCLUDE_DIR}")
        message("aspell lib release : ${ASPELL_LIBRARY_RELEASE}")
@@ -97,10 +98,10 @@ else (ASPELL_FOUND)
                # 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")
-               endif(NOT ASPELL_LIBRARY_DEBUG OR NOT ASPELL_LIBRARY_RELEASE)
-       endif(MSVC_IDE)
+               endif()
+       endif()
        message(FATAL_ERROR "Could NOT find ASPELL")
-       endif (ASPELL_FIND_REQUIRED)
-endif (ASPELL_FOUND)
+       endif()
+endif()
 
-MARK_AS_ADVANCED(ASPELL_INCLUDE_DIR ASPELL_LIBRARY)
+MARK_AS_ADVANCED(ASPELL_INCLUDE_DIR ASPELL_LIBRARY ASPELL_LIBRARY_RELEASE ASPELL_LIBRARY_DEBUG)