View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0014781CMakeCMakepublic2014-03-01 03:162014-10-06 10:32
ReporterRuslan Baratov 
Assigned ToBrad King 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSWindowsOS Version
Product Version 
Target VersionFixed in Version 
Summary0014781: Document that find_package searches cmake-gui locations only on Windows
DescriptionOn windows find_package command detect FooConfig.cmake file inside temporary build
directory instead of CMAKE_INSTALL_PREFIX path.
Steps To Reproduce1) build Foo in '_build/Foo' directory
2) install Foo with '_install' prefix
3) build Boo in '_build/Boo' directory

Projects layout:
- Foo/CMakeLists.txt
- Boo/CMakeLists.txt
- _builds/Foo/FooConfig.cmake # temp config build
- _builds/Boo
- _install/lib/cmake/Foo/FooConfig.cmake # real config

Output:
  CMake Error at /.../_builds/Foo/FooConfig.cmake:30 (include):
  include could not find load file: /.../lib/cmake/Foo/FooTargets.cmake
Additional InformationWorks fine:
* if remove '_build/Foo' directory after Foo install
* on Mac OS X

CMake version 3.0.0-rc1

Example available here:
* https://github.com/forexample/package-example [^]
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0035225)
Brad King (manager)
2014-03-03 08:38

The find_package command documentation:

 http://www.cmake.org/cmake/help/v3.0/command/find_package.html [^]

enumerates the sequence of search locations and options to disable them. Build directories are considered in some of the steps.

If your FooConfig.cmake in the build tree is not suitable for being found (perhaps because it is there only to later be installed) then it should be tucked away at a path within the build tree that the command does not search.
(0035232)
Ruslan Baratov (reporter)
2014-03-03 09:37

Okay, sorry, I missed that (just thinking that it's current project build directory, i.e. _builds/Boo).

But in this case why Mac OS X acts differently?
(0035234)
Brad King (manager)
2014-03-03 10:29

Re 0014781:0035232: If you used cmake-gui to create the build tree on Windows but not on OS X then the corresponding step in find_package may behave differently. Otherwise you'll have to carefully consider how each documented step would work on each of the two systems to see where the difference lies.
(0035241)
Ruslan Baratov (reporter)
2014-03-03 14:19

> Re 0014781:0035232: If you used cmake-gui to create the build tree on Windows
> but not on OS X then the corresponding step in find_package may behave
> differently. Otherwise you'll have to carefully consider how each documented
> step would work on each of the two systems to see where the difference lies.

In both cases cmake-gui used. Steps to reproduce:

01. open cmake-gui
02. cmake-gui: set source directory to Foo
03. cmake-gui: set build directory to _builds/Foo
04. cmake-gui: run configure (generator = Xcode)
05. cmake-gui: run generate
06. open _builds/Foo/Foo.xcodeproj in Xcode
07. xcode: build target ALL (file _builds/Foo/FooConfig.cmake created)
08. cmake-gui: set source directory to Boo
09. cmake-gui: set build directory to _builds/Boo
10. cmake-gui: run configure (generator = Xcode)

Error occurs:

  Could not find a package configuration file provided by "Foo" with any of
  the following names:

    FooConfig.cmake
    foo-config.cmake

Expected that FooConfig.cmake will be found in _builds/Foo directory.

According to find_package (5) documentation:

  Search project build trees recently configured in a cmake-gui(1). This can be
  skipped if NO_CMAKE_BUILDS_PATH is passed. It is intended for the case when a
  user is building multiple dependent projects one after another.

Suboption NO_CMAKE_BUILDS_PATH is not set. If I understand correctly
"recently configured project" is Foo.

Works fine on windows using Visual Studio generator.

Note that I've update example on github that I mention earlier (I've add
NO_CMAKE_BUILDS_PATH). So if you want to reproduce all steps you need to
remove NO_CMAKE_BUILDS_PATH from Boo/CMakeLists.txt.
(0035242)
Brad King (manager)
2014-03-03 14:41

Oops, I forgot that the cmake-gui search locations are used only on Windows. I've updated the documentation:

 Help: Mention in find_package that cmake-gui step is Windows-only (0014781)
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=69d73d27 [^]
(0035243)
Ruslan Baratov (reporter)
2014-03-03 14:57

Cool, thank you!
(0036929)
Robert Maynard (manager)
2014-10-06 10:32

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2014-03-01 03:16 Ruslan Baratov New Issue
2014-03-03 08:38 Brad King Note Added: 0035225
2014-03-03 09:37 Ruslan Baratov Note Added: 0035232
2014-03-03 10:29 Brad King Note Added: 0035234
2014-03-03 10:29 Brad King Status new => resolved
2014-03-03 10:29 Brad King Resolution open => no change required
2014-03-03 14:19 Ruslan Baratov Note Added: 0035241
2014-03-03 14:19 Ruslan Baratov Status resolved => feedback
2014-03-03 14:19 Ruslan Baratov Resolution no change required => reopened
2014-03-03 14:41 Brad King Note Added: 0035242
2014-03-03 14:41 Brad King Assigned To => Brad King
2014-03-03 14:41 Brad King Status feedback => assigned
2014-03-03 14:41 Brad King Resolution reopened => fixed
2014-03-03 14:41 Brad King Summary find_package don't respect variable CMAKE_INSTALL_PREFIX properly => Document that find_package searches cmake-gui locations only on Windows
2014-03-03 14:57 Ruslan Baratov Note Added: 0035243
2014-03-03 15:02 Brad King Status assigned => resolved
2014-10-06 10:32 Robert Maynard Note Added: 0036929
2014-10-06 10:32 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team