One way to entirely disregard BUILD_INTERFACE libraries during the installation process is to set the INSTALL_INTERFACE
property to a different value from the BUILD_INTERFACE
property for the target that includes the libraries. This will ensure that when the target is installed, only the INSTALL_INTERFACE
libraries will be included.
For example, if the MyLib
target includes some libraries that are only needed during the build process, you can set the INSTALL_INTERFACE
property to a different value like this:
set_target_properties(MyLib PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_INSTALL_INCLUDEDIR}"
INTERFACE_LINK_LIBRARIES "${CMAKE_INSTALL_LIBDIR}/MyLibLibraries.lib"
)
set_target_properties(MyLibLibraries PROPERTIES
BUILD_INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/lib"
INSTALL_INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_INSTALL_INCLUDEDIR}"
INSTALL_INTERFACE_LINK_LIBRARIES "${CMAKE_INSTALL_LIBDIR}/MyLibLibraries.lib"
)
In this example, the MyLib
target links to the MyLibLibraries
target, which provides some libraries that are only needed during the build process. The BUILD_INTERFACE
properties for MyLibLibraries
are set to the source directory (CMAKE_CURRENT_SOURCE_DIR
) where the libraries are located. The INSTALL_INTERFACE
properties are set to the installation directory (CMAKE_INSTALL_INCLUDEDIR
and CMAKE_INSTALL_LIBDIR
) where the libraries will be installed.
By setting the INSTALL_INTERFACE
properties for MyLibLibraries
to different values from the BUILD_INTERFACE
properties, the libraries will be completely disregarded during the installation process. Only the INSTALL_INTERFACE
libraries will be included in the installation.
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2022-11-14 11:00:00 +0000
Seen: 10 times
Last updated: Jul 04 '21
What is the process for altering svn branches with git-svn?
What is the process to italicize certain keywords in visual studio code?
What is the process for developing a JTable that has both row and column headers?
What is the process for removing a dat.GUI element?
How to solve the issue "process is running" in Visual Studio Debugging?
What is the process of moving information from one tab to another in Excel by transposing it?
What is the process of dividing the WSD dataset (in CSV format) into tokens called?
What is the process of uploading a file using NextJS and formidable?
What is the process for using pnpm to build a single workspace only?