summaryrefslogtreecommitdiffstats
path: root/Source/cmTryCompileCommand.cxx
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2003-01-08 17:12:15 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2003-01-08 17:12:15 (GMT)
commit4d6dba4c37928026b577870e93128e55cd16a24f (patch)
treeaccd0180545ce70a9491bdf54bda9c0cdfe54e22 /Source/cmTryCompileCommand.cxx
parent8b1d032b7beb96ba7931939bda46eb70a8434310 (diff)
downloadCMake-4d6dba4c37928026b577870e93128e55cd16a24f.zip
CMake-4d6dba4c37928026b577870e93128e55cd16a24f.tar.gz
CMake-4d6dba4c37928026b577870e93128e55cd16a24f.tar.bz2
ENH: only force the use of ansi flags in backwards mode
Diffstat (limited to 'Source/cmTryCompileCommand.cxx')
-rw-r--r--Source/cmTryCompileCommand.cxx21
1 files changed, 18 insertions, 3 deletions
diff --git a/Source/cmTryCompileCommand.cxx b/Source/cmTryCompileCommand.cxx
index d40996f..9a0a6ac 100644
--- a/Source/cmTryCompileCommand.cxx
+++ b/Source/cmTryCompileCommand.cxx
@@ -152,10 +152,25 @@ int cmTryCompileCommand::CoreTryCompileCode(
"; TRY_COMPILE only works for C and CXX files");
return -1;
}
-
+ const char* cflags = mf->GetDefinition("CMAKE_C_FLAGS");
fprintf(fout, "SET(CMAKE_VERBOSE_MAKEFILE 1)\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, "SET(CMAKE_C_FLAGS \"${CMAKE_C_FLAGS}");
+ if(cflags)
+ {
+ fprintf(fout, " %s ", cflags);
+ }
+ fprintf(fout, " ${COMPILE_DEFINITIONS}\")\n");
+ // CXX specific flags
+ if(format == cmSystemTools::CXX_FILE_FORMAT )
+ {
+ const char* cxxflags = mf->GetDefinition("CMAKE_CXX_FLAGS");
+ fprintf(fout, "SET(CMAKE_CXX_FLAGS \"${CMAKE_CXX_FLAGS} ");
+ if(cxxflags)
+ {
+ fprintf(fout, " %s ", cxxflags);
+ }
+ fprintf(fout, " ${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