cmakecpu-architecturecmake-guimulti-configuration

why specifying architecture needs to be done in cmake for multi-configuration generators


I understand that CMAKE_BUILD_TYPE only works for single-configuration generators like Unix Makefiles. There are also multi-configuration generators like Visual Studio or Xcode where CMAKE_BUILD_TYPE does not works. (see this and this question for further info). I've generated Visual Studio 2013 x86 project with cmake-gui for libharu and there is not possible to switch from win32 to x64 in Visual Studio. I'm wondering why in multi-configurations it is need to specify architecture (x86 or x64) in cmake? Why it is not possible in Visual Studio directly? Is there some limitation or benefit or something that I should be aware of?

Thanks


Solution

  • Because this switch between 32 and 64 bit is not available in all environments cmake follows the philosophy to use out-of-source builds and have each compiler in their own directory. So a 32 bit and a 64 bit build can be seen as a a different compilation environment so they each generate their own folders.

    So while this is a cmake limitation it is also intentional.

    This answer also mentions this: https://stackoverflow.com/a/5359191/152359