diff --git a/Source/cmTryCompileCommand.cxx b/Source/cmTryCompileCommand.cxx index 44752eb8d..04a7a4d2d 100644 --- a/Source/cmTryCompileCommand.cxx +++ b/Source/cmTryCompileCommand.cxx @@ -153,7 +153,8 @@ int cmTryCompileCommand::CoreTryCompileCode( return -1; } - fprintf(fout, "ADD_DEFINITIONS(${COMPILE_DEFINITIONS})\n"); + fprintf(fout, "SET(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} ${COMPILE_DEFINITIONS})\n"); + fprintf(fout, "SET(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} ${COMPILE_DEFINITIONS})\n"); fprintf(fout, "INCLUDE_DIRECTORIES(${INCLUDE_DIRECTORIES})\n"); fprintf(fout, "LINK_DIRECTORIES(${LINK_DIRECTORIES})\n"); // handle any compile flags we need to pass on