On Wednesday 15 July 2009, Miguel A. Figueroa-Villanueva wrote: > On Tue, Jul 14, 2009 at 7:46 PM, Benjamin Schindler wrote: > > Miguel A. Figueroa-Villanueva wrote: > >> Just to be clear... > >> > >> If you have compiler dependent code: > >> > >> #if defined(_MSC_VER) > >> ... > >> #elif defined(__GNUC__) > >> ... > >> #else > >> ... > >> #endif > >> > >> Then you could do something like the following in CMakeLists.txt: > >> > >> if (CMAKE_COMPILER_IS_GNUC) > >> add_definitions(-DWORKING_WITH_GCC) # or use COMPILE_DEFINITIONS > >> property elseif (MSVC) > >> add_definitions(-DWORKING_WITH_MSVC) # or use COMPILE_DEFINITIONS > >> property > >> endif() > >> > >> and the code above would look like: > >> > >> #if defined(WORKING_WITH_MSVC) > >> ... > >> #elif defined(WORKING_WITH_GCC) > >> ... > >> #else > >> ... > >> #endif > > > > Yes, I could do that. But that's a hack - it should not be needed. All > > compilers have their macros which enables to differentiate between them, > > so why adding a new one? > > Right, it is a hack (after all it is a work around) I was just curious > to know where it wouldn't work... and I also wanted to make sure that > the eclipse generator is feeding the manually added definitions > correctly to the IDE. > > However, please do add this as a feature request at: > > http://public.kitware.com/Bug/my_view_page.php > > The following lines seem to dump the needed information: > > echo | gcc -v -x c -E -dD - > echo | gcc -v -x c++ -E -dD - > > Add any other relevant information; even patches are welcome ;)
Once I have the list of builtin macros, how should they end up in the project files ? Do you have any example files or pointers to documentation ? Here's the entry in the bug tracker: http://public.kitware.com/Bug/view.php?id=9272 Alex _______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake