Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

For CMake's “install”, what does the CONFIGURATIONS argument do?

Tags:

cmake

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?

like image 778
Samuel Avatar asked Jun 28 '12 08:06

Samuel


People also ask

How do I specify Cmake installation prefix?

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 .

What creates Cmake_install Cmake?

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.

Where does Cmake install files?

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.


1 Answers

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.

like image 165
Fraser Avatar answered Sep 22 '22 07:09

Fraser