![]() What is the proper way to do this Things I have tried: Checking CMAKEOSXDEPLOYMENTTARGET. This makes functions or utilities exported by the package available for consumers just by setting findpackage() in the CMakeLists.txt. Im using a non-recommended way to include files. This file uses BUILDMODULES values to include the files using the include() CMake directive after the targets are created.This can get quite complex quite fast, CMake has many options. I cant seem to find any way to figure out the target SDK version in CMake. The file CMakeLists.txt contains a set of directives and instructions describing the projects source files and targets (executable, library, or both). ![]() link the new library if targeting a newer SDK version, and skip the new library otherwise. Using target_link_library on our header-only library with INTERFACE specified means that the executable that eventually gets compiled with our library will have the appropriate link flags. This means that the targetlinklibraries() in CMake has to account for this, i.e. This makes INTERFACE very useful for header-only libraries that aren't compiled (on their own), but rely on other libraries they need to link to. ![]() If INTERFACE is specified, then the option/property does not impact the current target but will propagate to other targets that link to it. ![]() If PUBLIC is specified, then the option/property impacts both the current target and any others that link to it. If PRIVATE is specified for a certain option/property, then that option/property will only impact the current target. It may be handy to understand how INTERFACE, PUBLIC, and PRIVATE behave. Target_link_library ( another-users-target my-library )Äoing so will ensure that any INTERFACE-marked include directories, compile definitions, other linked libraries, etc. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |