Cmake build: Use find_package_handle_standard_args() consistently

This commit is contained in:
Kornel Benko 2014-05-13 12:30:20 +02:00
parent 3eefb8cfa6
commit 77ee91ccfe
3 changed files with 18 additions and 39 deletions

View File

@ -81,27 +81,23 @@ else()
set(ASPELL_LIBRARY ${ASPELL_LIBRARY_RELEASE} CACHE STRING "Aspell library" FORCE)
endif()
if(ASPELL_INCLUDE_DIR AND ASPELL_LIBRARY)
set(ASPELL_FOUND TRUE)
endif()
# handle the QUIETLY and REQUIRED arguments and DEFAULT_MSG
# set ASPELL_FOUND to TRUE if all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(ASPELL DEFAULT_MSG ASPELL_LIBRARY ASPELL_INCLUDE_DIR)
if(ASPELL_FOUND)
if (NOT ASPELL_FIND_QUIETLY)
message(STATUS "Found ASPELL: ${ASPELL_LIBRARY}")
endif()
else()
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")
endif()
endif()
message(FATAL_ERROR "Could NOT find ASPELL")
endif()
if(NOT ASPELL_FOUND)
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")
endif()
endif()
endif()
endif()
MARK_AS_ADVANCED(ASPELL_INCLUDE_DIR ASPELL_LIBRARY ASPELL_LIBRARY_RELEASE ASPELL_LIBRARY_DEBUG)

View File

@ -14,21 +14,9 @@ else()
/opt/local/include/enchant)
endif()
if (ENCHANT_LIBRARY AND ENCHANT_INCLUDE_DIR)
set(ENCHANT_FOUND TRUE)
message(STATUS "Building with USE_ENCHANT")
else()
message(STATUS "Enchant not found, building without enchant support")
endif()
# handle the QUIETLY and REQUIRED arguments and
# handle the QUIETLY and REQUIRED arguments and
# set ENCHANT_FOUND to TRUE if all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(ENCHANT DEFAULT_MSG ENCHANT_LIBRARY ENCHANT_INCLUDE_DIR)
if(Enchant_FIND_REQUIRED AND NOT ENCHANT_FOUND)
message(FATAL_ERROR "Could not find Enchant library")
endif()
mark_as_advanced(ENCHANT_LIBRARY ENCHANT_INCLUDE_DIR)

View File

@ -7,14 +7,9 @@ endif()
FIND_PATH(HUNSPELL_INCLUDE_DIR "hunspell/hunspell.hxx")
# handle the QUIETLY and REQUIRED arguments and
# handle the QUIETLY and REQUIRED arguments and
# set HUNSPELL_FOUND to TRUE if all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(HUNSPELL DEFAULT_MSG HUNSPELL_LIBRARY HUNSPELL_INCLUDE_DIR)
if(HUNSPELL_FIND_REQUIRED AND NOT HUNSPELL_FOUND)
message(FATAL_ERROR "Could not find Hunspell library")
endif()
mark_as_advanced(HUNSPELL_LIBRARY HUNSPELL_INCLUDE_DIR)