![]() Module libraries are always treated as LIBRARY targets. Marked with the FRAMEWORK property on macOS (see FRAMEWORKīelow.) For DLL platforms (all Windows-based systems includingĬygwin), the DLL import library is treated as an ARCHIVE target. Static libraries are treated as ARCHIVE targets, except those ![]() There are several kinds of target files that may be installed: ARCHIVE The TARGETS form specifies rules for installing targets from a They will be created according to the uname rules on Unix-like platforms. Many of the install() variants implicitly create the directoriesĬMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS is set, theseĭirectories will be created with the permissions specified. Specify that it is not an error if the file to be installed doesĬommand signatures that install files may print messages during Renaming is allowed only when a single file is Specify a name for an installed file that may be different from the Installed as part of a component-specific installation RENAME Specify that the file is excluded from a full installation and only The default component name may be controlled with theĬMAKE_INSTALL_DEFAULT_COMPONENT_NAME variable. If COMPONENT is not provided a default component “Unspecified” isĬreated. During a full installationĪll components are installed unless marked with EXCLUDE_FROM_ALL. The given component name will be executed. DuringĬomponent-specific installation only install rules associated with Is associated, such as “runtime” or “development”. Specify an installation component name with which the install rule Note that CONFIGURATIONS appears BEFORE RUNTIME DESTINATION. Install( TARGETS target CONFIGURATIONS Debug RUNTIME DESTINATION Debug/bin ) install( TARGETS target CONFIGURATIONS Release RUNTIME DESTINATION Release/bin ) Release configurations, do the following: For example, to set separate install paths for the Debug and This option only apply to options listed AFTER the CONFIGURATIONS ![]() Specify a list of build configurations for which the install ruleĪpplies (Debug, Release, etc.). Not make sense on certain platforms are ignored on those platforms. GROUP_WRITE, GROUP_EXECUTE, WORLD_READ, WORLD_WRITE, OWNER_READ, OWNER_WRITE, OWNER_EXECUTE, GROUP_READ, Mechanism explained in the CMAKE_INSTALL_PREFIX variable The prefix can be relocated at install time using the DESTDIR Relative to the value of the CMAKE_INSTALL_PREFIX variable. If a relative path is given it is interpreted If a full path (with a leading slash or drive letter) is given Specify the directory on disk to which a file will be installed. Multiple signatures are covered here but they are valid only for Installation options for files and targets. There are multiple signatures for this command. Specified by calls to this command within a source directory areĮxecuted in order during installation. The contents of the file will be made available to the calling script of find_package().This command generates installation rules for a project. We just need to provide the my_library-config.cmake file. Set(MY_LIBRARY_VERSION $ - matches this expression. Set(MY_LIBRARY_VERSION_MINOR 0 CACHE STRING "minor version" FORCE) Set(MY_LIBRARY_VERSION_MAJOR 1 CACHE STRING "major version" FORCE) # define library version (update: apparently you can also do it in project()!) The root CMakeLists.txt can look as follows: cmake_minimum_required(VERSION 3.0) This allows a seperation of CMake’s config files and other, unrelated configuration macros etc. The configurations will be set in the file which will be preprocessed to config_impl.hpp and included by config.hpp. The root CMakeLists.txt defines configuration options and adds the subdirectories. The library, the examples and the tool each has their own CMakeLists.txt defining the target and related code in their subdirectory. It also comes with some examples, a tool and unit tests. So we have a library consisting of various header and source files. The setupįor the scope of the tutorial, let’s say we have a library that has the following CMake structure: - include/ Throughout this post, I’ll be assuming a 3.x CMake version and an already existing CMake project. In particular, the system will be able to handle multiple installed versions and multiple configurations. In this post, I will show you how to install your library so that it can be used easily by other projects. As of version 0.5 my memory library now provides support for system-wide installation and CMake’s find_package().īecause I’ve spent hours of trial and error to come up with it, I’ll document it here.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |