Skip to content

Malformed gz-tools2-all CMake config package installed by gz-tools #166

@traversaro

Description

@traversaro

While working on the conda-forge Jetty update, I noticed that gz-tools2 installs a malformed CMake config file, see for example in apt packages:

traversaro@IITBMP014LW012:~/gzcondaws/gz-tools2-feedstock$ apt list --installed | grep gz-tools2

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

gz-tools2/unknown,now 2.0.3-1~noble amd64 [installed]
libgz-tools2-dev/unknown,now 2.0.3-1~noble amd64 [installed,automatic]
traversaro@IITBMP014LW012:~/gzcondaws/gz-tools2-feedstock$ cat /usr/lib/x86_64-linux-gnu/cmake/gz-tools2-all/gz-tools2-all-config.cmake
# - Config to retrieve all components of the gz-tools2 package
#
# This should only be invoked by gz-tools2-config.cmake.
#
# To retrieve this meta-package, use:
# find_package(gz-tools2 COMPONENTS all)
#
# This creates the target gz-tools2::all which will link to all known
# components of gz-tools2, including the core library.
#
# This also creates the variable gz-tools2_ALL_LIBRARIES
#
################################################################################

cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR)

if(gz-tools2_ALL_CONFIG_INCLUDED)
  return()
endif()
set(gz-tools2_ALL_CONFIG_INCLUDED TRUE)

if(NOT gz-tools2-all_FIND_QUIETLY)
  message(STATUS "Looking for all libraries of gz-tools2 -- found version 2.0.3")
endif()


####### Expanded from @PACKAGE_INIT@ by configure_package_config_file() #######
####### Any changes to this file will be overwritten by the next CMake run ####
####### The input file was gz-all-config.cmake.in                            ########

get_filename_component(PACKAGE_PREFIX_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../../" ABSOLUTE)

# Use original install prefix when loaded through a "/usr move"
# cross-prefix symbolic link such as /lib -> /usr/lib.
get_filename_component(_realCurr "${CMAKE_CURRENT_LIST_DIR}" REALPATH)
get_filename_component(_realOrig "/usr/lib/x86_64-linux-gnu/cmake/gz-tools2-all" REALPATH)
if(_realCurr STREQUAL _realOrig)
  set(PACKAGE_PREFIX_DIR "/usr")
endif()
unset(_realOrig)
unset(_realCurr)

macro(set_and_check _var _file)
  set(${_var} "${_file}")
  if(NOT EXISTS "${_file}")
    message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !")
  endif()
endmacro()

macro(check_required_components _NAME)
  foreach(comp ${${_NAME}_FIND_COMPONENTS})
    if(NOT ${_NAME}_${comp}_FOUND)
      if(${_NAME}_FIND_REQUIRED_${comp})
        set(${_NAME}_FOUND FALSE)
      endif()
    endif()
  endforeach()
endmacro()

####################################################################################

# Get access to the find_dependency utility
include(CMakeFindDependencyMacro)

# Find the core library
find_dependency(gz-tools2 2.0.3 EXACT)

Why it is malformed? As now gz-tools2 CMake config package is installed, the find_dependency(gz-tools2 2.0.3 EXACT) call will always fail. Probably it could make sense to avoid to install any CMake config package at all.

Environment

  • OS Version: Ubuntu 24.04
  • Source or binary build?
    Binary 2.0.3

Description

  • Expected behavior:
  • Actual behavior:

Steps to reproduce

Check the installed files.

Output

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    Inbox

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions