Hello everyone,
I am following Step 1 of the CMake tutorial, and I am trying to control the output directory of executables. As the Visual Studio build system creates subdirectories per configuration in the build directory by default, I am also trying to make these names lowercase.
I set CMAKE_RUNTIME_OUTPUT_DIRECTORY
to a generator expression with $<LOWER_CASE:...>
:
cmake_minimum_required(VERSION 3.10)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY C:/_stash/_files/cmaketest/$<LOWER_CASE:$<CONFIG>>)
project(Tutorial
DESCRIPTION "A tutorial CMake project.")
add_executable(Tutorial tutorial.cxx)
However, when the config is Debug
or Release
, the result subdirectory name is always capitalized, even when --config
is specified:
Command | Output location |
---|---|
cmake --build ../build/Step1 |
C:\_stash\_files\cmaketest\Debug\Tutorial.exe |
cmake --build ../build/Step1 --config debug |
C:\_stash\_files\cmaketest\Debug\Tutorial.exe |
cmake --build ../build/Step1 --config release |
C:\_stash\_files\cmaketest\Release\Tutorial.exe |
cmake --build ../build/Step1 --config releaSE |
C:\_stash\_files\cmaketest\Release\Tutorial.exe |
The other two, MinSizeRel
and RelWithDebInfo
, which I found in the generated .vcxproj, build as expected and output respectively to C:\_stash\_files\cmaketest\minsizerel\Tutorial.exe and C:\_stash\_files\cmaketest\relwithdebinfo\Tutorial.exe.
I tried moving the set()
command after project()
but nothing changed. I think this is a CMake bug… any ideas?
(CMake version: 3.25.1-msvc1)