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

View File

@ -14,21 +14,9 @@ else()
/opt/local/include/enchant) /opt/local/include/enchant)
endif() 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 # set ENCHANT_FOUND to TRUE if all listed variables are TRUE
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(ENCHANT DEFAULT_MSG ENCHANT_LIBRARY ENCHANT_INCLUDE_DIR) 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) mark_as_advanced(ENCHANT_LIBRARY ENCHANT_INCLUDE_DIR)

View File

@ -7,14 +7,9 @@ endif()
FIND_PATH(HUNSPELL_INCLUDE_DIR "hunspell/hunspell.hxx") 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 # set HUNSPELL_FOUND to TRUE if all listed variables are TRUE
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(HUNSPELL DEFAULT_MSG HUNSPELL_LIBRARY HUNSPELL_INCLUDE_DIR) 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) mark_as_advanced(HUNSPELL_LIBRARY HUNSPELL_INCLUDE_DIR)