CMake/MinimalExamples: Difference between revisions

From KitwarePublic
Jump to navigationJump to search
(Give hope to newbies by showing the CMakeLists.txt need not be complex)
 
(Replace content with link to new CMake community wiki)
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
CMake has lots of documentation, but when learning a new feature (or just starting out), there is no substitute for trying it out in isolation.
{{CMake/Template/Moved}}
That way, if anything goes wrong, you have fewer lines of CMakeList.txt to look through for problems.


For instance, here is the simplest possible CMakeLists.txt for a "Hello, World" project:
This page has moved [https://gitlab.kitware.com/cmake/community/wikis/doc/cmake/MinimalExamples here].
 
    add_executable(hello hello.c)
 
And here's the simplest possible one for a shared library:
 
    add_library(hellolib SHARED hellolib.c)
 
That's right - CMakeLists.txt can be a single line. And if that's all you need, that's all you should use!

Latest revision as of 15:40, 30 April 2018


The CMake community Wiki has moved to the Kitware GitLab Instance.

This page has moved here.