MantisBT - CMake |
View Issue Details |
|
ID | Project | Category | View Status | Date Submitted | Last Update |
0014849 | CMake | CMake | public | 2014-03-28 12:34 | 2014-12-13 11:34 |
|
Reporter | Dmitry Marakasov | |
Assigned To | Daniele E. Domenichelli | |
Priority | normal | Severity | major | Reproducibility | always |
Status | closed | Resolution | fixed | |
Platform | amd64 | OS | FreeBSD | OS Version | 10.0 |
Product Version | CMake 2.8.12.1 | |
Target Version | CMake 3.1 | Fixed in Version | CMake 3.1 | |
|
Summary | 0014849: Need a way to disable CMake package registry |
Description | As 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. |
Steps To Reproduce | |
Additional Information | |
Tags | No tags attached. |
Relationships | has duplicate | 0015303 | closed | | Turning off package registry |
|
Attached Files | |
|
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 | bug_revision_view_page.php?bugnote_id=35577#r1422 |
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 | bug_revision_view_page.php?bugnote_id=35831#r1457 |
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 |
Notes |
|
(0035555)
|
Stephen Kelly
|
2014-03-28 12:36
|
|
I wonder if this can be done automatically if the CMAKE_INSTALL_PREFIX is "/usr(/lib)?". |
|
|
(0035556)
|
Dmitry Marakasov
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
2014-04-02 14:17
|
|
|
|
(0035630)
|
Daniele E. Domenichelli
|
2014-04-03 05:36
|
|
|
|
(0035831)
|
Daniele E. Domenichelli
|
2014-05-07 05:24
(edited on: 2014-05-07 05:25) |
|
|
|
(0035835)
|
Brad King
|
2014-05-07 08:52
|
|
|
|
(0035850)
|
Brad King
|
2014-05-12 09:50
|
|
|
|
(0037135)
|
Robert Maynard
|
2014-11-03 08:38
|
|
Closing resolved issues that have not been updated in more than 4 months. |
|