diff options
author | Daniele E. Domenichelli <ddomenichelli@drdanz.it> | 2017-01-25 09:05:28 (GMT) |
---|---|---|
committer | Daniele E. Domenichelli <ddomenichelli@drdanz.it> | 2017-01-25 09:20:30 (GMT) |
commit | 9702b3eefd2baccd24eea9779e17da8fc143fa4c (patch) | |
tree | 572ce49fc1de346e796c74a98a58fb8747d0696b /Modules/FindGTK2.cmake | |
parent | a007f15344007a6261209a409c6988b0e4c4b7e0 (diff) | |
download | CMake-9702b3eefd2baccd24eea9779e17da8fc143fa4c.zip CMake-9702b3eefd2baccd24eea9779e17da8fc143fa4c.tar.gz CMake-9702b3eefd2baccd24eea9779e17da8fc143fa4c.tar.bz2 |
FindGTK2: Fix GTK2_LIBRARIES and GTK2_TARGETS when called twice
Closes: #16582
Diffstat (limited to 'Modules/FindGTK2.cmake')
-rw-r--r-- | Modules/FindGTK2.cmake | 82 |
1 files changed, 40 insertions, 42 deletions
diff --git a/Modules/FindGTK2.cmake b/Modules/FindGTK2.cmake index e1b22b6..6747be5 100644 --- a/Modules/FindGTK2.cmake +++ b/Modules/FindGTK2.cmake @@ -529,52 +529,54 @@ function(_GTK2_ADD_TARGET _var) cmake_parse_arguments(_${_var} "" "" "GTK2_DEPENDS;GTK2_OPTIONAL_DEPENDS;OPTIONAL_INCLUDES" ${ARGN}) - if(GTK2_${_var}_FOUND AND NOT TARGET GTK2::${_basename}) - # Do not create the target if dependencies are missing - foreach(_dep ${_${_var}_GTK2_DEPENDS}) - if(NOT TARGET GTK2::${_dep}) - return() - endif() - endforeach() + if(GTK2_${_var}_FOUND) + if(NOT TARGET GTK2::${_basename}) + # Do not create the target if dependencies are missing + foreach(_dep ${_${_var}_GTK2_DEPENDS}) + if(NOT TARGET GTK2::${_dep}) + return() + endif() + endforeach() - add_library(GTK2::${_basename} UNKNOWN IMPORTED) + add_library(GTK2::${_basename} UNKNOWN IMPORTED) - set(GTK2_TARGETS ${GTK2_TARGETS} GTK2::${_basename}) - set(GTK2_TARGETS ${GTK2_TARGETS} PARENT_SCOPE) + if(GTK2_${_var}_LIBRARY_RELEASE) + set_property(TARGET GTK2::${_basename} APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) + set_property(TARGET GTK2::${_basename} PROPERTY IMPORTED_LOCATION_RELEASE "${GTK2_${_var}_LIBRARY_RELEASE}" ) + endif() - if(GTK2_${_var}_LIBRARY_RELEASE) - set_property(TARGET GTK2::${_basename} APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) - set_property(TARGET GTK2::${_basename} PROPERTY IMPORTED_LOCATION_RELEASE "${GTK2_${_var}_LIBRARY_RELEASE}" ) - endif() + if(GTK2_${_var}_LIBRARY_DEBUG) + set_property(TARGET GTK2::${_basename} APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG) + set_property(TARGET GTK2::${_basename} PROPERTY IMPORTED_LOCATION_DEBUG "${GTK2_${_var}_LIBRARY_DEBUG}" ) + endif() - if(GTK2_${_var}_LIBRARY_DEBUG) - set_property(TARGET GTK2::${_basename} APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG) - set_property(TARGET GTK2::${_basename} PROPERTY IMPORTED_LOCATION_DEBUG "${GTK2_${_var}_LIBRARY_DEBUG}" ) - endif() + if(GTK2_${_var}_INCLUDE_DIR) + set_property(TARGET GTK2::${_basename} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${GTK2_${_var}_INCLUDE_DIR}") + endif() - if(GTK2_${_var}_INCLUDE_DIR) - set_property(TARGET GTK2::${_basename} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${GTK2_${_var}_INCLUDE_DIR}") - endif() + if(GTK2_${_var}CONFIG_INCLUDE_DIR AND NOT "x${GTK2_${_var}CONFIG_INCLUDE_DIR}" STREQUAL "x${GTK2_${_var}_INCLUDE_DIR}") + set_property(TARGET GTK2::${_basename} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${GTK2_${_var}CONFIG_INCLUDE_DIR}") + endif() - if(GTK2_${_var}CONFIG_INCLUDE_DIR AND NOT "x${GTK2_${_var}CONFIG_INCLUDE_DIR}" STREQUAL "x${GTK2_${_var}_INCLUDE_DIR}") - set_property(TARGET GTK2::${_basename} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${GTK2_${_var}CONFIG_INCLUDE_DIR}") - endif() + if(GTK2_DEFINITIONS) + set_property(TARGET GTK2::${_basename} PROPERTY INTERFACE_COMPILE_DEFINITIONS "${GTK2_DEFINITIONS}") + endif() - if(GTK2_DEFINITIONS) - set_property(TARGET GTK2::${_basename} PROPERTY INTERFACE_COMPILE_DEFINITIONS "${GTK2_DEFINITIONS}") - endif() + if(_${_var}_GTK2_DEPENDS) + _GTK2_ADD_TARGET_DEPENDS(${_var} ${_${_var}_GTK2_DEPENDS} ${_${_var}_GTK2_OPTIONAL_DEPENDS}) + endif() - if(_${_var}_GTK2_DEPENDS) - _GTK2_ADD_TARGET_DEPENDS(${_var} ${_${_var}_GTK2_DEPENDS} ${_${_var}_GTK2_OPTIONAL_DEPENDS}) + if(_${_var}_OPTIONAL_INCLUDES) + foreach(_D ${_${_var}_OPTIONAL_INCLUDES}) + if(_D) + _GTK2_ADD_TARGET_INCLUDE_DIRS(${_var} ${_D}) + endif() + endforeach() + endif() endif() - if(_${_var}_OPTIONAL_INCLUDES) - foreach(_D ${_${_var}_OPTIONAL_INCLUDES}) - if(_D) - _GTK2_ADD_TARGET_INCLUDE_DIRS(${_var} ${_D}) - endif() - endforeach() - endif() + set(GTK2_TARGETS ${GTK2_TARGETS} GTK2::${_basename}) + set(GTK2_TARGETS ${GTK2_TARGETS} PARENT_SCOPE) if(GTK2_USE_IMPORTED_TARGETS) set(GTK2_${_var}_LIBRARY GTK2::${_basename} PARENT_SCOPE) @@ -735,9 +737,7 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) if(APPLE) _GTK2_FIND_LIBRARY (GDK gdk-quartz false true) endif() - if(NOT GTK2_GDK_FOUND) - _GTK2_FIND_LIBRARY (GDK gdk-x11 false true) - endif() + _GTK2_FIND_LIBRARY (GDK gdk-x11 false true) else() _GTK2_FIND_LIBRARY (GDK gdk-win32 false true) endif() @@ -749,9 +749,7 @@ foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) if(APPLE) _GTK2_FIND_LIBRARY (GTK gtk-quartz false true) endif() - if(NOT GTK2_GTK_FOUND) - _GTK2_FIND_LIBRARY (GTK gtk-x11 false true) - endif() + _GTK2_FIND_LIBRARY (GTK gtk-x11 false true) else() _GTK2_FIND_LIBRARY (GTK gtk-win32 false true) endif() |