Bug 1020508 - mingw[32/64] cmake toolchain files should include SET(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
mingw[32/64] cmake toolchain files should include SET(CMAKE_FIND_ROOT_PATH_MO...
Status: CLOSED EOL
Product: Fedora
Classification: Fedora
Component: mingw-filesystem (Show other bugs)
20
x86_64 Linux
unspecified Severity medium
: ---
: ---
Assigned To: Erik van Pienbroek
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-10-17 15:33 EDT by Patrick Noffke
Modified: 2015-06-29 08:39 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-06-29 08:39:33 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Test case (106.50 KB, application/gzip)
2013-10-17 15:33 EDT, Patrick Noffke
no flags Details

  None (edit)
Description Patrick Noffke 2013-10-17 15:33:26 EDT
Created attachment 813529 [details]
Test case

Description of problem:
This is a problem that occurs when using "config mode" for find_package in a cmake project.  If CMAKE_FIND_ROOT_PATH_MODE_PACKAGE is not set to ONLY, then find_package will search outside the mingw sys-root for a <package>Config.cmake file.

This occurred on my system that did not have the Qt5Svg package in mingw, but it did exist in my home directory (part of the Qt SDK installation).  Then when I tried to find_package(Qt5Svg), cmake found the package in my home directory (when none should have been found since it doesn't exist in mingw).

Qt5 uses "config mode" for finding the various components.  Note that setting CMAKE_FIND_ROOT_PATH_MODE_LIBRARY and CMAKE_FIND_ROOT_PATH_MODE_INCLUDE are not sufficient in this case, since the Qt5SvgConfig.cmake file does not use find_file or find_library.

The attached test case simulates this problem by using find_package in config mode.  The package is called "HostOnlyPackage", which will not exist in mingw.  So the expected result is that the package should not be found, and a cmake error message is generated if the package is found.

Version-Release number of selected component (if applicable):
mingw32-filesystem-97-1.fc18.noarch

How reproducible:
Every time.

Steps to Reproduce:
1.  Run find-package-test.sh in the attached tarball.

Actual results:
[snip]
HostOnlyPackage include dirs = /home/pnoffke/tmp/mingw-cmake/mingw-cmake-find-package
-- Found HostOnlyPackage: /home/pnoffke/tmp/mingw-cmake/mingw-cmake-find-package  
CMake Error at CMakeLists.txt:10 (MESSAGE):
  Found HostOnlyPackage in mingw environment.

Expected results:
[snip]
CMake Warning at CMakeLists.txt:7 (find_package):
  Could not find a package configuration file provided by "HostOnlyPackage"
  with any of the following names:

    HostOnlyPackageConfig.cmake
    hostonlypackage-config.cmake

  Add the installation prefix of "HostOnlyPackage" to CMAKE_PREFIX_PATH or
  set "HostOnlyPackage_DIR" to a directory containing one of the above files.
  If "HostOnlyPackage" provides a separate development package or SDK, be
  sure it has been installed.


Didn't find HostOnlyPackage -- this is good!

[snip -- successful compilation of hello]

Additional info:
Add the following line to each of /usr/share/mingw/Toolchain-mingw32.cmake and /usr/share/mingw/Toolchain-mingw64.cmake fixes the problem:

SET(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
Comment 1 Fedora End Of Life 2013-12-21 09:41:02 EST
This message is a reminder that Fedora 18 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 18. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '18'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 18's end of life.

Thank you for reporting this issue and we are sorry that we may not be 
able to fix it before Fedora 18 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior to Fedora 18's end of life.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.
Comment 2 Fedora End Of Life 2015-01-09 15:17:08 EST
This message is a notice that Fedora 19 is now at end of life. Fedora 
has stopped maintaining and issuing updates for Fedora 19. It is 
Fedora's policy to close all bug reports from releases that are no 
longer maintained. Approximately 4 (four) weeks from now this bug will
be closed as EOL if it remains open with a Fedora 'version' of '19'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 19 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.
Comment 3 Fedora End Of Life 2015-05-29 05:35:25 EDT
This message is a reminder that Fedora 20 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 20. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '20'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 20 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.
Comment 4 Fedora End Of Life 2015-06-29 08:39:33 EDT
Fedora 20 changed to end-of-life (EOL) status on 2015-06-23. Fedora 20 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.

Note You need to log in before you can comment on or make changes to this bug.