CMake tutorial on Github

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

CMake tutorial on Github

CMake mailing list

Hi fellow CMakers!

 

As part of a university course and an attempt to safeguard my time against all the one-to-one CMake tutorials I have held thus far, I have created a free CMake tutorial available here. It is fairly basic, in its current form is more or less just a jump-start guide. I wanted to maintain a consistent and modern style of scripting keeping up to date with the latest features.

 

If you like it and have collegues that need the first push, feel free to point them in this direction. If you feel like contributing, or simply have ideas which directions to take next, I am open to both suggestions and PRs. I am aware that raw Github is not the best platform for such a writing, but it was immensely simple to fire up, I need not worry about hosting, and collaborating on the material is a breeze.

 

Do keep in mind it is an unofficial tutorial and reflects MY understanding of CMake, not those of its day to day developers. (I have looked at the codebase on one occasion when I wanted to implement a feature, but it would’ve required a complete overhaul of the makefile generators which I did not have the capacity to do. If I’ll have the time, I’ll continue working on it, some lessons are referred to that are currently non-existent. I do intend on writing them sometime.

 

Cheers,

Máté

 


--

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:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: CMake tutorial on Github

Haocheng Liu
Hi Máté,
You can also take a look at this github repo: https://github.com/onqtam/awesome-cmake

There are also many cool examples and tutorials.

On Wed, Sep 20, 2017 at 10:36 AM, Nagy-Egri Máté Ferenc via CMake <[hidden email]> wrote:

Hi fellow CMakers!

 

As part of a university course and an attempt to safeguard my time against all the one-to-one CMake tutorials I have held thus far, I have created a free CMake tutorial available here. It is fairly basic, in its current form is more or less just a jump-start guide. I wanted to maintain a consistent and modern style of scripting keeping up to date with the latest features.

 

If you like it and have collegues that need the first push, feel free to point them in this direction. If you feel like contributing, or simply have ideas which directions to take next, I am open to both suggestions and PRs. I am aware that raw Github is not the best platform for such a writing, but it was immensely simple to fire up, I need not worry about hosting, and collaborating on the material is a breeze.

 

Do keep in mind it is an unofficial tutorial and reflects MY understanding of CMake, not those of its day to day developers. (I have looked at the codebase on one occasion when I wanted to implement a feature, but it would’ve required a complete overhaul of the makefile generators which I did not have the capacity to do. If I’ll have the time, I’ll continue working on it, some lessons are referred to that are currently non-existent. I do intend on writing them sometime.

 

Cheers,

Máté

 


--

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:
http://public.kitware.com/mailman/listinfo/cmake



--
Best regards
Haocheng

Haocheng LIU
Kitware, Inc.
R&D Engineer
21 Corporate Drive
Clifton Park, NY 12065-8662
Phone: <a href="tel:(518)%20881-4421" value="+15188814443" style="color:rgb(17,85,204);font-size:12.8px" target="_blank">518-881-4421

--

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:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: CMake tutorial on Github

CMake mailing list
In reply to this post by CMake mailing list
This looks good, a couple of comments:

- A common misconception for libraries is to generate a Find module for
downstream users. You don't suggest that in the tutorial, but in the section
"Shipping Find Module scripts" it would be a good idea to emphasize that is
for upstream libraries not downstream users.
- It should mention `CMAKE_PREFIX_PATH` as a way to tell cmake where
dependencies are installed, and really should be preferred over modifying a
global "registry".


On Wed, 2017-09-20 at 16:36 +0200, Nagy-Egri Máté Ferenc via CMake wrote:

> Hi fellow CMakers!
>  
> As part of a university course and an attempt to safeguard my time against
> all the one-to-one CMake tutorials I have held thus far, I have created a
> free CMake tutorial available here. It is fairly basic, in its current form
> is more or less just a jump-start guide. I wanted to maintain a consistent
> and modern style of scripting keeping up to date with the latest features.
>  
> If you like it and have collegues that need the first push, feel free to
> point them in this direction. If you feel like contributing, or simply have
> ideas which directions to take next, I am open to both suggestions and PRs.
> I am aware that raw Github is not the best platform for such a writing, but
> it was immensely simple to fire up, I need not worry about hosting, and
> collaborating on the material is a breeze.
>  
> Do keep in mind it is an unofficial tutorial and reflects MY understanding
> of CMake, not those of its day to day developers. (I have looked at the
> codebase on one occasion when I wanted to implement a feature, but it
> would’ve required a complete overhaul of the makefile generators which I did
> not have the capacity to do. If I’ll have the time, I’ll continue working on
> it, some lessons are referred to that are currently non-existent. I do
> intend on writing them sometime.
>  
> Cheers,
> Máté
>  
> -- 
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.o
> rg/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/opensourc
> e/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake
--

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:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: CMake tutorial on Github

CMake mailing list

Hi Paul!

 

I do not quite understand your comments.

 

  • Are you referring to the SFML distribution model? I am aware that deliberately forcing my end-users to ship a FindModule script sucks and I was not trying to promote that. I just said that it happens. The part where you say „emphasize that is for upstream libraries not downstream users”. How can I create a FindModule script FOR an upstream? Upstream is done. It’s compiled. Who else could the target audience of a FindModule script be, other other than a downstream user?
  • How can CMAKE_PREFIX_PATH be considered desirable over the package registry? I compile something, install and, register it, done. Fire and forget. I don’t think that either specifying toolchain files or specifying CMAKE_PREFIX_PATH are better than simply specifying… nothing?

 

Sorry if I am lost in translation, I’m just trying to understand.

 

Cheers,

Máté

 

Feladó: [hidden email]
Elküldve: 2017. szeptember 20., szerda 23:46
Címzett: [hidden email]; [hidden email]
Tárgy: Re: [CMake] CMake tutorial on Github

 

This looks good, a couple of comments:

 

- A common misconception for libraries is to generate a Find module for

downstream users. You don't suggest that in the tutorial, but in the section

"Shipping Find Module scripts" it would be a good idea to emphasize that is

for upstream libraries not downstream users.

- It should mention `CMAKE_PREFIX_PATH` as a way to tell cmake where

dependencies are installed, and really should be preferred over modifying a

global "registry".

 

 

On Wed, 2017-09-20 at 16:36 +0200, Nagy-Egri Máté Ferenc via CMake wrote:

> Hi fellow CMakers!

>  

> As part of a university course and an attempt to safeguard my time against

> all the one-to-one CMake tutorials I have held thus far, I have created a

> free CMake tutorial available here. It is fairly basic, in its current form

> is more or less just a jump-start guide. I wanted to maintain a consistent

> and modern style of scripting keeping up to date with the latest features.

>  

> If you like it and have collegues that need the first push, feel free to

> point them in this direction. If you feel like contributing, or simply have

> ideas which directions to take next, I am open to both suggestions and PRs.

> I am aware that raw Github is not the best platform for such a writing, but

> it was immensely simple to fire up, I need not worry about hosting, and

> collaborating on the material is a breeze.

>  

> Do keep in mind it is an unofficial tutorial and reflects MY understanding

> of CMake, not those of its day to day developers. (I have looked at the

> codebase on one occasion when I wanted to implement a feature, but it

> would’ve required a complete overhaul of the makefile generators which I did

> not have the capacity to do. If I’ll have the time, I’ll continue working on

> it, some lessons are referred to that are currently non-existent. I do

> intend on writing them sometime.

>  

> Cheers,

> Máté

>  

> -- 

>

> Powered by www.kitware.com

>

> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.o

> rg/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/opensourc

> e/opensource.html

>

> Follow this link to subscribe/unsubscribe:

> http://public.kitware.com/mailman/listinfo/cmake

 


--

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:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: CMake tutorial on Github

CMake mailing list
In reply to this post by CMake mailing list
On Thu, 2017-09-21 at 16:23 +0200, Nagy-Egri Máté Ferenc via CMake wrote:
> Hi Paul!
>  
> I do not quite understand your comments.
>  
> Are you referring to the SFML distribution model? I am aware that
> deliberately forcing my end-users to ship a FindModule script sucks and I
> was not trying to promote that.

Yes, you don't, but a casual user could possibly interpret it that way. The
same thing happens with cmake official documentation, even though it clearly
states a FindModule "is not shipped with upstream". 

> I just said that it happens. The part where you say „emphasize that is for
> upstream libraries not downstream users”. How can I create a FindModule
> script FOR an upstream? Upstream is done. It’s compiled. Who else could the
> target audience of a FindModule script be, other other than a downstream
> user?

Yea, I think the directions here is confusing. That is, in my library, I
create a FindModule to use an upstream library because the upstream library
doesn't support cmake. However, in my library, I create a config file to
support cmake for downstream users.

> How can CMAKE_PREFIX_PATH be considered desirable over the package registry?
> I compile something, install and, register it, done. Fire and forget. I
> don’t think that either specifying toolchain files or specifying
> CMAKE_PREFIX_PATH are better than simply specifying… nothing?

If I want to install multiple versions of the library(or libraries) in
different locations, that is one with `CMAKE_INSTALL_PREFIX=/opt/a` and
another with `CMAKE_INSTALL_PREFIX=/opt/b`, it can leads to lots of problems.
Implicitly changing where cmake searches will cause unnecessary headaches, and
it is rarely done(even the clFFT example doesn't do this). There are other
issues as well: it can't be done system-wide portably. It only can help find
config packages, whereas `CMAKE_PREFIX_PATH` can help tell where dependencies
are when using any of the `find_*` commands in cmake. 

Of course, I am not saying to remove the section, but rather discuss how
`CMAKE_PREFIX_PATH` can be used to tell cmake where your dependencies are
installed.

.
--

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:
http://public.kitware.com/mailman/listinfo/cmake