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) 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) if (ASPELL_FIND_REQUIRED)
message(STATUS "Found ASPELL: ${ASPELL_LIBRARY}") message("aspell header : ${ASPELL_INCLUDE_DIR}")
endif() message("aspell lib release : ${ASPELL_LIBRARY_RELEASE}")
else() message("aspell lib debug : ${ASPELL_LIBRARY_DEBUG}")
if (ASPELL_FIND_REQUIRED) if(MSVC_IDE)
message("aspell header : ${ASPELL_INCLUDE_DIR}") # the ide needs the debug and release version
message("aspell lib release : ${ASPELL_LIBRARY_RELEASE}") if(NOT ASPELL_LIBRARY_DEBUG OR NOT ASPELL_LIBRARY_RELEASE)
message("aspell lib debug : ${ASPELL_LIBRARY_DEBUG}") 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")
if(MSVC_IDE) endif()
# the ide needs the debug and release version endif()
if(NOT ASPELL_LIBRARY_DEBUG OR NOT ASPELL_LIBRARY_RELEASE) endif()
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()
endif() endif()
MARK_AS_ADVANCED(ASPELL_INCLUDE_DIR ASPELL_LIBRARY ASPELL_LIBRARY_RELEASE ASPELL_LIBRARY_DEBUG) 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) /opt/local/include/enchant)
endif() endif()
if (ENCHANT_LIBRARY AND ENCHANT_INCLUDE_DIR) # handle the QUIETLY and REQUIRED arguments and
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
# 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)