The following issue has been SUBMITTED. ====================================================================== http://www.cmake.org/Bug/view.php?id=11753 ====================================================================== Reported By: James Bigler Assigned To: ====================================================================== Project: CMake Issue ID: 11753 Category: (No Category) Reproducibility: have not tried Severity: minor Priority: normal Status: new ====================================================================== Date Submitted: 2011-01-25 19:34 EST Last Modified: 2011-01-25 19:34 EST ====================================================================== Summary: int main() can cause warnings when -Wstrict-prototypes and -Werror is used Description: In our projects we use -Wall -Wstrict-prototypes -Werror, and I just noticed that this causes all sorts of problems for the test code.
There seems like there are two solutions to this. 1. Fix all the test code, so that these warnings are tripped. 2. Somehow intercept try_compile so that it doesn't pass along things like -Werror. I've attempted to implement http://www.cmake.org/Bug/view.php?id=1 since it seems easier than modifying all the try_compile blocks with a compiler specific flag. I've also attached a patch against my 2.8.3 installation. Additional Information: grep -nH -e "int main()" * CheckCCompilerFlag.cmake:28: CHECK_C_SOURCE_COMPILES("int main() { return 0;}" ${_RESULT} CheckCXXCompilerFlag.cmake:28: CHECK_CXX_SOURCE_COMPILES("int main() { return 0;}" ${_RESULT} CheckForPthreads.c:9:int main(){ CheckFunctionExists.c:5:int main(){ CheckIncludeFile.c.in:4:int main() CheckIncludeFile.cxx.in:3:int main() CheckIncludeFiles.cmake:45: "${CMAKE_CONFIGURABLE_FILE_CONTENT}\n\nint main(){return 0;}\n") CheckStructHasMember.cmake:41:int main() CheckSymbolExists.cmake:50: "${CMAKE_CONFIGURABLE_FILE_CONTENT}\nvoid cmakeRequireSymbol(int dummy,...){(void)dummy;}\nint main()\n{\n#ifndef ${SYMBOL}\n cmakeRequireSymbol(0,&${SYMBOL});\n#endif\n return 0;\n}\n") CheckVariableExists.c:6:int main(){ CMakeDetermineVSServicePack.cmake:64: "int main() { return 0; }\n") CMakeTestCXXCompiler.cmake:28: "int main(){return 0;}\n") CMakeTestForFreeVC.cxx:3:int main(){return 0;} DummyCXXFile.cxx:1:int main() FindOpenMP.cmake:57:int main() { ====================================================================== Issue History Date Modified Username Field Change ====================================================================== 2011-01-25 19:34 James Bigler New Issue 2011-01-25 19:34 James Bigler File Added: main-void.patch ====================================================================== _______________________________________________ cmake-developers mailing list cmake-developers@cmake.org http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers