summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorAlex Neundorf <neundorf@kde.org>2010-08-29 16:55:25 (GMT)
committerAlex Neundorf <neundorf@kde.org>2010-08-29 16:55:25 (GMT)
commitcc955a042b582a12238cc94507bf50dd9bce1220 (patch)
treeefc4d7b6682f3dd62cc94d1f360fe61e11d3a278 /Modules
parent0367245f0c1a665d44b7169cc0f24eda5dbb4de3 (diff)
downloadCMake-cc955a042b582a12238cc94507bf50dd9bce1220.zip
CMake-cc955a042b582a12238cc94507bf50dd9bce1220.tar.gz
CMake-cc955a042b582a12238cc94507bf50dd9bce1220.tar.bz2
Small cleanup of FindPackageHandleStandardArgs.cmake
-remove unnecessary arguments _VAR1 -move code for deciding the type of the message into helper macro _FPHSA_FAILURE_MESSAGE() Alex
Diffstat (limited to 'Modules')
-rw-r--r--Modules/FindPackageHandleStandardArgs.cmake38
1 files changed, 17 insertions, 21 deletions
diff --git a/Modules/FindPackageHandleStandardArgs.cmake b/Modules/FindPackageHandleStandardArgs.cmake
index c698480..db3af11 100644
--- a/Modules/FindPackageHandleStandardArgs.cmake
+++ b/Modules/FindPackageHandleStandardArgs.cmake
@@ -71,7 +71,18 @@ INCLUDE(FindPackageMessage)
INCLUDE(CMakeParseArguments)
-FUNCTION(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG _VAR1)
+MACRO(_FPHSA_FAILURE_MESSAGE _msg)
+ IF (${_NAME}_FIND_REQUIRED)
+ MESSAGE(FATAL_ERROR "${_msg}")
+ ELSE (${_NAME}_FIND_REQUIRED)
+ IF (NOT ${_NAME}_FIND_QUIETLY)
+ MESSAGE(STATUS "${_msg}")
+ ENDIF (NOT ${_NAME}_FIND_QUIETLY)
+ ENDIF (${_NAME}_FIND_REQUIRED)
+ENDMACRO(_FPHSA_FAILURE_MESSAGE _msg)
+
+
+FUNCTION(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG)
# set up the arguments for CMAKE_PARSE_ARGUMENTS and check whether we are in
# new extended or in the "old" mode:
@@ -83,11 +94,11 @@ FUNCTION(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG _VAR1)
IF(${INDEX} EQUAL -1)
SET(FPHSA_FAIL_MESSAGE ${_FIRST_ARG})
- SET(FPHSA_REQUIRED_VARS ${_VAR1} ${ARGN})
+ SET(FPHSA_REQUIRED_VARS ${ARGN})
SET(FPHSA_VERSION_VAR)
ELSE(${INDEX} EQUAL -1)
- CMAKE_PARSE_ARGUMENTS(FPHSA "${options}" "${oneValueArgs}" "${multiValueArgs}" ${_FIRST_ARG} ${_VAR1} ${ARGN})
+ CMAKE_PARSE_ARGUMENTS(FPHSA "${options}" "${oneValueArgs}" "${multiValueArgs}" ${_FIRST_ARG} ${ARGN})
IF(FPHSA_UNPARSED_ARGUMENTS)
MESSAGE(FATAL_ERROR "Unknown keywords given to FIND_PACKAGE_HANDLE_STANDARD_ARGS(): \"${FPHSA_UNPARSED_ARGUMENTS}\"")
@@ -112,7 +123,7 @@ FUNCTION(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG _VAR1)
STRING(TOUPPER ${_NAME} _NAME_UPPER)
- # collect all variables which were not found, so they can be printed, so the
+ # collect all variables which were not found, so they can be printed, so the
# user knows better what went wrong (#6375)
SET(MISSING_VARS "")
SET(DETAILS "")
@@ -183,24 +194,9 @@ FUNCTION(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG _VAR1)
FIND_PACKAGE_MESSAGE(${_NAME} "Found ${_NAME}: ${${_FIRST_REQUIRED_VAR}} ${VERSION_MSG}" "${DETAILS}")
ELSE (${_NAME_UPPER}_FOUND)
IF(NOT VERSION_OK)
-
- IF (${_NAME}_FIND_REQUIRED)
- MESSAGE(FATAL_ERROR "${FPHSA_FAIL_MESSAGE}: ${VERSION_MSG} (found ${${_FIRST_REQUIRED_VAR}})")
- ELSE (${_NAME}_FIND_REQUIRED)
- IF (NOT ${_NAME}_FIND_QUIETLY)
- MESSAGE(STATUS "${FPHSA_FAIL_MESSAGE}: ${VERSION_MSG} (found ${${_FIRST_REQUIRED_VAR}})")
- ENDIF (NOT ${_NAME}_FIND_QUIETLY)
- ENDIF (${_NAME}_FIND_REQUIRED)
-
+ _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: ${VERSION_MSG} (found ${${_FIRST_REQUIRED_VAR}})")
ELSE(NOT VERSION_OK)
-
- IF (${_NAME}_FIND_REQUIRED)
- MESSAGE(FATAL_ERROR "${FPHSA_FAIL_MESSAGE} (missing: ${MISSING_VARS}) ${VERSION_MSG}")
- ELSE (${_NAME}_FIND_REQUIRED)
- IF (NOT ${_NAME}_FIND_QUIETLY)
- MESSAGE(STATUS "${FPHSA_FAIL_MESSAGE} (missing: ${MISSING_VARS}) ${VERSION_MSG}")
- ENDIF (NOT ${_NAME}_FIND_QUIETLY)
- ENDIF (${_NAME}_FIND_REQUIRED)
+ _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE} (missing: ${MISSING_VARS}) ${VERSION_MSG}")
ENDIF(NOT VERSION_OK)
ENDIF (${_NAME_UPPER}_FOUND)