Commit fd26999f authored by Ben Boeckel's avatar Ben Boeckel

cmake: remove arguments to else and endfoo commands

They're unnecessary and annoying to keep in-sync anyways. Just remove
them.

Change-Id: If7327e0cef17fa1c2d3d41877c4ff7568802fd41
parent d55b4b21
......@@ -32,9 +32,9 @@ MACRO(CHECK_CXX_EXPRESSION_COMPILES EXPRESSION FILES VARIABLE)
SET(SOURCE "/* CHECK_CXX_EXPRESSION_COMPILES */\n")
FOREACH(FILE ${FILES})
SET(SOURCE "${SOURCE}#include <${FILE}>\n")
ENDFOREACH(FILE ${FILES})
ENDFOREACH()
SET(SOURCE "${SOURCE}\nint main()\n{\n")
SET(SOURCE "${SOURCE} static_cast<void>(${EXPRESSION});\n\n")
SET(SOURCE "${SOURCE} return 0;\n}\n")
CHECK_CXX_SOURCE_COMPILES("${SOURCE}" "${VARIABLE}")
ENDMACRO(CHECK_CXX_EXPRESSION_COMPILES)
ENDMACRO()
......@@ -19,15 +19,15 @@ MACRO(CHECK_CXX_SOURCE_RUNS SOURCE VAR COMMENT)
IF(CMAKE_REQUIRED_LIBRARIES)
SET(CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES
"-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}")
ELSE(CMAKE_REQUIRED_LIBRARIES)
ELSE()
SET(CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES)
ENDIF(CMAKE_REQUIRED_LIBRARIES)
ENDIF()
IF(CMAKE_REQUIRED_INCLUDES)
SET(CHECK_CXX_SOURCE_COMPILES_ADD_INCLUDES
"-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}")
ELSE(CMAKE_REQUIRED_INCLUDES)
ELSE()
SET(CHECK_CXX_SOURCE_COMPILES_ADD_INCLUDES)
ENDIF(CMAKE_REQUIRED_INCLUDES)
ENDIF()
SET(CMAKE_EMPTY_INPUT_FILE_CONTENT "${SOURCE}")
CONFIGURE_FILE("${VTK_SOURCE_DIR}/CMake/CMakeEmptyInputFile.in"
"${CMAKE_BINARY_DIR}/CMakeFiles/CMakeTmp/src.cxx")
......@@ -48,15 +48,15 @@ MACRO(CHECK_CXX_SOURCE_RUNS SOURCE VAR COMMENT)
"Performing C++ SOURCE FILE Test ${COMMENT} succeded with the following output:\n"
"${OUTPUT}\n"
"Source file was:\n${SOURCE}\n")
ELSE(HAVE_${VAR})
ELSE()
MESSAGE(STATUS "Performing Test ${COMMENT} - Failed")
SET(${VAR} "" CACHE INTERNAL "Test ${COMMENT}")
FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log
"Performing C++ SOURCE FILE Test ${COMMENT} failed with the following output:\n"
"${OUTPUT}\n"
"Source file was:\n${SOURCE}\n")
ENDIF(HAVE_${VAR})
ENDIF()
ENDIF()
ENDMACRO(CHECK_CXX_SOURCE_RUNS)
ENDMACRO()
......@@ -21,7 +21,7 @@ IF(Boost_INCLUDE_DIR AND EXISTS "${Boost_INCLUDE_DIR}/boost/version.hpp")
STRING(REGEX REPLACE
"^#define BOOST_VERSION ([0-9]+).*EOL$" "\\1"
BOOST_VERSION "${line}")
ENDIF("${line}" MATCHES "^#define BOOST_VERSION ([0-9]+).*EOL$")
ENDIF()
# And BOOST_LIB_VERSION:
#
......@@ -29,8 +29,8 @@ IF(Boost_INCLUDE_DIR AND EXISTS "${Boost_INCLUDE_DIR}/boost/version.hpp")
STRING(REGEX REPLACE
"^#define BOOST_LIB_VERSION \"([0-9_]+)\".*EOL$" "\\1"
BOOST_LIB_VERSION "${line}")
ENDIF("${line}" MATCHES "^#define BOOST_LIB_VERSION \"([0-9_]+)\".*EOL$")
ENDFOREACH(line)
ENDIF()
ENDFOREACH()
# Compute major, minor and subminor versions according to comments in
# boost/version.hpp:
......@@ -39,8 +39,8 @@ IF(Boost_INCLUDE_DIR AND EXISTS "${Boost_INCLUDE_DIR}/boost/version.hpp")
MATH(EXPR BOOST_MAJOR_VERSION "${BOOST_VERSION} / 100000")
MATH(EXPR BOOST_MINOR_VERSION "${BOOST_VERSION} / 100 % 1000")
MATH(EXPR BOOST_SUBMINOR_VERSION "${BOOST_VERSION} % 100")
ENDIF(NOT "${BOOST_VERSION}" STREQUAL "0")
ENDIF(Boost_INCLUDE_DIR AND EXISTS "${Boost_INCLUDE_DIR}/boost/version.hpp")
ENDIF()
ENDIF()
#MESSAGE("BOOST_VERSION='${BOOST_VERSION}'")
#MESSAGE("BOOST_MAJOR_VERSION='${BOOST_MAJOR_VERSION}'")
......
......@@ -123,10 +123,10 @@ find_file(ADIOS_CONFIG
if(ADIOS_CONFIG)
message(STATUS "Found 'adios_config': ${ADIOS_CONFIG}")
else(ADIOS_CONFIG)
else()
set(ADIOS_FOUND FALSE)
message(STATUS "Can NOT find 'adios_config' - set ADIOS_ROOT, ADIOS_DIR or INSTALL_PREFIX, or check your PATH")
endif(ADIOS_CONFIG)
endif()
# check `adios_config` program ################################################
if(ADIOS_FOUND)
......@@ -147,7 +147,7 @@ if(ADIOS_FOUND)
set(ADIOS_FOUND FALSE)
message(STATUS "The directory provided by 'adios_config -d' does not exist: ${ADIOS_ROOT_DIR}")
endif()
endif(ADIOS_FOUND)
endif()
# option: use only static libs ################################################
if(ADIOS_USE_STATIC_LIBS)
......@@ -192,10 +192,10 @@ if(ADIOS_FOUND)
if(_LIB_DIR)
message(STATUS "Found ${_LIB} in ${_LIB_DIR}")
list(APPEND ADIOS_LIBRARIES "${_LIB_DIR}")
else(_LIB_DIR)
else()
set(ADIOS_FOUND FALSE)
message(STATUS "ADIOS: Could NOT find library '${_LIB}'")
endif(_LIB_DIR)
endif()
# clean cached var
unset(_LIB_DIR CACHE)
......@@ -211,13 +211,13 @@ if(ADIOS_FOUND)
OUTPUT_VARIABLE ADIOS_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE)
endif(ADIOS_FOUND)
endif()
# unset checked variables if not found
if(NOT ADIOS_FOUND)
unset(ADIOS_INCLUDE_DIRS)
unset(ADIOS_LIBRARIES)
endif(NOT ADIOS_FOUND)
endif()
# restore CMAKE_FIND_LIBRARY_SUFFIXES if manipulated by this module ###########
......
......@@ -22,7 +22,7 @@ if(WIN32) # The only platform it makes sense to check for DirectX SDK
mark_as_advanced(DirectX_INCLUDE_DIR)
if(DirectX_INCLUDE_DIR)
set(DirectX_ROOT_DIR "${DirectX_INCLUDE_DIR}/..")
endif(DirectX_INCLUDE_DIR)
endif()
# dlls are in DirectX_ROOT_DIR/Developer Runtime/x64|x86
# lib files are in DirectX_ROOT_DIR/Lib/x64|x86
......@@ -31,15 +31,15 @@ if(WIN32) # The only platform it makes sense to check for DirectX SDK
if(CMAKE_CL_64)
set(DirectX_LIBRARY_PATHS
"${DirectX_ROOT_DIR}/Lib/x64")
else(CMAKE_CL_64)
else()
set(DirectX_LIBRARY_PATHS
"${DirectX_ROOT_DIR}/Lib/x86" "${DirectX_ROOT_DIR}/Lib")
endif(CMAKE_CL_64)
endif()
find_library(DirectX_LIBRARY d3d9 ${DirectX_LIBRARY_PATHS} NO_DEFAULT_PATH)
if(DirectX_INCLUDE_DIR AND DirectX_LIBRARY)
set(DirectX_FOUND true)
endif(DirectX_INCLUDE_DIR AND DirectX_LIBRARY)
endif()
mark_as_advanced(DirectX_LIBRARY)
#message("DirectX_FOUND=${DirectX_FOUND}")
......@@ -47,4 +47,4 @@ if(WIN32) # The only platform it makes sense to check for DirectX SDK
#message("DirectX_LIBRARY=${DirectX_LIBRARY}")
#message("DirectX_ROOT_DIR=${DirectX_ROOT_DIR}")
endif(WIN32)
endif()
......@@ -34,7 +34,7 @@ if (EIGEN2_INCLUDE_DIR)
# in cache already
set(EIGEN2_FOUND TRUE)
else (EIGEN2_INCLUDE_DIR)
else ()
find_path(EIGEN2_INCLUDE_DIR NAMES Eigen/Core
PATHS
......@@ -49,4 +49,4 @@ find_package_handle_standard_args(Eigen2 DEFAULT_MSG EIGEN2_INCLUDE_DIR )
mark_as_advanced(EIGEN2_INCLUDE_DIR)
endif(EIGEN2_INCLUDE_DIR)
endif()
......@@ -18,16 +18,16 @@
if(NOT Eigen3_FIND_VERSION)
if(NOT Eigen3_FIND_VERSION_MAJOR)
set(Eigen3_FIND_VERSION_MAJOR 2)
endif(NOT Eigen3_FIND_VERSION_MAJOR)
endif()
if(NOT Eigen3_FIND_VERSION_MINOR)
set(Eigen3_FIND_VERSION_MINOR 91)
endif(NOT Eigen3_FIND_VERSION_MINOR)
endif()
if(NOT Eigen3_FIND_VERSION_PATCH)
set(Eigen3_FIND_VERSION_PATCH 0)
endif(NOT Eigen3_FIND_VERSION_PATCH)
endif()
set(Eigen3_FIND_VERSION "${Eigen3_FIND_VERSION_MAJOR}.${Eigen3_FIND_VERSION_MINOR}.${Eigen3_FIND_VERSION_PATCH}")
endif(NOT Eigen3_FIND_VERSION)
endif()
macro(_eigen3_check_version)
file(READ "${EIGEN3_INCLUDE_DIR}/Eigen/src/Core/util/Macros.h" _eigen3_version_header)
......@@ -42,16 +42,16 @@ macro(_eigen3_check_version)
set(EIGEN3_VERSION ${EIGEN3_WORLD_VERSION}.${EIGEN3_MAJOR_VERSION}.${EIGEN3_MINOR_VERSION})
if(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
set(EIGEN3_VERSION_OK FALSE)
else(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
else()
set(EIGEN3_VERSION_OK TRUE)
endif(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
endif()
if(NOT EIGEN3_VERSION_OK)
message(STATUS "Eigen3 version ${EIGEN3_VERSION} found in ${EIGEN3_INCLUDE_DIR}, "
"but at least version ${Eigen3_FIND_VERSION} is required")
endif(NOT EIGEN3_VERSION_OK)
endmacro(_eigen3_check_version)
endif()
endmacro()
if (EIGEN3_INCLUDE_DIR)
......@@ -59,7 +59,7 @@ if (EIGEN3_INCLUDE_DIR)
_eigen3_check_version()
set(EIGEN3_FOUND ${EIGEN3_VERSION_OK})
else (EIGEN3_INCLUDE_DIR)
else ()
find_path(EIGEN3_INCLUDE_DIR NAMES signature_of_eigen3_matrix_library
PATHS
......@@ -70,11 +70,11 @@ else (EIGEN3_INCLUDE_DIR)
if(EIGEN3_INCLUDE_DIR)
_eigen3_check_version()
endif(EIGEN3_INCLUDE_DIR)
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Eigen3 DEFAULT_MSG EIGEN3_INCLUDE_DIR EIGEN3_VERSION_OK)
mark_as_advanced(EIGEN3_INCLUDE_DIR)
endif(EIGEN3_INCLUDE_DIR)
endif()
......@@ -32,6 +32,6 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(GL2PS DEFAULT_MSG GL2PS_LIBRARY GL2PS_INCLU
IF(GL2PS_FOUND)
SET( GL2PS_LIBRARIES ${GL2PS_LIBRARY} )
ENDIF(GL2PS_FOUND)
ENDIF()
MARK_AS_ADVANCED(GL2PS_INCLUDE_DIR GL2PS_LIBRARY)
......@@ -9,7 +9,7 @@ if ( NOT LIBPROJ4_INCLUDE_DIR OR NOT LIBPROJ4_LIBRARIES OR NOT LIBPROJ4_FOUND )
if ( $ENV{LIBPROJ4_DIR} )
file( TO_CMAKE_PATH "$ENV{LIBPROJ4_DIR}" _LIBPROJ4_DIR )
endif ( $ENV{LIBPROJ4_DIR} )
endif ()
find_library( LIBPROJ4_LIBRARIES
NAMES proj4 libproj4
......@@ -43,13 +43,13 @@ if ( NOT LIBPROJ4_INCLUDE_DIR OR NOT LIBPROJ4_LIBRARIES OR NOT LIBPROJ4_FOUND )
if ( NOT LIBPROJ4_INCLUDE_DIR OR NOT LIBPROJ4_LIBRARIES )
if ( LIBPROJ4_REQUIRED )
message( FATAL_ERROR "LIBPROJ4 is required. Set LIBPROJ4_DIR" )
endif ( LIBPROJ4_REQUIRED )
else ( NOT LIBPROJ4_INCLUDE_DIR OR NOT LIBPROJ4_LIBRARIES )
endif ()
else ()
set( LIBPROJ4_FOUND 1 )
mark_as_advanced( LIBPROJ4_FOUND )
endif ( NOT LIBPROJ4_INCLUDE_DIR OR NOT LIBPROJ4_LIBRARIES )
endif ()
endif ( NOT LIBPROJ4_INCLUDE_DIR OR NOT LIBPROJ4_LIBRARIES OR NOT LIBPROJ4_FOUND )
endif ()
mark_as_advanced( FORCE LIBPROJ4_INCLUDE_DIR )
mark_as_advanced( FORCE LIBPROJ4_LIBRARIES )
......@@ -30,9 +30,9 @@ SET(vtkMPEG2Encode_LIBRARIES "vtkMPEG2Encode_LIBRARIES-NOTFOUND" CACHE STRING "S
IF(VTK_USE_MPEG2_ENCODER)
IF(NOT vtkMPEG2Encode_INCLUDE_PATH)
MESSAGE(SEND_ERROR "Could not determine value for vtkMPEG2Encode_INCLUDE_PATH. Provide value or turn off VTK_USE_MPEG2_ENCODER. Value should be a semi-colon delimited list of paths to vtkmpeg2encode header files.")
ENDIF(NOT vtkMPEG2Encode_INCLUDE_PATH)
ENDIF()
IF(NOT vtkMPEG2Encode_LIBRARIES)
MESSAGE(SEND_ERROR "Could not determine value for vtkMPEG2Encode_LIBRARIES. Provide value or turn off VTK_USE_MPEG2_ENCODER. Value should be a semi-colon delimited list of vtkMPEG2Encode library full path names.")
ENDIF(NOT vtkMPEG2Encode_LIBRARIES)
ENDIF(VTK_USE_MPEG2_ENCODER)
ENDIF()
ENDIF()
......@@ -14,58 +14,58 @@ IF(UNIX)
SET(MATLAB_ROOT_SEARCH "/Applications")
IF(CMAKE_SIZEOF_VOID_P EQUAL 4)
SET(MATLAB_DIR_PREFIX "maci")
ELSE(CMAKE_SIZEOF_VOID_P EQUAL 4)
ELSE()
SET(MATLAB_DIR_PREFIX "maci64")
ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 4)
ELSE(APPLE)
ENDIF()
ELSE()
SET(MATLAB_ROOT_SEARCH "/usr/local/")
IF(CMAKE_SIZEOF_VOID_P EQUAL 4)
SET(MATLAB_DIR_PREFIX "glnx86")
ELSE(CMAKE_SIZEOF_VOID_P EQUAL 4)
ELSE()
SET(MATLAB_DIR_PREFIX "glnxa64")
ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 4)
ENDIF(APPLE)
ELSE(UNIX)
ENDIF()
ENDIF()
ELSE()
SET(MATLAB_ROOT_SEARCH "C:/PROGRA~1/")
IF(CMAKE_SIZEOF_VOID_P EQUAL 4)
SET(MATLAB_DIR_PREFIX "win32")
ELSE(CMAKE_SIZEOF_VOID_P EQUAL 4)
ELSE()
SET(MATLAB_DIR_PREFIX "win64")
ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 4)
ENDIF(UNIX)
ENDIF()
ENDIF()
FIND_PROGRAM(MATLAB_EXECUTABLE matlab PATHS ${MATLAB_ROOT_SEARCH})
IF(NOT MATLAB_EXECUTABLE)
MESSAGE( FATAL_ERROR "Matlab program not found, please specify MATLAB_EXECUTABLE" )
ENDIF(NOT MATLAB_EXECUTABLE)
ENDIF()
GET_FILENAME_COMPONENT(MATLAB_ROOT_DIR_WORK ${MATLAB_EXECUTABLE} PATH)
IF("${MATLAB_ROOT_DIR_WORK}" MATCHES "/${MATLAB_DIR_PREFIX}$")
GET_FILENAME_COMPONENT(MATLAB_ROOT_DIR ${MATLAB_ROOT_DIR_WORK} PATH CACHE)
ENDIF("${MATLAB_ROOT_DIR_WORK}" MATCHES "/${MATLAB_DIR_PREFIX}$")
ENDIF()
IF("${MATLAB_ROOT_DIR_WORK}" MATCHES "/bin$")
GET_FILENAME_COMPONENT(MATLAB_ROOT_DIR ${MATLAB_ROOT_DIR_WORK} PATH CACHE)
ENDIF("${MATLAB_ROOT_DIR_WORK}" MATCHES "/bin$")
ENDIF()
FIND_PATH(MATLAB_INCLUDE_DIR NAMES mex.h PATHS ${MATLAB_ROOT_DIR}/extern/include CACHE DOCSTRING)
#Find Library directory
IF(NOT WIN32)
FIND_LIBRARY(MATLAB_LIB_DIR_WORK mex ${MATLAB_ROOT_DIR}/bin/${MATLAB_DIR_PREFIX})
ELSE(NOT WIN32)
ELSE()
FIND_LIBRARY(MATLAB_LIB_DIR_WORK mex ${MATLAB_ROOT_DIR}/extern/lib/${MATLAB_DIR_PREFIX}/microsoft)
ENDIF(NOT WIN32)
ENDIF()
GET_FILENAME_COMPONENT(MATLAB_LIB_DIR ${MATLAB_LIB_DIR_WORK} PATH CACHE)
UNSET(MATLAB_LIB_DIR_WORK CACHE)
# Find mex executable
IF(NOT WIN32)
FIND_PROGRAM(MATLAB_MEX_EXECUTABLE NAMES mex PATHS ${MATLAB_ROOT_DIR} ${MATLAB_ROOT_DIR_WORK} DOC "Path to Matlab mex compiler")
ELSE(NOT WIN32)
ELSE()
FIND_FILE(MATLAB_MEX_EXECUTABLE NAMES mex.bat PATHS ${MATLAB_ROOT_DIR} ${MATLAB_ROOT_DIR_WORK} DOC "Path to Matlab mex compiler")
ENDIF(NOT WIN32)
ENDIF()
SET(MATLAB_MEX_USE_FILE ${VTK_SOURCE_DIR}/CMake/UseMatlabMex.cmake)
......@@ -55,15 +55,15 @@ IF (NOT WIN32)
NAMES z zlib
PATHS /usr/lib /usr/local/lib
DOC "If more libraries are necessary to link in a MySQL client (typically zlib), specify them here.")
ELSE (NOT WIN32)
ELSE ()
SET( MYSQL_EXTRA_LIBRARIES "" )
ENDIF (NOT WIN32)
ENDIF ()
IF (MYSQL_LIBRARY)
IF (MYSQL_INCLUDE_DIRECTORIES)
SET( MYSQL_FOUND 1 )
ENDIF (MYSQL_INCLUDE_DIRECTORIES)
ENDIF (MYSQL_LIBRARY)
ENDIF ()
ENDIF ()
MARK_AS_ADVANCED( MYSQL_FOUND MYSQL_LIBRARY MYSQL_EXTRA_LIBRARIES MYSQL_INCLUDE_DIRECTORIES )
......@@ -35,4 +35,4 @@ find_path(NVCtrlLib_INCLUDE_DIR NVCtrlLib.h /usr/include/NVCtrl
if(NVCtrlLib_LIBRARY AND NVCtrlLib_INCLUDE_DIR)
set(NVCtrlLib_FOUND true)
endif(NVCtrlLib_LIBRARY AND NVCtrlLib_INCLUDE_DIR)
endif()
......@@ -88,7 +88,7 @@ macro (NetCDF_check_interface lang header libs)
message (STATUS "Failed to find NetCDF interface for ${lang}")
endif ()
endif ()
endmacro (NetCDF_check_interface)
endmacro ()
list (FIND NetCDF_FIND_COMPONENTS "CXX" _nextcomp)
if (_nextcomp GREATER -1)
......
......@@ -45,8 +45,8 @@ FIND_LIBRARY( ODBC_LIBRARY
IF (ODBC_LIBRARY)
IF (ODBC_INCLUDE_DIRECTORIES)
SET( ODBC_FOUND 1 )
ENDIF (ODBC_INCLUDE_DIRECTORIES)
ENDIF (ODBC_LIBRARY)
ENDIF ()
ENDIF ()
SET( ODBC_LIBRARIES ${ODBC_LIBRARY} )
......
......@@ -44,7 +44,7 @@ TRY_RUN(
IF(NOT _OGGTHEORA_COMPILE_SUCCESS)
MESSAGE(SEND_ERROR "Failed to compile ${_CURRENT_DIR}/TestOggTheoraSubsampling.c")
ENDIF(NOT _OGGTHEORA_COMPILE_SUCCESS)
ENDIF()
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OGGTHEORA
......
......@@ -36,7 +36,7 @@ if ( NOT PQXX_INCLUDE_DIRECTORIES OR NOT PQXX_LIBRARIES )
DOC "Path to pqxx/pqxx header file. Do not include the 'pqxx' directory in this value."
NO_DEFAULT_PATH
)
endif ( POSTGRES_FOUND )
endif ()
if ( PQXX_HEADER_PATH AND PQXX_LIBRARY )
......@@ -47,9 +47,9 @@ if ( NOT PQXX_INCLUDE_DIRECTORIES OR NOT PQXX_LIBRARIES )
mark_as_advanced( FORCE PQXX_INCLUDE_DIRECTORIES )
mark_as_advanced( FORCE PQXX_LIBRARIES )
else ( PQXX_HEADER_PATH AND PQXX_LIBRARY )
else ()
message( "PQXX NOT FOUND" )
endif ( PQXX_HEADER_PATH AND PQXX_LIBRARY )
endif ()
endif ( NOT PQXX_INCLUDE_DIRECTORIES OR NOT PQXX_LIBRARIES )
endif ()
......@@ -95,12 +95,12 @@ INCLUDE(CMakeParseArguments)
MACRO(_FPHSA_FAILURE_MESSAGE _msg)
IF (${_NAME}_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "${_msg}")
ELSE (${_NAME}_FIND_REQUIRED)
ELSE ()
IF (NOT ${_NAME}_FIND_QUIETLY)
MESSAGE(STATUS "${_msg}")
ENDIF (NOT ${_NAME}_FIND_QUIETLY)
ENDIF (${_NAME}_FIND_REQUIRED)
ENDMACRO(_FPHSA_FAILURE_MESSAGE _msg)
ENDIF ()
ENDIF ()
ENDMACRO()
# internal helper macro to generate the failure message when used in CONFIG_MODE:
......@@ -108,7 +108,7 @@ MACRO(_FPHSA_HANDLE_FAILURE_CONFIG_MODE)
# <name>_CONFIG is set, but FOUND is false, this means that some other of the REQUIRED_VARS was not found:
IF(${_NAME}_CONFIG)
_FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: missing: ${MISSING_VARS} (found ${${_NAME}_CONFIG} ${VERSION_MSG})")
ELSE(${_NAME}_CONFIG)
ELSE()
# If _CONSIDERED_CONFIGS is set, the config-file has been found, but no suitable version.
# List them all in the error message:
IF(${_NAME}_CONSIDERED_CONFIGS)
......@@ -119,15 +119,15 @@ MACRO(_FPHSA_HANDLE_FAILURE_CONFIG_MODE)
LIST(GET ${_NAME}_CONSIDERED_CONFIGS ${currentConfigIndex} filename)
LIST(GET ${_NAME}_CONSIDERED_VERSIONS ${currentConfigIndex} version)
SET(configsText "${configsText} ${filename} (version ${version})\n")
ENDFOREACH(currentConfigIndex)
ENDFOREACH()
_FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE} ${VERSION_MSG}, checked the following files:\n${configsText}")
ELSE(${_NAME}_CONSIDERED_CONFIGS)
ELSE()
# Simple case: No Config-file was found at all:
_FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: found neither ${_NAME}Config.cmake nor ${_NAME_LOWER}-config.cmake ${VERSION_MSG}")
ENDIF(${_NAME}_CONSIDERED_CONFIGS)
ENDIF(${_NAME}_CONFIG)
ENDMACRO(_FPHSA_HANDLE_FAILURE_CONFIG_MODE)
ENDIF()
ENDIF()
ENDMACRO()
FUNCTION(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG)
......@@ -144,24 +144,24 @@ FUNCTION(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG)
SET(FPHSA_FAIL_MESSAGE ${_FIRST_ARG})
SET(FPHSA_REQUIRED_VARS ${ARGN})
SET(FPHSA_VERSION_VAR)
ELSE(${INDEX} EQUAL -1)
ELSE()
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}\"")
ENDIF(FPHSA_UNPARSED_ARGUMENTS)
ENDIF()
IF(NOT FPHSA_FAIL_MESSAGE)
SET(FPHSA_FAIL_MESSAGE "DEFAULT_MSG")
ENDIF(NOT FPHSA_FAIL_MESSAGE)
ENDIF(${INDEX} EQUAL -1)
ENDIF()
ENDIF()
# now that we collected all arguments, process them
IF("${FPHSA_FAIL_MESSAGE}" STREQUAL "DEFAULT_MSG")
SET(FPHSA_FAIL_MESSAGE "Could NOT find ${_NAME}")
ENDIF("${FPHSA_FAIL_MESSAGE}" STREQUAL "DEFAULT_MSG")
ENDIF()
# In config-mode, we rely on the variable <package>_CONFIG, which is set by find_package()
# when it successfully found the config-file, including version checking:
......@@ -169,11 +169,11 @@ FUNCTION(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG)
LIST(INSERT FPHSA_REQUIRED_VARS 0 ${_NAME}_CONFIG)
LIST(REMOVE_DUPLICATES FPHSA_REQUIRED_VARS)
SET(FPHSA_VERSION_VAR ${_NAME}_VERSION)
ENDIF(FPHSA_CONFIG_MODE)
ENDIF()
IF(NOT FPHSA_REQUIRED_VARS)
MESSAGE(FATAL_ERROR "No REQUIRED_VARS specified for FIND_PACKAGE_HANDLE_STANDARD_ARGS()")
ENDIF(NOT FPHSA_REQUIRED_VARS)
ENDIF()
LIST(GET FPHSA_REQUIRED_VARS 0 _FIRST_REQUIRED_VAR)
......@@ -190,10 +190,10 @@ FUNCTION(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG)
IF(NOT ${_CURRENT_VAR})
SET(${_NAME_UPPER}_FOUND FALSE)
SET(MISSING_VARS "${MISSING_VARS} ${_CURRENT_VAR}")
ELSE(NOT ${_CURRENT_VAR})
ELSE()
SET(DETAILS "${DETAILS}[${${_CURRENT_VAR}}]")
ENDIF(NOT ${_CURRENT_VAR})
ENDFOREACH(_CURRENT_VAR)
ENDIF()
ENDFOREACH()
# component handling
UNSET(FOUND_COMPONENTS_MSG)
......@@ -221,10 +221,10 @@ FUNCTION(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG)
ENDIF()
ENDIF()
ENDFOREACH(comp)
ENDFOREACH()
SET(COMPONENT_MSG "${FOUND_COMPONENTS_MSG} ${MISSING_COMPONENTS_MSG}")
SET(DETAILS "${DETAILS}[c${COMPONENT_MSG}]")
ENDIF(FPHSA_HANDLE_COMPONENTS)
ENDIF()
# version handling:
SET(VERSION_MSG "")
......@@ -238,59 +238,59 @@ FUNCTION(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG)
IF (NOT "${${_NAME}_FIND_VERSION}" VERSION_EQUAL "${VERSION}")
SET(VERSION_MSG "Found unsuitable version \"${VERSION}\", but required is exact version \"${${_NAME}_FIND_VERSION}\"")
SET(VERSION_OK FALSE)
ELSE (NOT "${${_NAME}_FIND_VERSION}" VERSION_EQUAL "${VERSION}")
ELSE ()
SET(VERSION_MSG "(found suitable exact version \"${VERSION}\")")
ENDIF (NOT "${${_NAME}_FIND_VERSION}" VERSION_EQUAL "${VERSION}")
ENDIF ()
ELSE(${_NAME}_FIND_VERSION_EXACT) # minimum version specified:
ELSE() # minimum version specified:
IF ("${${_NAME}_FIND_VERSION}" VERSION_GREATER "${VERSION}")
SET(VERSION_MSG "Found unsuitable version \"${VERSION}\", but required is at least \"${${_NAME}_FIND_VERSION}\"")
SET(VERSION_OK FALSE)
ELSE ("${${_NAME}_FIND_VERSION}" VERSION_GREATER "${VERSION}")
ELSE ()
SET(VERSION_MSG "(found suitable version \"${VERSION}\", required is \"${${_NAME}_FIND_VERSION}\")")
ENDIF ("${${_NAME}_FIND_VERSION}" VERSION_GREATER "${VERSION}")
ENDIF(${_NAME}_FIND_VERSION_EXACT)
ENDIF ()
ENDIF()
ELSE(VERSION)
ELSE()
# if the package was not found, but a version was given, add that to the output:
IF(${_NAME}_FIND_VERSION_EXACT)
SET(VERSION_MSG "(Required is exact version \"${${_NAME}_FIND_VERSION}\")")
ELSE(${_NAME}_FIND_VERSION_EXACT)
ELSE()
SET(VERSION_MSG "(Required is at least version \"${${_NAME}_FIND_VERSION}\")")
ENDIF(${_NAME}_FIND_VERSION_EXACT)
ENDIF()
ENDIF(VERSION)
ELSE (${_NAME}_FIND_VERSION)
ENDIF()
ELSE ()
IF(VERSION)
SET(VERSION_MSG "(found version \"${VERSION}\")")
ENDIF(VERSION)
ENDIF (${_NAME}_FIND_VERSION)
ENDIF()
ENDIF ()
IF(VERSION_OK)
SET(DETAILS "${DETAILS}[v${VERSION}(${${_NAME}_FIND_VERSION})]")
ELSE(VERSION_OK)
ELSE()
SET(${_NAME_UPPER}_FOUND FALSE)
ENDIF(VERSION_OK)
ENDIF()
# print the result:
IF (${_NAME_UPPER}_FOUND)
FIND_PACKAGE_MESSAGE(${_NAME} "Found ${_NAME}: ${${_FIRST_REQUIRED_VAR}} ${VERSION_MSG} ${COMPONENT_MSG}" "${DETAILS}")
ELSE (${_NAME_UPPER}_FOUND)
ELSE ()
IF(FPHSA_CONFIG_MODE)
_FPHSA_HANDLE_FAILURE_CONFIG_MODE()
ELSE(FPHSA_CONFIG_MODE)
ELSE()
IF(NOT VERSION_OK)
_FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: ${VERSION_MSG} (found ${${_FIRST_REQUIRED_VAR}})")
ELSE(NOT VERSION_OK)
ELSE()
_FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE} (missing: ${MISSING_VARS}) ${VERSION_MSG}")
ENDIF(NOT VERSION_OK)
ENDIF(FPHSA_CONFIG_MODE)
ENDIF()
ENDIF()
ENDIF (${_NAME_UPPER}_FOUND)
ENDIF ()
SET(${_NAME_UPPER}_FOUND ${${_NAME_UPPER}_FOUND} PARENT_SCOPE)
ENDFUNCTION(FIND_PACKAGE_HANDLE_STANDARD_ARGS _FIRST_ARG)
ENDFUNCTION()
......@@ -8,7 +8,7 @@
# if( PostgreSQL_FOUND )
# include_directories(${PostgreSQL_INCLUDE_DIRS})
# link_directories(${PostgreSQL_LIBRARY_DIRS})
# endif( PostgreSQL_FOUND )
# endif()
# ...
# Remember to include ${PostgreSQL_LIBRARIES} in the target_link_libraries() statement.
#
......@@ -87,7 +87,7 @@ set(PostgreSQL_ROOT_DIR_MESSAGE "Set the PostgreSQL_ROOT system variable to wher
set(PostgreSQL_ROOT_DIRECTORIES $ENV{PostgreSQL_ROOT})
if(PostgreSQL_ROOT_DIRECTORIES)
file(TO_CMAKE_PATH ${PostgreSQL_ROOT_DIRECTORIES} PostgreSQL_ROOT_DIRECTORIES)
endif(PostgreSQL_ROOT_DIRECTORIES)
endif()
set(PostgreSQL_KNOWN_VERSIONS ${PostgreSQL_ADDITIONAL_VERSIONS}
"9.1" "9.0" "8.4" "8.3" "8.2" "8.1" "8.0")
......@@ -96,8 +96,8 @@ set(PostgreSQL_KNOWN_VERSIONS ${PostgreSQL_ADDITIONAL_VERSIONS}
if ( WIN32 )
foreach (suffix ${PostgreSQL_KNOWN_VERSIONS} )
set(PostgreSQL_ADDITIONAL_SEARCH_PATHS ${PostgreSQL_ADDITIONAL_SEARCH_PATHS} "C:/Program Files/PostgreSQL/${suffix}" )
endforeach(suffix)
endif( WIN32 )
endforeach()
endif()
set( PostgreSQL_ROOT_DIRECTORIES
${PostgreSQL_ROOT_DIRECTORIES}
${PostgreSQL_ROOT}
......@@ -141,11 +141,11 @@ get_filename_component(PostgreSQL_LIBRARY_DIR ${PostgreSQL_LIBRARY} PATH)
set( PostgreSQL_FOUND 0 )
if ( EXISTS "${PostgreSQL_INCLUDE_DIR}" AND EXISTS "${PostgreSQL_LIBRARY_DIR}" )
set( PostgreSQL_FOUND 1 )
else ( EXISTS "${PostgreSQL_INCLUDE_DIR}" AND EXISTS "${PostgreSQL_LIBRARY_DIR}" )
else ()
if ( POSTGRES_REQUIRED )
message( FATAL_ERROR "PostgreSQL is required. ${PostgreSQL_ROOT_DIR_MESSAGE}" )
endif ( POSTGRES_REQUIRED )
endif (EXISTS "${PostgreSQL_INCLUDE_DIR}" AND EXISTS "${PostgreSQL_LIBRARY_DIR}" )
endif ()
endif ()
# Now try to get the include and library path.
if(PostgreSQL_FOUND)
......@@ -154,26 +154,26 @@ if(PostgreSQL_FOUND)
set(PostgreSQL_INCLUDE_DIRS
${PostgreSQL_INCLUDE_DIR}
)