
Properties in CMake, it gets it’s default value from a CMAKE_CXX_STANDARD variable if it is set,īut there is no INTERFACE version - you cannot force a CXX_STANDARD via a target. There is a C++ standard property - CXX_STANDARD. PUBLIC, then both properties are appended to at the same time. INTERFACE instead, then INTERFACE_INCLUDE_DIRECTORIES is appended to, instead.

The INCLUDE_DIRECTORIES property of TargetA has mydir appended. When you run target_include_directories(TargetA PRIVATE mydir), then The PUBLIC keyword fills both propertyįields at the same time. Tell targets linked to this one what to do when building. “private” properties control what happens when you build that target, and the “interface” properties There are two collections of properties on every target that can be filled with values the Sees through mylibrary the private library will not affect it. myprogram will build the three libraries it P(Public Library) - > |PUBLIC| M((Main Library))įigure 1: Example of PUBLIC, PRIVATE, and INTERFACE. Maybe you do require users have C++14, but your library can compile with any version of C++.

More on that later, once we see what we can do with targets. To make the default is sort-of an “auto” library that is user selectable with BUILD_SHARED_LIBS. You can add the keywords STATIC, SHARED, or MODULE if you know what kind of library you want
