header image
[ # ] CMake and Compiler target architecture
October 17th, 2012 under Programming

In a windows build system I use, we set up two distinct development environments. Both use the MinGW-w64 compilers. One is the 32 and the other the 64 bit GCC compiler. In addition I use CMake as the build system. Now I need to know if I’m compiling for 32 or 64 bit to know against which libs to link. On way of figuring this out is exploiting that we do not crosscompile. Depending on the environment I have the 32 or 64 bit GCC compiler. GCC tells you what its target machine is either with the

option or the
option. So this can easliy be included in CMake and find the appropriate libraries