Skip to content

CMAKE_DEFAULT_CONFIGS set to all does not affect cmake --install . to install all configurations

Sample project

cmake_minimum_required(VERSION 3.18)

set(CMAKE_CROSS_CONFIGS "all" CACHE STRING "" FORCE)
set(CMAKE_DEFAULT_CONFIGS "all" CACHE STRING "" FORCE)
set(CMAKE_INSTALL_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/installed" CACHE STRING "" FORCE)
project(test_nmc_install CXX)

set(source_file "${CMAKE_CURRENT_BINARY_DIR}/lib.cpp")
file(WRITE "${source_file}" "int foo() {return 0;}")

set(CMAKE_DEBUG_POSTFIX "_debug")
add_library(lib "${source_file}")

install(TARGETS lib ${args})
$ cmake .. -G"Ninja Multi-Config" -DCMAKE_CONFIGURATION_TYPES="Release;Debug"
$ ninja
$ ninja install
[0/2] Install the project...
-- Install configuration: "Debug"
-- Installing: /Volumes/T3/Dev/projects/cmake/general/multi_ninja_install_all/build/installed/lib/liblib_debug.a
[1/2] Install the project...
-- Install configuration: "Release"
-- Installing: /Volumes/T3/Dev/projects/cmake/general/multi_ninja_install_all/build/installed/lib/liblib.a

$ cmake --install .
-- Install configuration: "Release"
-- Installing: /Volumes/T3/Dev/projects/cmake/general/multi_ninja_install_all/build/installed/lib/liblib.a

Notice that calling ninja install directly installs both configurations, whereas calling cmake --install . installs only one configuration.

This was initially reported here #20713 (closed) and addressed here !4778 (merged)

I believe not changing the behaviour of cmake --install . is an oversight.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information