microsoft / vcpkg

C++ Library Manager for Windows, Linux, and MacOS
MIT License
23.17k stars 6.39k forks source link

[plibsys] plibsys_FOUND is not set after find_package(plibsys) #38875

Open PatrickKa opened 5 months ago

PatrickKa commented 5 months ago

Describe the bug

The documentation of find_package() states that it sets <PackageName>_FOUND. However, after I call find_package(plibsys CONFIG REQUIRED) in my CML file, plibsys_FOUND is not set. I am not sure if this bug is directly related to vcpkg, but when I wanted to check the CMake config file in .../vcpkg/installed/x64-windows/share/plibsys I only found vcpkg-cmake-wrapper.cmake which manually sets PLIBSYS_INCLUDE_DIRS and PLIBSYS_LIBRARIES. Therefore, I thought that this wrapper might also be responsible for manually setting plibsys_FOUND.

The way how I discovered this was via find_dependency(plibsys) in a CMake config file of "MyCMakeProject", which throws an error stating that it cannot find plibsys which is very weird because find_package(plibsys CONFIG REQUIRED) does not throw an error and building "MyCMakeProject" works.

Environment

To Reproduce

Steps to reproduce the behavior:

  1. ./vcpkg install plibsys
  2. Create simple example CMake project that calls find_package(plibsys CONFIG REQUIRED) and print the value of plibsys_FOUND afterwards.
  3. Nothing will be printed

Repro code:

cmake_minimum_required(VERSION 3.27)
project(MyCMakeProject VERSION 1.0.0 LANGUAGES CXX)
find_package(plibsys CONFIG REQUIRED)
message("----- plibsys_FOUND = ${plibsys_FOUND}")

Expected behavior

plibsys_FOUND is set to 0 or 1 after the find_package() call

Failure logs

Found package configuration file:
[cmake] 
[cmake]     C:/Program Files (x86)/MyCMakeProject/share/MyCMakeProject/MyCMakeProjectConfig.cmake
[cmake] 
[cmake]   but it set MyCMakeProject_FOUND to FALSE so package "MyCMakeProject" is
[cmake]   considered to be NOT FOUND.  Reason given by package:
[cmake] 
[cmake]   MyCMakeProject could not be found because dependency plibsys could not be
[cmake]   found.

Additional context Add any other context about the problem here.

dg0yt commented 5 months ago

Vcpkg port bug. Instead of a proper CMake config, the port installs an improper vcpkg cmake "wrapper".

For now, you might get away with find_package(PLIBSYS REQUIRED).

PatrickKa commented 5 months ago

Thx for the fast answer.

Yeah, this is what I am using in my package config file for now.