
one is both the name of the executable file generated, and the name of the CMake target created (you'll hear a lot more about targets soon, I promise). With them, let's start with a simple executable. Making an executableĪlthough libraries are much more interesting, and we'll spend most of our time There's really nothing special about the project name. CMake does have an inline syntax for comments too, but This is what new projects should do: cmake_minimum_required(VERSION 3.7.
#CMAKE LINK LIBRARY DIRECTORY WINDOWS#
Windows users, who also usually have a very recent version of CMake.

New versions of policies tend to be most important for macOS and Version of the policies in this example, since those versions didn't treat this Versions of CMake (though actually running CMake 3.1-3.11 will only set the 3.1 Settings, and due to a trick in the syntax, it's backward compatible with older This is much nicer on users that need the better This means you support as low as 3.1 but have also tested it with the new Starting in CMake 3.12, this supports a range, such as VERSION 3.1.3.15 A list of policies and versions is available at If you set it to 3.3 or less, you'll get the wrong So, if you set minimum_required to VERSION 2.8, you'll get the wrong linking behavior on macOS, for example, even in the

This line is special! 2 The version of CMake will also dictate the policies, This book, just click on the command name to see the official documentation,Īnd use the dropdown to switch documentation between CMake versions. And the value of the version follows the keyword. 1 The VERSION is a special keyword for thisįunction.

The command nameĬmake_minimum_required is case insensitive, so the common practice The file CMake looks for: cmake_minimum_required(VERSION 3.1) Here's the first line of every CMakeLists.txt, which is the required name of Introduction to the basics Minimum Version
