How to set CMake variable of type list from comman

2019-07-27 10:53发布

I am trying to do something like this

cmake .. -G "Visual Studio 15 2017 Win64" -DCMAKE_CONFIGURATION_TYPES=ReleaseDebug

But the CMAKE_CONFIGURATION_TYPES is not set as a list variable. I also tried

cmake .. -G "Visual Studio 15 2017 Win64" -DCMAKE_CONFIGURATION_TYPES="Release Debug"

which didn't work either.

How to do it the right way?

标签: cmake
1条回答
We Are One
2楼-- · 2019-07-27 11:35

Lists are special type of strings in CMake. When you write set(var a b c) it is equivalent to set(var "a;b;c"). The same applies to your case. CMake interprets CMAKE_CONFIGURATION_TYPES variable as a list, so you need to write -DCMAKE_CONFIGURATION_TYPES="Release;Debug" to properly set it from the command line.

查看更多
登录 后发表回答