Hey, Is there a module out there that will supply pre-defined flags for different compilers?
I made a start on one, but I can't believe I am the first, but a snippet of what I have been making: if (${CMAKE_C_COMPILER_ID} STREQUAL "GNU") SET(C_WARN_DEF "-W") SET(C_WARN_FULL "-W -Wall -Wshadow") SET(C_WARN_NONE "-w") SET(C_WARN_ERROR "-Werror") SET(C_OPT_DEBUG "-g") SET(C_OPT_NONE "-O0") SET(C_OPT_SPEED "-O3") SET(C_OPT_SIZE "-Os") SET(C_WORD32 "-m32") SET(C_WORD64 "-m64") elseif (${CMAKE_C_COMPILER_ID} STREQUAL "MSVC") SET(C_WARN_DEF "/W3") SET(C_WARN_FULL "/W4") SET(C_WARN_NONE "/w") SET(C_WARN_ERROR "/WX") SET(C_OPT_DEBUG "/Z7") SET(C_OPT_NONE "/Od") SET(C_OPT_SPEED "/O2") SET(C_OPT_SIZE "/O1") SET(C_WORD32 "") SET(C_WORD64 "") endif () In other words, I want something that will set things like the above for EACH compiler (as I said, I have made some progress). The WORD32/WORD64 also need linker flags too. Plus going even further than the above (for doing things like enabling platform-specific optimizations, like -march=i686 on gcc, maybe in C_OPT_CPU) would be nice. FYI, I have made the CXX equivalents too. I only started using cmake this weekend, so my implementation may be a little naive and simplistic. But before I go completely crazy with this, I wanted to know if it has been done. It is kind of silly that the end-user has to know the flags for EACH compiler that may be used to compile their project to do things like enable ALL warnings, or optimize for size. It also seems a little odd that each end-user would have to write the if/elseif/endif code to accommodate each compiler themselves. I searched the bug database, and did not see any open issues relating to this, and the mailing list is not easily searchable (though google didn't turn up any results). FYI, I just moved from bjam to cmake - mainly because bjam is a little difficult to use and is quirky with relation to paths and such. Cmake is much more user-friendly, but does not seem to be as refined as far as handling different compiler flags as above. FYI 2, yes, I know I can use different settings of CMAKE_BUILD_TYPE to change the opimization/debug symbols flags, but that's only part of the story (there is nothing to change warning levels or force a 32-bit compile on a 64-bit machine). And if I was to make my own build type (eg. RELEASE32) I would need the flags above anyway to remain compiler agnostic. PreZ :)
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake