1

Assuming that the person building the targets will use the appropiate generator (see CMake Multiarchitecture Compilation ),

How can I specify the output directory accordingly.

Something like:

if(WIN32)
    if(64bit)
       set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ./DEBUG/win64)
    elseif(32bit)
       set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ./DEBUG/win32)
    endif()
endif()

and so on for if(UNIX) and if(APPLE) which probably the same answer will work given CMake phylosophy.

Note that I'm not talking about cross-compiling. And assuming the generator is known.

Community
  • 1
  • 1
quimnuss
  • 1,503
  • 2
  • 17
  • 37
  • 1
    What exactly are you asking about? `32bit` and `64bit` could be determined using `CMAKE_SIZEOF_VOID_P`, for example. – Angew is no longer proud of SO Mar 19 '13 at 13:16
  • 1
    @Angew Yes, that would do it. I also saw that approach here http://stackoverflow.com/questions/4029587/compiling-32-bit-vs-64-bit-project-using-cmake but I was hoping there was a more elegant way. Furthermore on the cmake mailing list there were some complains regarding the variable not being set. That would indeed be a solution though. – quimnuss Mar 19 '13 at 14:00
  • Would it also correctly set 32bit if we're running cmake with 32-bit generators on a 64bit machine? – quimnuss Mar 19 '13 at 14:07
  • For Visual Studio generators, it works (I've tested it). I don't think other generators have 32-bit/64-bit variants. – Angew is no longer proud of SO Mar 19 '13 at 14:18
  • Good! I'll test it on the unix. They are able to build 32 and 64, see the link on the question. – quimnuss Mar 19 '13 at 14:26
  • I've testing this on unix also with `cmake 2.6` it works fine. – bikram990 May 10 '13 at 05:27

0 Answers0