View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0014849CMakeCMakepublic2014-03-28 12:342014-12-13 11:34
ReporterDmitry Marakasov 
Assigned ToDaniele E. Domenichelli 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionfixed 
Platformamd64OSFreeBSDOS Version10.0
Product VersionCMake 2.8.12.1 
Target VersionCMake 3.1Fixed in VersionCMake 3.1 
Summary0014849: Need a way to disable CMake package registry
DescriptionAs I understand, EXPORT(PACKAGE) command is used to make projects easily access specific project's build directory. That, however, gets in a way of systemwide package installation handling.

For example, FreeBSD ports tree: we have a port of software which has EXPORT(PACKAGE). The first problem: it touches directory outside build tree on build phase (creating a file under /root/.cmake/packages), which ports are not allowed and it considered a fatal error. Next, this file points to build directory, which is temporary and will be removed after build, thus cmake package file will point to nonexisting directory. Last, it won't be accessible for other users since it's in root's home anyway.

EXPORT(PACKAGE) can be patched away from software's CMakeLists, but patching is least desirable. It would be nice to have a way to disable using package registry, as it's useless in packaging environement anyway.
TagsNo tags attached.
Attached Files

 Relationships
has duplicate 0015303closed Turning off package registry 

  Notes
(0035555)
Stephen Kelly (developer)
2014-03-28 12:36

I wonder if this can be done automatically if the CMAKE_INSTALL_PREFIX is "/usr(/lib)?".
(0035556)
Dmitry Marakasov (reporter)
2014-03-28 13:20

It can't. People who need this feature may need it disregard of prefix. And people who don't need it may use any prefix either - for FreeBSD default one is /usr/local, but that's customizable so it may be arbitrary.
(0035557)
Daniele E. Domenichelli (developer)
2014-03-28 14:00

I had the same issue some time ago, I solved id by adding NO_CMAKE_PACKAGE_REGISTRY everywhere, but that's not a good solution.

It is definitely not desirable in packaging, but also in other situations (shared home directory)

I'd like to have an environment variable (CMAKE_DISABLE_PACKAGE_REGISTRY?) that

1) Forbids cmake to export the package when EXPORT(PACKAGE) is called
2) changes the behaviour of find_package to always force NO_CMAKE_PACKAGE_REGISTRY
(0035564)
Brad King (manager)
2014-03-31 09:01

There are two sides for this: the exporting side and the importing side. NO_CMAKE_PACKAGE_REGISTRY deals with the latter, and a new CMAKE_FIND_NO_PACKAGE_REGISTRY variable could be created to disable it everywhere. However, when a packager builds a project it is the exporting side that needs to be disabled. Perhaps we need a CMAKE_EXPORT_NO_PACKAGE_REGISTRY variable that could be set by packagers on the command line to disable the export(PACKAGE) command.
(0035572)
Dmitry Marakasov (reporter)
2014-03-31 10:05

> and a new CMAKE_FIND_NO_PACKAGE_REGISTRY variable could be created to disable it everywhere

> CMAKE_EXPORT_NO_PACKAGE_REGISTRY variable that could be set by packagers on the command line to disable the export(PACKAGE) command

Yes, that would be great
(0035577)
Daniele E. Domenichelli (developer)
2014-03-31 11:03
edited on: 2014-03-31 11:04

Having a way to disable both would be very useful in a superbuild.

I have a superbuild that calls "find_package(X NO_CMAKE_PACKAGE_REGISTRY)" and then builds a 3rd party package using ExternalProject that just calls "find_package(X)"

Being able to disable the package registry from the superbuild would be really nice, in order to ensure that the 2 find_package()s return the same result.

(0035578)
Brad King (manager)
2014-03-31 11:20

Re 0014849:0035577: With the proposed feature, the superbuild's ExternalProject_Add call should be able to add -DCMAKE_FIND_NO_PACKAGE_REGISTRY=1 to the CMAKE_ARGS option. Meanwhile you should be able to pass -DX_DIR=${X_DIR} to tell the project where to find the package without searching.

Daniele, would you please look at implementing these variables and tests for them?
(0035616)
Daniele E. Domenichelli (developer)
2014-04-02 05:59

Re 0014849:0035578: Sure, but I'll need some hint because I don't have much experience with cmake c++ source code ;)

About the CMAKE_EXPORT_NO_PACKAGE_REGISTRY, does this look ok? (in cmExportCommand::HandlePackage)

if(cmSystemTools::IsOn(this->Makefile->GetDefinition("CMAKE_EXPORT_NO_PACKAGE_REGISTRY"))
    {
    return true;
    }
(0035617)
Daniele E. Domenichelli (developer)
2014-04-02 06:09

Should CMAKE_FIND_NO_PACKAGE_REGISTRY disable the _system_ registry as well or just the _user_ one?
(0035622)
Brad King (manager)
2014-04-02 10:56

Thanks, Daniele.

Re 0014849:0035616: That code can be simpler:

 if(this->Makefile->IsOn("CMAKE_EXPORT_NO_PACKAGE_REGISTRY"))

Re 0014849:0035617: Let's use separate CMAKE_FIND_NO_PACKAGE_REGISTRY and CMAKE_FIND_NO_SYSTEM_PACKAGE_REGISTRY variables just like the find_package command options are separate.

Please also update relevant documentation and add tests if possible.
(0035623)
Daniele E. Domenichelli (developer)
2014-04-02 11:18

Re 0014849:0035622: Thanks. I was going to use cmMakefile::IsOn, but reading the documentation I couldn't understand one thing: cmMakefile::IsOn documentation in "cmMakefile.h" says "Test a boolean cache entry". Makefile::GetDefinition says "If the variable is not found in this makefile instance, the cache is then queried." Does this mean that using IsOn I get the cache value and using GetDefinition I get the variable and if not found I get the cache?

Actually after your comment I checked the actual code, and I found that IsOn calls GetDefinition internally, so perhaps the documentation can be slightly improved...
(0035625)
Daniele E. Domenichelli (developer)
2014-04-02 13:50

@Brad perhaps instead of CMAKE_FIND_NO_PACKAGE_REGISTRY the name should be CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY?
(0035626)
Brad King (manager)
2014-04-02 14:17

Re 0014849:0035623: Yes, the cmMakefile::IsOn comment should be corrected.

Re 0014849:0035625: Your proposed name is fine with me, thanks.
(0035630)
Daniele E. Domenichelli (developer)
2014-04-03 05:36

Re 0014849:0035626: I merged to next a small change to the documentation:
http://cmake.org/gitweb?p=stage/cmake.git;a=commitdiff;h=841f432e965db72b22d72ff8c49b41d8318a4795 [^]

About this bug, I have a patch, but I still have to write the documentation and the tests, I will do it as soon as possible
(0035831)
Daniele E. Domenichelli (developer)
2014-05-07 05:24
edited on: 2014-05-07 05:25

Sorry for the delay... I just pushed a bug_0014849 topic to stage:

http://cmake.org/gitweb?p=stage/cmake.git;a=commitdiff;h=66731453dec57c08a02e3cd74cfadcc45c995739 [^]

@Brad Can you please review it?

---
edit: Fixed link to the latest version

(0035835)
Brad King (manager)
2014-05-07 08:52

Re 0014849:0035831: Yes, that looks good. Thanks!
(0035850)
Brad King (manager)
2014-05-12 09:50

Re 0014849:0035831: The FindPackageTest needed a couple of fixes. I made them in other commits and rebased the main change:

 Allow the Package Registry to be disabled
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=be8ae960 [^]
(0037135)
Robert Maynard (manager)
2014-11-03 08:38

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

 Issue History
Date Modified Username Field Change
2014-03-28 12:34 Dmitry Marakasov New Issue
2014-03-28 12:36 Stephen Kelly Note Added: 0035555
2014-03-28 13:20 Dmitry Marakasov Note Added: 0035556
2014-03-28 14:00 Daniele E. Domenichelli Note Added: 0035557
2014-03-31 09:01 Brad King Note Added: 0035564
2014-03-31 10:05 Dmitry Marakasov Note Added: 0035572
2014-03-31 11:03 Daniele E. Domenichelli Note Added: 0035577
2014-03-31 11:04 Daniele E. Domenichelli Note Edited: 0035577
2014-03-31 11:20 Brad King Note Added: 0035578
2014-04-02 05:59 Daniele E. Domenichelli Note Added: 0035616
2014-04-02 06:09 Daniele E. Domenichelli Note Added: 0035617
2014-04-02 10:56 Brad King Note Added: 0035622
2014-04-02 11:18 Daniele E. Domenichelli Note Added: 0035623
2014-04-02 13:50 Daniele E. Domenichelli Note Added: 0035625
2014-04-02 14:17 Brad King Note Added: 0035626
2014-04-03 05:36 Daniele E. Domenichelli Note Added: 0035630
2014-05-07 05:24 Daniele E. Domenichelli Note Added: 0035831
2014-05-07 05:25 Daniele E. Domenichelli Note Edited: 0035831
2014-05-07 08:52 Brad King Note Added: 0035835
2014-05-07 09:21 Daniele E. Domenichelli Assigned To => Daniele E. Domenichelli
2014-05-07 09:21 Daniele E. Domenichelli Status new => assigned
2014-05-12 09:50 Brad King Note Added: 0035850
2014-05-12 09:56 Brad King Status assigned => resolved
2014-05-12 09:56 Brad King Resolution open => fixed
2014-05-12 09:56 Brad King Fixed in Version => CMake 3.1
2014-05-12 09:56 Brad King Target Version => CMake 3.1
2014-11-03 08:38 Robert Maynard Note Added: 0037135
2014-11-03 08:38 Robert Maynard Status resolved => closed
2014-12-13 11:34 Daniele E. Domenichelli Relationship added has duplicate 0015303


Copyright © 2000 - 2018 MantisBT Team