From bc9531c0d19a57a80b2ac20bafcbe41550f892e4 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Wed, 23 May 2001 17:19:38 -0400 Subject: [PATCH] ENH: create CMAKE_CXX_FLAGS_[Buildtype] flags --- Source/cmDSPMakefile.cxx | 18 ++++++++++++++++++ Source/cmDSPWriter.cxx | 18 ++++++++++++++++++ Templates/CMakeWindowsSystemConfig.cmake | 5 ++++- Templates/DLLHeader.dsptemplate | 24 +++++++++++++++--------- Templates/EXEHeader.dsptemplate | 21 +++++++++++++++------ Templates/EXEWinHeader.dsptemplate | 21 +++++++++++++++------ Templates/staticLibHeader.dsptemplate | 22 +++++++++++++++------- 7 files changed, 100 insertions(+), 29 deletions(-) diff --git a/Source/cmDSPMakefile.cxx b/Source/cmDSPMakefile.cxx index 7fa43f0c9..dfee8f11e 100644 --- a/Source/cmDSPMakefile.cxx +++ b/Source/cmDSPMakefile.cxx @@ -565,6 +565,24 @@ void cmDSPMakefile::WriteDSPHeader(std::ostream& fout, const char *libName, cmSystemTools::ReplaceString(line, "EXTRA_DEFINES", m_Makefile->GetDefineFlags()); + cmSystemTools::ReplaceString(line, + "CMAKE_CXX_FLAGS_RELEASE", + m_Makefile-> + GetDefinition("CMAKE_CXX_FLAGS_RELEASE")); + cmSystemTools::ReplaceString(line, + "CMAKE_CXX_FLAGS_MINSIZEREL", + m_Makefile-> + GetDefinition("CMAKE_CXX_FLAGS_MINSIZEREL") + ); + cmSystemTools::ReplaceString(line, + "CMAKE_CXX_FLAGS_DEBUG", + m_Makefile-> + GetDefinition("CMAKE_CXX_FLAGS_DEBUG")); + cmSystemTools::ReplaceString(line, + "CMAKE_CXX_FLAGS", + m_Makefile-> + GetDefinition("CMAKE_CXX_FLAGS")); + fout << line.c_str() << std::endl; } } diff --git a/Source/cmDSPWriter.cxx b/Source/cmDSPWriter.cxx index 7fa43f0c9..dfee8f11e 100644 --- a/Source/cmDSPWriter.cxx +++ b/Source/cmDSPWriter.cxx @@ -565,6 +565,24 @@ void cmDSPMakefile::WriteDSPHeader(std::ostream& fout, const char *libName, cmSystemTools::ReplaceString(line, "EXTRA_DEFINES", m_Makefile->GetDefineFlags()); + cmSystemTools::ReplaceString(line, + "CMAKE_CXX_FLAGS_RELEASE", + m_Makefile-> + GetDefinition("CMAKE_CXX_FLAGS_RELEASE")); + cmSystemTools::ReplaceString(line, + "CMAKE_CXX_FLAGS_MINSIZEREL", + m_Makefile-> + GetDefinition("CMAKE_CXX_FLAGS_MINSIZEREL") + ); + cmSystemTools::ReplaceString(line, + "CMAKE_CXX_FLAGS_DEBUG", + m_Makefile-> + GetDefinition("CMAKE_CXX_FLAGS_DEBUG")); + cmSystemTools::ReplaceString(line, + "CMAKE_CXX_FLAGS", + m_Makefile-> + GetDefinition("CMAKE_CXX_FLAGS")); + fout << line.c_str() << std::endl; } } diff --git a/Templates/CMakeWindowsSystemConfig.cmake b/Templates/CMakeWindowsSystemConfig.cmake index a1ca68507..c30d75fb6 100644 --- a/Templates/CMakeWindowsSystemConfig.cmake +++ b/Templates/CMakeWindowsSystemConfig.cmake @@ -6,4 +6,7 @@ SET (WORDS_BIGENDIAN ) SET (HAVE_LIMITS_H 1) SET (HAVE_UNISTD_H 1) SET (CXX VC++60) - +SET (CMAKE_CXX_FLAGS_RELEASE "/MD /O2" CACHE_NO_REPLACE) +SET (CMAKE_CXX_FLAGS_MINSIZEREL "/MD /O1" CACHE_NO_REPLACE) +SET (CMAKE_CXX_FLAGS_DEBUG "/MDd /Zi /Od /Gz /O2" CACHE_NO_REPLACE) +SET (CMAKE_CXX_FLAGS "/W3 /Zm1000 /GX /GR" CACHE_NO_REPLACE) diff --git a/Templates/DLLHeader.dsptemplate b/Templates/DLLHeader.dsptemplate index e5c3c5b74..5378d4c60 100644 --- a/Templates/DLLHeader.dsptemplate +++ b/Templates/DLLHeader.dsptemplate @@ -56,9 +56,11 @@ RSC=rc.exe # PROP Intermediate_Dir "Release" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GR /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "OUTPUT_LIBNAME_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GR /GX /O2 BUILD_INCLUDES EXTRA_DEFINES /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "OUTPUT_LIBNAME_EXPORTS" /FD /c -# SUBTRACT CPP /YX +# ADD BASE CPP /nologo /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "OUTPUT_LIBNAME_EXPORTS" /FD /c +# ADD CPP /nologo /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /FD /c +# ADD CPP BUILD_INCLUDES EXTRA_DEFINES /D "OUTPUT_LIBNAME_EXPORTS" +# ADD CPP CMAKE_CXX_FLAGS_RELEASE +# ADD CPP CMAKE_CXX_FLAGS # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x409 /d "NDEBUG" @@ -83,9 +85,11 @@ LINK32=link.exe # PROP Intermediate_Dir "Debug" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /GR /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "OUTPUT_LIBNAME_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /GR /GX /Zi /Od BUILD_INCLUDES EXTRA_DEFINES /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "OUTPUT_LIBNAME_EXPORTS" /FD /GZ /c -# SUBTRACT CPP /YX +# ADD BASE CPP /nologo /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "OUTPUT_LIBNAME_EXPORTS" /FD /c +# ADD CPP /nologo /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /FD /c +# ADD CPP BUILD_INCLUDES EXTRA_DEFINES /D "OUTPUT_LIBNAME_EXPORTS" +# ADD CPP CMAKE_CXX_FLAGS_DEBUG +# ADD CPP CMAKE_CXX_FLAGS # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x409 /d "_DEBUG" @@ -111,10 +115,12 @@ LINK32=link.exe # PROP Intermediate_Dir "LIBRARY_OUTPUT_PATHMinSizeRel" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /GR /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "OUTPUT_LIBNAME_EXPORTS" /FD /c +# ADD BASE CPP /nologo /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /FD /c # SUBTRACT BASE CPP /YX -# ADD CPP /nologo /MD /W3 /GR /GX /O1 BUILD_INCLUDES EXTRA_DEFINES /D "VTKDLL" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "OUTPUT_LIBNAME_EXPORTS" /FD /c -# SUBTRACT CPP /YX +# ADD CPP /nologo /D "VTKDLL" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /FD /c +# ADD CPP BUILD_INCLUDES EXTRA_DEFINES /D "OUTPUT_LIBNAME_EXPORTS" +# ADD CPP CMAKE_CXX_FLAGS_MINSIZEREL +# ADD CPP CMAKE_CXX_FLAGS # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x409 /d "NDEBUG" diff --git a/Templates/EXEHeader.dsptemplate b/Templates/EXEHeader.dsptemplate index e94b6241b..b9f569986 100644 --- a/Templates/EXEHeader.dsptemplate +++ b/Templates/EXEHeader.dsptemplate @@ -55,8 +55,11 @@ RSC=rc.exe # PROP Output_Dir "EXECUTABLE_OUTPUT_PATHRelease" # PROP Intermediate_Dir "Release" # PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GR /GX /Zm1000 /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c -# ADD CPP /nologo /MD /W3 /GR /GX /Zm1000 /O2 /D "WIN32" BUILD_INCLUDES EXTRA_DEFINES /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c +# ADD BASE CPP /nologo /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c +# ADD CPP /nologo /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c +# ADD CPP BUILD_INCLUDES EXTRA_DEFINES /D "OUTPUT_LIBNAME_EXPORTS" +# ADD CPP CMAKE_CXX_FLAGS_RELEASE +# ADD CPP CMAKE_CXX_FLAGS # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe @@ -80,8 +83,11 @@ CM_MULTILINE_LIBRARIES # PROP Output_Dir "EXECUTABLE_OUTPUT_PATHDebug" # PROP Intermediate_Dir "Debug" # PROP Target_Dir "" -# ADD BASE CPP /W3 /GR /Zm1000 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c -# ADD CPP /nologo /W3 /MDd /GR /Gm /GX /Zm1000 /ZI /Od /D "WIN32" BUILD_INCLUDES EXTRA_DEFINES /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c +# ADD BASE CPP /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c +# ADD CPP /nologo /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c +# ADD CPP BUILD_INCLUDES EXTRA_DEFINES /D "OUTPUT_LIBNAME_EXPORTS" +# ADD CPP CMAKE_CXX_FLAGS_DEBUG +# ADD CPP CMAKE_CXX_FLAGS # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x409 /d "_DEBUG" @@ -106,8 +112,11 @@ CM_MULTILINE_LIBRARIES # PROP Output_Dir "EXECUTABLE_OUTPUT_PATHMinSizeRel" # PROP Intermediate_Dir "MinSizeRel" # PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /GR /GX /Zm1000 /O1 /Gs /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c -# ADD CPP /nologo /MD /W3 /GR /GX /Zm1000 /O1 /Gs /D "WIN32" BUILD_INCLUDES EXTRA_DEFINES /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c +# ADD BASE CPP /nologo /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c +# ADD CPP /nologo /D "WIN32" BUILD_INCLUDES EXTRA_DEFINES /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c +# ADD CPP BUILD_INCLUDES EXTRA_DEFINES /D "OUTPUT_LIBNAME_EXPORTS" +# ADD CPP CMAKE_CXX_FLAGS_MINSIZEREL +# ADD CPP CMAKE_CXX_FLAGS # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe diff --git a/Templates/EXEWinHeader.dsptemplate b/Templates/EXEWinHeader.dsptemplate index 573494161..560c6b41c 100644 --- a/Templates/EXEWinHeader.dsptemplate +++ b/Templates/EXEWinHeader.dsptemplate @@ -55,8 +55,11 @@ RSC=rc.exe # PROP Output_Dir "EXECUTABLE_OUTPUT_PATHRelease" # PROP Intermediate_Dir "Release" # PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GR /GX /Zm1000 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /FD /c -# ADD CPP /nologo /MD /W3 /GR /GX /Zm1000 /O2 /D "WIN32" BUILD_INCLUDES EXTRA_DEFINES /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /FD /c +# ADD BASE CPP /nologo /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /FD /c +# ADD CPP /nologo /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /FD /c +# ADD CPP BUILD_INCLUDES EXTRA_DEFINES /D "OUTPUT_LIBNAME_EXPORTS" +# ADD CPP CMAKE_CXX_FLAGS_RELEASE +# ADD CPP CMAKE_CXX_FLAGS # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x409 /d "NDEBUG" @@ -82,8 +85,11 @@ CM_MULTILINE_LIBRARIES # PROP Output_Dir "EXECUTABLE_OUTPUT_PATHDebug" # PROP Intermediate_Dir "Debug" # PROP Target_Dir "" -# ADD BASE CPP /W3 /GR /Zm1000 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /FD /GZ /c -# ADD CPP /nologo /W3 /MDd /GR /Gm /GX /Zm1000 /ZI /Od /D "WIN32" BUILD_INCLUDES EXTRA_DEFINES /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /FD /GZ /c +# ADD BASE CPP /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /FD /c +# ADD CPP /nologo /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /FD /GZ /c +# ADD CPP BUILD_INCLUDES EXTRA_DEFINES /D "OUTPUT_LIBNAME_EXPORTS" +# ADD CPP CMAKE_CXX_FLAGS_DEBUG +# ADD CPP CMAKE_CXX_FLAGS # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x409 /d "_DEBUG" @@ -109,8 +115,11 @@ CM_MULTILINE_LIBRARIES # PROP Output_Dir "EXECUTABLE_OUTPUT_PATHMinSizeRel" # PROP Intermediate_Dir "MinSizeRel" # PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /GR /GX /Zm1000 /O1 /Gs /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /FD /c -# ADD CPP /nologo /MD /W3 /GR /GX /Zm1000 /O1 /Gs /D "WIN32" BUILD_INCLUDES EXTRA_DEFINES /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /FD /c +# ADD BASE CPP /nologo /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /FD /c +# ADD CPP /nologo /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /FD /c +# ADD CPP BUILD_INCLUDES EXTRA_DEFINES /D "OUTPUT_LIBNAME_EXPORTS" +# ADD CPP CMAKE_CXX_FLAGS_MINSIZEREL +# ADD CPP CMAKE_CXX_FLAGS # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe diff --git a/Templates/staticLibHeader.dsptemplate b/Templates/staticLibHeader.dsptemplate index 419f312f5..31640ef17 100644 --- a/Templates/staticLibHeader.dsptemplate +++ b/Templates/staticLibHeader.dsptemplate @@ -52,8 +52,11 @@ RSC=rc.exe # PROP Output_Dir "LIBRARY_OUTPUT_PATHRelease" # PROP Intermediate_Dir "Release" # PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /FD /c -# ADD CPP /nologo /GR /MD /W3 /GX /Zm1000 /O2 BUILD_INCLUDES EXTRA_DEFINES /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /FD /c +# ADD BASE CPP /nologo /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /FD /c +# ADD CPP /nologo /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /FD /c +# ADD CPP BUILD_INCLUDES EXTRA_DEFINES /D "OUTPUT_LIBNAME_EXPORTS" +# ADD CPP CMAKE_CXX_FLAGS_RELEASE +# ADD CPP CMAKE_CXX_FLAGS # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe @@ -75,8 +78,11 @@ LIB32=link.exe -lib # PROP Output_Dir "LIBRARY_OUTPUT_PATHDebug" # PROP Intermediate_Dir "Debug" # PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /GR /GX /Zm1000 /Zi /Od BUILD_INCLUDES EXTRA_DEFINES /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /FD /GZ /c +# ADD BASE CPP /nologo /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /FD /c +# ADD CPP /nologo /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /FD /GZ /c +# ADD CPP BUILD_INCLUDES EXTRA_DEFINES /D "OUTPUT_LIBNAME_EXPORTS" +# ADD CPP CMAKE_CXX_FLAGS_DEBUG +# ADD CPP CMAKE_CXX_FLAGS # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe @@ -97,9 +103,11 @@ LIB32=link.exe -lib # PROP Intermediate_Dir "MinSizeRel" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_DLL" /FD /c -# ADD CPP /nologo /GR /GX /Zm1000 /MD /W3 /O1 BUILD_INCLUDES EXTRA_DEFINES /D "NDEBUG" /D "_MBCS" /D "_ATL_DLL" /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /FD /c -# SUBTRACT CPP /YX /Yc /Yu +# ADD BASE CPP /nologo /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_DLL" /FD /c +# ADD CPP /nologo /D "NDEBUG" /D "_MBCS" /D "_ATL_DLL" /D "WIN32" /D "_WINDOWS" /D "_USRDLL" /FD /c +# ADD CPP BUILD_INCLUDES EXTRA_DEFINES /D "OUTPUT_LIBNAME_EXPORTS" +# ADD CPP CMAKE_CXX_FLAGS_MINSIZEREL +# ADD CPP CMAKE_CXX_FLAGS # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe