diff options
| -rw-r--r-- | modules/FindLibAttica.cmake | 10 | ||||
| -rw-r--r-- | modules/FindQt4.cmake | 57 | ||||
| -rw-r--r-- | modules/HandleImportedTargetsInCMakeRequiredLibraries.cmake | 16 | ||||
| -rw-r--r-- | modules/MacroOptionalFindPackage.cmake | 32 | 
4 files changed, 48 insertions, 67 deletions
| diff --git a/modules/FindLibAttica.cmake b/modules/FindLibAttica.cmake index b9b0610a..f901075a 100644 --- a/modules/FindLibAttica.cmake +++ b/modules/FindLibAttica.cmake @@ -14,6 +14,11 @@ IF (NOT LIBATTICA_MIN_VERSION)    SET(LIBATTICA_MIN_VERSION "0.1.0")  ENDIF(NOT LIBATTICA_MIN_VERSION) +IF (LIBATTICA_INCLUDE_DIR AND LIBATTICA_LIBRARIES) +   # in cache already +   SET(libattica_FIND_QUIETLY TRUE) +ENDIF (LIBATTICA_INCLUDE_DIR AND LIBATTICA_LIBRARIES) +  IF (NOT WIN32)     # use pkg-config to get the directories and then use these values     # in the FIND_PATH() and FIND_LIBRARY() calls @@ -54,9 +59,10 @@ FIND_LIBRARY(LIBATTICA_LIBRARIES NAMES attica libattica     )  INCLUDE(FindPackageHandleStandardArgs) -# handle the QUIETLY and REQUIRED arguments and set LIBATTICA_FOUND to TRUE if +# handle the QUIETLY and REQUIRED arguments and set ATTICA_FOUND to TRUE if  # all listed variables are TRUE -FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibAttica  DEFAULT_MSG  LIBATTICA_LIBRARIES LIBATTICA_INCLUDE_DIR LIBATTICA_VERSION_OK) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(libattica DEFAULT_MSG LIBATTICA_LIBRARIES LIBATTICA_INCLUDE_DIR LIBATTICA_VERSION_OK)  MARK_AS_ADVANCED(LIBATTICA_INCLUDE_DIR LIBATTICA_LIBRARIES) + diff --git a/modules/FindQt4.cmake b/modules/FindQt4.cmake index 941e2e40..864828f8 100644 --- a/modules/FindQt4.cmake +++ b/modules/FindQt4.cmake @@ -892,35 +892,38 @@ IF (QT4_QMAKE_FOUND)    ############################################    MACRO (_QT4_ADJUST_LIB_VARS basename) -#    message(STATUS "Adjusting ${basename}, release: -${QT_${basename}_LIBRARY_RELEASE}- debug: -${QT_${basename}_LIBRARY_DEBUG}-")      IF (QT_${basename}_LIBRARY_RELEASE OR QT_${basename}_LIBRARY_DEBUG) -      ADD_LIBRARY(Qt4__${basename} SHARED IMPORTED ) -      IF(WIN32) -        SET(_QT4_LIBRARY_PROPERTY_NAME IMPLIB) -      ELSE(WIN32) -        SET(_QT4_LIBRARY_PROPERTY_NAME LOCATION) -      ENDIF(WIN32) - - -      IF (QT_${basename}_LIBRARY_RELEASE) -        SET_PROPERTY(TARGET Qt4__${basename} APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) -        SET_PROPERTY(TARGET Qt4__${basename}        PROPERTY IMPORTED_${_QT4_LIBRARY_PROPERTY_NAME}_RELEASE "${QT_${basename}_LIBRARY_RELEASE}" ) -#        message(STATUS "Setting IMPORTED_LOCATION_RELEASE to -${QT_${basename}_LIBRARY_RELEASE}-") -      ENDIF (QT_${basename}_LIBRARY_RELEASE) - -      IF (QT_${basename}_LIBRARY_DEBUG) -        SET_PROPERTY(TARGET Qt4__${basename} APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG) -        SET_PROPERTY(TARGET Qt4__${basename}        PROPERTY IMPORTED_${_QT4_LIBRARY_PROPERTY_NAME}_DEBUG "${QT_${basename}_LIBRARY_DEBUG}" ) - -#       message(STATUS "Setting IMPORTED_LOCATION_DEBUG to -${QT_${basename}_LIBRARY_DEBUG}-") - -        SET_PROPERTY(TARGET Qt4__${basename} PROPERTY MAP_IMPORTED_CONFIG_PROFILE DEBUG) -        SET_PROPERTY(TARGET Qt4__${basename} PROPERTY MAP_IMPORTED_CONFIG_DEBUGFULL DEBUG) -      ENDIF (QT_${basename}_LIBRARY_DEBUG) - -      SET(QT_${basename}_LIBRARY       Qt4__${basename} ) -      SET(QT_${basename}_LIBRARIES     Qt4__${basename} ) +      # if the release- as well as the debug-version of the library have been found: +      IF (QT_${basename}_LIBRARY_DEBUG AND QT_${basename}_LIBRARY_RELEASE) +        # if the generator supports configuration types then set +        # optimized and debug libraries, or if the CMAKE_BUILD_TYPE has a value +        IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) +          SET(QT_${basename}_LIBRARY       optimized ${QT_${basename}_LIBRARY_RELEASE} debug ${QT_${basename}_LIBRARY_DEBUG}) +        ELSE(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) +          # if there are no configuration types and CMAKE_BUILD_TYPE has no value +          # then just use the release libraries +          SET(QT_${basename}_LIBRARY       ${QT_${basename}_LIBRARY_RELEASE} ) +        ENDIF(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) +        SET(QT_${basename}_LIBRARIES       optimized ${QT_${basename}_LIBRARY_RELEASE} debug ${QT_${basename}_LIBRARY_DEBUG}) +      ENDIF (QT_${basename}_LIBRARY_DEBUG AND QT_${basename}_LIBRARY_RELEASE) + +      # if only the release version was found, set the debug variable also to the release version +      IF (QT_${basename}_LIBRARY_RELEASE AND NOT QT_${basename}_LIBRARY_DEBUG) +        SET(QT_${basename}_LIBRARY_DEBUG ${QT_${basename}_LIBRARY_RELEASE}) +        SET(QT_${basename}_LIBRARY       ${QT_${basename}_LIBRARY_RELEASE}) +        SET(QT_${basename}_LIBRARIES     ${QT_${basename}_LIBRARY_RELEASE}) +      ENDIF (QT_${basename}_LIBRARY_RELEASE AND NOT QT_${basename}_LIBRARY_DEBUG) + +      # if only the debug version was found, set the release variable also to the debug version +      IF (QT_${basename}_LIBRARY_DEBUG AND NOT QT_${basename}_LIBRARY_RELEASE) +        SET(QT_${basename}_LIBRARY_RELEASE ${QT_${basename}_LIBRARY_DEBUG}) +        SET(QT_${basename}_LIBRARY         ${QT_${basename}_LIBRARY_DEBUG}) +        SET(QT_${basename}_LIBRARIES       ${QT_${basename}_LIBRARY_DEBUG}) +      ENDIF (QT_${basename}_LIBRARY_DEBUG AND NOT QT_${basename}_LIBRARY_RELEASE) + +      # put the value in the cache: +      SET(QT_${basename}_LIBRARY ${QT_${basename}_LIBRARY} CACHE STRING "The Qt ${basename} library" FORCE)        IF (QT_${basename}_LIBRARY)          SET(QT_${basename}_FOUND 1) diff --git a/modules/HandleImportedTargetsInCMakeRequiredLibraries.cmake b/modules/HandleImportedTargetsInCMakeRequiredLibraries.cmake index e28efd44..28564ab6 100644 --- a/modules/HandleImportedTargetsInCMakeRequiredLibraries.cmake +++ b/modules/HandleImportedTargetsInCMakeRequiredLibraries.cmake @@ -44,23 +44,15 @@ FUNCTION(HANDLE_IMPORTED_TARGETS_IN_CMAKE_REQUIRED_LIBRARIES _RESULT)              ENDIF ("${_CCSR_LOOP_COUNTER}" LESS 100)              LIST(GET _importedConfigs 0 _firstImportedConfig) -            IF(NOT WIN32) -               GET_TARGET_PROPERTY(_firstImportedLocation ${_CURRENT_LIB} IMPORTED_LOCATION_${_firstImportedConfig}) -            ELSE(NOT WIN32) -               GET_TARGET_PROPERTY(_firstImportedLocation ${_CURRENT_LIB} IMPORTED_IMPLIB_${_firstImportedConfig}) -            ENDIF(NOT WIN32) +            GET_TARGET_PROPERTY(_firstImportedLocation ${_CURRENT_LIB} LOCATION_${_firstImportedConfig})              GET_TARGET_PROPERTY(_linkInterfaceLibs ${_CURRENT_LIB} IMPORTED_LINK_INTERFACE_LIBRARIES_${_firstImportedConfig} )              LIST(APPEND _CCSR_NEW_REQ_LIBS  ${_firstImportedLocation})  #                MESSAGE(STATUS "Appending lib ${_CURRENT_LIB} as ${_firstImportedLocation}") -            IF(_linkInterfaceLibs) -               FOREACH(_currentLinkInterfaceLib ${_linkInterfaceLibs}) +            FOREACH(_currentLinkInterfaceLib ${_linkInterfaceLibs})  #                   MESSAGE(STATUS "Appending link interface lib ${_currentLinkInterfaceLib}") -                  IF(_currentLinkInterfaceLib) -                     LIST(APPEND _CCSR_NEW_REQ_LIBS ${_currentLinkInterfaceLib} ) -                  ENDIF(_currentLinkInterfaceLib)  -               ENDFOREACH(_currentLinkInterfaceLib ${_linkInterfaceLibs}) -            ENDIF(_linkInterfaceLibs) +               LIST(APPEND _CCSR_NEW_REQ_LIBS ${_currentLinkInterfaceLib} ) +            ENDFOREACH(_currentLinkInterfaceLib ${_linkInterfaceLibs})           ELSE(_importedConfigs)              # "Normal" libraries are just used as they are.              LIST(APPEND _CCSR_NEW_REQ_LIBS ${_CURRENT_LIB} ) diff --git a/modules/MacroOptionalFindPackage.cmake b/modules/MacroOptionalFindPackage.cmake index d4ed48e3..f09952f3 100644 --- a/modules/MacroOptionalFindPackage.cmake +++ b/modules/MacroOptionalFindPackage.cmake @@ -7,42 +7,22 @@  # The standard <name>_FOUND variables can be used in the same way  # as when using the normal FIND_PACKAGE() -# Copyright (c) 2006-2010 Alexander Neundorf, <neundorf@kde.org> +# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>  #  # Redistribution and use is allowed according to the terms of the BSD license.  # For details see the accompanying COPYING-CMAKE-SCRIPTS file. -# This is just a helper macro to set a bunch of variables empty. -# We don't know whether the package uses UPPERCASENAME or CamelCaseName, so we try both: -macro(_MOFP_SET_EMPTY_IF_DEFINED _name _var) -   if(DEFINED ${_name}_${_var}) -      set(${_name}_${_var} "") -   endif(DEFINED ${_name}_${_var}) - -   string(TOUPPER ${_name} _nameUpper) -   if(DEFINED ${_nameUpper}_${_var}) -      set(${_nameUpper}_${_var}  "") -   endif(DEFINED ${_nameUpper}_${_var}) -endmacro(_MOFP_SET_EMPTY_IF_DEFINED _package _var) -  macro (MACRO_OPTIONAL_FIND_PACKAGE _name )     option(WITH_${_name} "Search for ${_name} package" ON)     if (WITH_${_name})        find_package(${_name} ${ARGN})     else (WITH_${_name}) -      string(TOUPPER ${_name} _nameUpper) -      set(${_name}_FOUND FALSE) -      set(${_nameUpper}_FOUND FALSE) - -      _mofp_set_empty_if_defined(${_name} INCLUDE_DIRS) -      _mofp_set_empty_if_defined(${_name} INCLUDE_DIR) -      _mofp_set_empty_if_defined(${_name} INCLUDES) -      _mofp_set_empty_if_defined(${_name} LIBRARY) -      _mofp_set_empty_if_defined(${_name} LIBRARIES) -      _mofp_set_empty_if_defined(${_name} LIBS) -      _mofp_set_empty_if_defined(${_name} FLAGS) -      _mofp_set_empty_if_defined(${_name} DEFINITIONS) +      set(${_name}_FOUND) +      set(${_name}_INCLUDE_DIR) +      set(${_name}_INCLUDES) +      set(${_name}_LIBRARY) +      set(${_name}_LIBRARIES)     endif (WITH_${_name})  endmacro (MACRO_OPTIONAL_FIND_PACKAGE) | 
