[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cmake
Subject:    Re: [CMake] find_package config and install
From:       Lars <laasunde () hotmail ! com>
Date:       2019-01-23 7:30:35
Message-ID: HE1PR03MB3050253E9C7ED60959748B66CA990 () HE1PR03MB3050 ! eurprd03 ! prod ! outlook ! com
[Download RAW message or body]

[Attachment #2 (text/plain)]

Alan,

Appreciate you taking the time to help.

It is unfortunately not an option to move 'foo' package to CMake at this time.

To summarize, we want to perform find_package in config mode to a none-CMake package \
that contain a target and some config files. Our current solution is to manually \
create the foo-config.cmake file that creates an imported target and sets properties \
on target. The 'foo' package must work with CPack in order to include the necessary \
files in MSI and RPM. As an experiment we added two install(..) commands to the \
foo-config.cmake file and this does include both 'foo' target and configuration files \
in the installers. However we are not sure if this is good modern CMake solution. \
This solution means that find_package(..) will automatically install files to the \
build tree which is slightly more functionality than the command name indicates.

Any comments are welcome 😊

kind regards, Lars

________________________________
Fra: Alan W. Irwin <Alan.W.Irwin1234@gmail.com>
Sendt: onsdag 23. januar 2019 04.14
Til: Lars
Kopi: cmake@cmake.org
Emne: Re: Sv: [CMake] find_package config and install

Hi Lars:

On 2019-01-22 12:05-0000 Lars wrote:

> Alan,
> 
> 
> Thank you very much for the response.

You are welcome.

> Our 'foo' package does not use CMake. That means there is no build-system to \
> produce the foo-config.cmake file, the file is manually created.  The file does \
> allow different projects to import the target from 'foo' package that has been \
> installed. However, we need to include the library and config file in CPack \
> installer and who is responsible for that task? 
> 
> We are using Qt5 config mode to import targets like you describe in development \
> context and it works. However, to setup packaging system (CPack) we need to perform \
> the Install(..) command so that the necessary Qt5 targets are included in the \
> installer (MSI and RPM). We cannot require the customer to install a 2GB Qt5 \
> installer for a few libraries. In that context it is unclear who\when\how should \
> perform the installation.

As you are probably already aware, the Qt5 software produces their "*-config.cmake" \
in a non-CMake way. And it appears you are attempting to follow that method for your \
own "foo" package case.  I applaud that attempt since that end result
should make life much easier for users of your foo package that do use
CMake.  However, now I hear you are using CPack for foo as well.  So
maybe it is time to bite the bullet and move foo to a cmake build
(which should make your life much simpler for creating both a working
"foo-config.cmake" file and a working CPack configuration.)

I specifically used the term "bite the bullet" because changing build
systems for any large software project with many different executables
and libraries is obviously not a trivial task.  But I assure you the
end goal of having a complete CMake-based build, test, and CPack
system is worth the pain of the transition.  But I would also advise
you it is possible to get from your present state to that goal in
small manageable steps that are not painful at all because partially
implemented CMake-based build systems normally happily coexist with
other build systems.

To take an example of such a soft (and completely unplanned)
transition to CMake (from more than a decade ago now) in the PLplot
case we had a mature autotools-based build system that was mostly good
enough "except for a few nagging problems...."  So out of curiosity
more than anything else I started a hobby project of implementing the
build of just one of our smaller libraries with CMake.  And that
proved to be trivial (it only took a half an hour or so to learn what
I needed about CMake starting from zero knowledge), and the resulting
library built much faster.  Following up on that initial promising
result I quickly (with some substantial help from other PLplot
developers at the time who were interested in learning about CMake)
extended that hobby build system to more and more of our libraries and
executables.  Until within a month or so of me starting this "hobby"
this self-organized group of
developers for our CMake-based build system was producing the same
libraries, shared-objects, and executables as our "standard"
autotools-based build system.  But that configuration was much easier
to understand than for our standard build system, and both the
configuration and build was much faster than for the autotools case.

As a result we "got serious" and for the next month or so extended the
work to support both PLplot testing and the installed version of
PLplot to essentially complete the project.  For a year after
that we maintained both the CMake-based and autotools-based build
systems, but interest in the latter dropped so fast that at
the end of that year we completely removed all traces of
our autotools-based build system from our source tree, and we
never regretted that decision.

Note, this transition to a CMake-based build system would likely not
have ever happened if we attempted to plan it from the start.
Instead, treating it like a learning hobby motivated me and the rest
of our development group a lot, and we achieved a very fast and
non-painful transition as a result.

Of course, you may reply that the "foo" case is completely different
and you are completely happy with your present build system for that
software.  If so, that is fine.  However, if you have some nagging
doubts about that build system (for example, some inconveniences when
implementing the "foo-config.cmake" file, configuring CPack, or
ultimately (if you are interested in testing "foo" configuring CTest)
then perhaps it is time for you to start a possible soft transition to
a CMake-based build system for "foo" as a hobby style of project
without the type of "planning" that often kills such potentially
useful projects dead.

Alan
__________________________
Alan W. Irwin

Programming affiliations with the FreeEOS equation-of-state
implementation for stellar interiors (freeeos.sf.net); the Time
Ephemerides project (timeephem.sf.net); PLplot scientific plotting
software package (plplot.sf.net); the libLASi project
(unifont.org/lasi); the Loads of Linux Links project (loll.sf.net);
and the Linux Brochure Project (lbproject.sf.net).
__________________________

Linux-powered Science
__________________________


[Attachment #3 (text/html)]

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} \
</style> </head>
<body dir="ltr">
<div style="color: rgb(0, 0, 0); font-family: Calibri,Helvetica,sans-serif; \
font-size: 12pt;"> Alan,</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri,Helvetica,sans-serif; \
font-size: 12pt;"> <br>
</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri,Helvetica,sans-serif; \
font-size: 12pt;"> Appreciate you taking the time to help.</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri,Helvetica,sans-serif; \
font-size: 12pt;"> <br>
</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri,Helvetica,sans-serif; \
font-size: 12pt;"> It is unfortunately not <span>an option </span>to move 'foo' \
package&nbsp;to CMake at this time.</div> <div style="color: rgb(0, 0, 0); \
font-family: Calibri,Helvetica,sans-serif; font-size: 12pt;"> <br>
</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri,Helvetica,sans-serif; \
font-size: 12pt;"> To summarize, we want to perform find_package in config mode to a \
none-CMake package that contain a target and some config files. Our current solution \
is to manually create the foo-config.cmake file that creates an imported \
target&nbsp;and sets properties on target.  The 'foo' package must work with CPack in \
order to include the necessary files in MSI and RPM. As an experiment we \
added&nbsp;two install(..) commands to the foo-config.cmake file and this does \
include both 'foo' target and configuration files in the&nbsp;installers.  However we \
are not sure if this is good modern CMake solution. This solution means that \
find_package(..) will automatically install files to the build tree which is slightly \
more functionality than the command name indicates.<br> </div>
<div>
<div id="appendonsend"></div>
<div style="color: rgb(0, 0, 0); font-family: Calibri,Helvetica,sans-serif; \
font-size: 12pt;"> <br>
</div>
<div style="color: rgb(0, 0, 0); font-family: \
EmojiFont,Calibri,Helvetica,sans-serif,'Apple Color Emoji','Segoe UI Emoji', \
NotoColorEmoji,'Segoe UI Symbol','Android Emoji',EmojiSymbols; font-size: 12pt;"> Any \
comments are welcome <span>😊</span></div> <div style="color: rgb(0, 0, 0); \
font-family: EmojiFont,Calibri,Helvetica,sans-serif,'Apple Color Emoji','Segoe UI \
Emoji', NotoColorEmoji,'Segoe UI Symbol','Android Emoji',EmojiSymbols; font-size: \
12pt;"> <br>
</div>
<div style="color: rgb(0, 0, 0); font-family: \
EmojiFont,Calibri,Helvetica,sans-serif,'Apple Color Emoji','Segoe UI Emoji', \
NotoColorEmoji,'Segoe UI Symbol','Android Emoji',EmojiSymbols; font-size: 12pt;"> \
kind regards, Lars</div> <div style="color: rgb(0, 0, 0); font-family: \
Calibri,Helvetica,sans-serif; font-size: 12pt;"> <br>
</div>
<hr tabindex="-1" style="width: 98%; display: inline-block;">
<div id="divRplyFwdMsg" dir="ltr"><font color="#000000" face="Calibri, sans-serif" \
style="font-size: 11pt;"><b>Fra:</b> Alan W. Irwin \
&lt;Alan.W.Irwin1234@gmail.com&gt;<br> <b>Sendt:</b> onsdag 23. januar 2019 04.14<br>
<b>Til:</b> Lars<br>
<b>Kopi:</b> cmake@cmake.org<br>
<b>Emne:</b> Re: Sv: [CMake] find_package config and install</font>
<div>&nbsp;</div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size: 11pt;">
<div class="PlainText">Hi Lars:<br>
<br>
On 2019-01-22 12:05-0000 Lars wrote:<br>
<br>
&gt; Alan,<br>
&gt;<br>
&gt;<br>
&gt; Thank you very much for the response.<br>
<br>
You are welcome.<br>
<br>
&gt; Our 'foo' package does not use CMake. That means there is no build-system to \
produce the foo-config.cmake file, the file is manually created.&nbsp; The file does \
allow different projects to import the target from 'foo' package that has been \
installed. However,  we need to include the library and config file in CPack \
installer and who is responsible for that task?<br> &gt;<br>
&gt;<br>
&gt; We are using Qt5 config mode to import targets like you describe in development \
context and it works. However, to setup packaging system (CPack) we need to perform \
the Install(..) command so<br> &gt; that the necessary Qt5 targets are included in \
the installer (MSI and RPM). We cannot require the customer to install a 2GB Qt5 \
installer for a few libraries. In that context it is unclear who\when\how should \
perform the installation.<br> <br>
As you are probably already aware, the Qt5 software produces their \
&quot;*-config.cmake&quot; in a non-CMake way.<br> And it appears you are attempting \
to follow that method for your own<br> &quot;foo&quot; package case.&nbsp; I applaud \
that attempt since that end result<br> should make life much easier for users of your \
foo package that do use<br> CMake.&nbsp; However, now I hear you are using CPack for \
foo as well.&nbsp; So<br> maybe it is time to bite the bullet and move foo to a cmake \
build<br> (which should make your life much simpler for creating both a working<br>
&quot;foo-config.cmake&quot; file and a working CPack configuration.)<br>
<br>
I specifically used the term &quot;bite the bullet&quot; because changing build<br>
systems for any large software project with many different executables<br>
and libraries is obviously not a trivial task.&nbsp; But I assure you the<br>
end goal of having a complete CMake-based build, test, and CPack<br>
system is worth the pain of the transition.&nbsp; But I would also advise<br>
you it is possible to get from your present state to that goal in<br>
small manageable steps that are not painful at all because partially<br>
implemented CMake-based build systems normally happily coexist with<br>
other build systems.<br>
<br>
To take an example of such a soft (and completely unplanned)<br>
transition to CMake (from more than a decade ago now) in the PLplot<br>
case we had a mature autotools-based build system that was mostly good<br>
enough &quot;except for a few nagging problems....&quot;&nbsp; So out of \
curiosity<br> more than anything else I started a hobby project of implementing \
the<br> build of just one of our smaller libraries with CMake.&nbsp; And that<br>
proved to be trivial (it only took a half an hour or so to learn what<br>
I needed about CMake starting from zero knowledge), and the resulting<br>
library built much faster.&nbsp; Following up on that initial promising<br>
result I quickly (with some substantial help from other PLplot<br>
developers at the time who were interested in learning about CMake)<br>
extended that hobby build system to more and more of our libraries and<br>
executables.&nbsp; Until within a month or so of me starting this \
&quot;hobby&quot;<br> this self-organized group of<br>
developers for our CMake-based build system was producing the same<br>
libraries, shared-objects, and executables as our &quot;standard&quot;<br>
autotools-based build system.&nbsp; But that configuration was much easier<br>
to understand than for our standard build system, and both the<br>
configuration and build was much faster than for the autotools case.<br>
<br>
As a result we &quot;got serious&quot; and for the next month or so extended the<br>
work to support both PLplot testing and the installed version of<br>
PLplot to essentially complete the project.&nbsp; For a year after<br>
that we maintained both the CMake-based and autotools-based build<br>
systems, but interest in the latter dropped so fast that at<br>
the end of that year we completely removed all traces of<br>
our autotools-based build system from our source tree, and we<br>
never regretted that decision.<br>
<br>
Note, this transition to a CMake-based build system would likely not<br>
have ever happened if we attempted to plan it from the start.<br>
Instead, treating it like a learning hobby motivated me and the rest<br>
of our development group a lot, and we achieved a very fast and<br>
non-painful transition as a result.<br>
<br>
Of course, you may reply that the &quot;foo&quot; case is completely different<br>
and you are completely happy with your present build system for that<br>
software.&nbsp; If so, that is fine.&nbsp; However, if you have some nagging<br>
doubts about that build system (for example, some inconveniences when<br>
implementing the &quot;foo-config.cmake&quot; file, configuring CPack, or<br>
ultimately (if you are interested in testing &quot;foo&quot; configuring CTest)<br>
then perhaps it is time for you to start a possible soft transition to<br>
a CMake-based build system for &quot;foo&quot; as a hobby style of project<br>
without the type of &quot;planning&quot; that often kills such potentially<br>
useful projects dead.<br>
<br>
Alan<br>
__________________________<br>
Alan W. Irwin<br>
<br>
Programming affiliations with the FreeEOS equation-of-state<br>
implementation for stellar interiors (freeeos.sf.net); the Time<br>
Ephemerides project (timeephem.sf.net); PLplot scientific plotting<br>
software package (plplot.sf.net); the libLASi project<br>
(unifont.org/lasi); the Loads of Linux Links project (loll.sf.net);<br>
and the Linux Brochure Project (lbproject.sf.net).<br>
__________________________<br>
<br>
Linux-powered Science<br>
__________________________<br>
</div>
</span></font></div>
</div>
</body>
</html>



-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: \
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information \
on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at \
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake

--===============1202151072==--



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic