I don't know what the CONFIGURATIONS
argument of CMake's install
command does. When I use CONFIGURATIONS
with debug or release in installing files, no file gets installed. What happened?
Can someone explain it in more detail. It will be best if you give me some examples.
P.S. This is not the same as: For CMake's "install" command, what can the COMPONENT argument do?
cmake: Add `--prefix` option to set CMAKE_INSTALL_PREFIX. Classically the primary way of specifying the install directory is via CMAKE_INSTALL_PREFIX . With the introduction of cmake --install we added --prefix to override the existing CMAKE_INSTALL_PREFIX .
The install() command generates a file, cmake_install. cmake, inside the build directory, which is used internally by the generated install target and by CPack.
Install directory used by install. If “make install” is invoked or INSTALL is built, this directory is prepended onto all install directories. This variable defaults to /usr/local on UNIX and c:/Program Files on Windows.
From the docs:
The CONFIGURATIONS argument specifies a list of build configurations for which the install rule applies (Debug, Release, etc.).
So for example, consider the following CMakeListst.txt:
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
project(Test)
add_executable(MyTest main.cc)
install(TARGETS MyTest DESTINATION bin CONFIGURATIONS Release)
This means that
cmake --build . --target install --config Release
will place the executable MyTest
(or MyTest.exe
) in ${CMAKE_INSTALL_PREFIX}/bin
, and
cmake --build . --target install --config Debug
won't install anything.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With