0

I am trying to set the configuration types for my CMakeLists.txt from the command line using the following call:

cmake .. -G "Visual Studio 14 2015 Win64" -T host=x64 -DCMAKE_CONFIGURATION_TYPES:STRING=Release -DCMAKE_INSTALL_PREFIX=C:\Temp -DCMAKE_PREFIX_PATH=C:\Temp\downloads

But unfortunately it seems to be not recognized and configure step (try_compile) is done with Debug as default configuration.

I read the docs for CMAKE_CONFIGURATION_TYPES variable, searched the net but found no solution so far. What am I doing wrong or is it a known limitation?

Environment: CMake 3.11.0, Visual Studio 14 2015 (x86/x64), Visual Studio 15 2017 (x86/x64) Windows 10, Windows 7

vre
  • 6,041
  • 1
  • 25
  • 39
  • What do you mean with "configure step is done with Debug as default coniguration"? Probably you need to set [`CMAKE_TRY_COMPILE_CONFIGURATION`](https://cmake.org/cmake/help/latest/variable/CMAKE_TRY_COMPILE_CONFIGURATION.html) also. – Florian May 04 '18 at 07:59
  • That seems to be exactly the issue. I was not aware of this variable. If you make that an answer I will gladly accept it. – vre May 04 '18 at 08:04

1 Answers1

1

If you reduce the CMAKE_CONFIGURATION_TYPES to a single configuration, you probably need to also set CMAKE_TRY_COMPILE_CONFIGURATION:

cmake .. -G "Visual Studio 14 2015 Win64" 
         -T host=x64 
         -D CMAKE_CONFIGURATION_TYPES:STRING=Release 
         -D CMAKE_TRY_COMPILE_CONFIGURATION:STRING=Release 
         -D CMAKE_INSTALL_PREFIX=C:\Temp 
         -D CMAKE_PREFIX_PATH=C:\Temp\downloads

References

Florian
  • 39,996
  • 9
  • 133
  • 149