From 3f532f54897d300e17d35630d3d6ba15a719bd27 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Mon, 6 Mar 2006 15:14:23 -0500 Subject: ENH: add support for language flags at rule expansion time --- Modules/CMakeCInformation.cmake | 2 +- Modules/CMakeCXXInformation.cmake | 2 +- Modules/CMakeFortranInformation.cmake | 2 +- Modules/Platform/CYGWIN.cmake | 8 ++++---- Source/cmLocalGenerator.cxx | 4 ++++ Source/cmLocalGenerator.h | 1 + Source/cmMakefileLibraryTargetGenerator.cxx | 6 +++++- 7 files changed, 17 insertions(+), 8 deletions(-) diff --git a/Modules/CMakeCInformation.cmake b/Modules/CMakeCInformation.cmake index 6f9e995..242d796 100644 --- a/Modules/CMakeCInformation.cmake +++ b/Modules/CMakeCInformation.cmake @@ -86,7 +86,7 @@ INCLUDE(CMakeCommonLanguageInclude) # create a C shared library IF(NOT CMAKE_C_CREATE_SHARED_LIBRARY) SET(CMAKE_C_CREATE_SHARED_LIBRARY - " -o ") + " -o ") ENDIF(NOT CMAKE_C_CREATE_SHARED_LIBRARY) # create a C shared module just copy the shared library rule diff --git a/Modules/CMakeCXXInformation.cmake b/Modules/CMakeCXXInformation.cmake index 60a30f8..6e16e4a 100644 --- a/Modules/CMakeCXXInformation.cmake +++ b/Modules/CMakeCXXInformation.cmake @@ -137,7 +137,7 @@ INCLUDE(CMakeCommonLanguageInclude) # create a shared C++ library IF(NOT CMAKE_CXX_CREATE_SHARED_LIBRARY) SET(CMAKE_CXX_CREATE_SHARED_LIBRARY - " -o ") + " -o ") ENDIF(NOT CMAKE_CXX_CREATE_SHARED_LIBRARY) # create a c++ shared module copy the shared library rule by default diff --git a/Modules/CMakeFortranInformation.cmake b/Modules/CMakeFortranInformation.cmake index b340019..9dd0649 100644 --- a/Modules/CMakeFortranInformation.cmake +++ b/Modules/CMakeFortranInformation.cmake @@ -102,7 +102,7 @@ INCLUDE(CMakeCommonLanguageInclude) # create a Fortran shared library IF(NOT CMAKE_Fortran_CREATE_SHARED_LIBRARY) SET(CMAKE_Fortran_CREATE_SHARED_LIBRARY - " -o ") + " -o ") ENDIF(NOT CMAKE_Fortran_CREATE_SHARED_LIBRARY) # create a Fortran shared module just copy the shared library rule diff --git a/Modules/Platform/CYGWIN.cmake b/Modules/Platform/CYGWIN.cmake index 5cd1a55..5419527 100644 --- a/Modules/Platform/CYGWIN.cmake +++ b/Modules/Platform/CYGWIN.cmake @@ -19,12 +19,12 @@ SET(CMAKE_FIND_LIBRARY_PREFIXES "cyg" "lib") SET(CMAKE_FIND_LIBRARY_SUFFIXES ".dll" ".dll.a" ".a") SET(CMAKE_C_CREATE_SHARED_MODULE - " -o ") + " -o ") SET(CMAKE_CXX_CREATE_SHARED_MODULE - " -o ") + " -o ") SET(CMAKE_C_CREATE_SHARED_LIBRARY - " -o -Wl,--out-implib, ") + " -o -Wl,--out-implib, ") SET(CMAKE_CXX_CREATE_SHARED_LIBRARY - " -o -Wl,--out-implib, ") + " -o -Wl,--out-implib, ") INCLUDE(Platform/UnixPaths) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 032e57d..107404c 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -604,6 +604,10 @@ cmLocalGenerator::ExpandRuleVariable(std::string const& variable, return targetQuoted; } } + if(variable == "LANGUAGE_COMPILE_FLAGS") + { + return replaceValues.LanguageCompileFlags; + } if(variable == "TARGET") { return replaceValues.Target; diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index d28917a..0323913 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -196,6 +196,7 @@ public: const char* TargetSOName; const char* TargetInstallNameDir; const char* LinkFlags; + const char* LanguageCompileFlags; }; protected: diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index a5b6154..ade1696 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -431,7 +431,11 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules vars.TargetInstallNameDir = install_name_dir.c_str(); } } - + std::string langFlags; + this->LocalGenerator + ->AddLanguageFlags(langFlags, linkLanguage, + this->LocalGenerator->m_ConfigurationName.c_str()); + vars.LanguageCompileFlags = langFlags.c_str(); // Expand placeholders in the commands. this->LocalGenerator->m_TargetImplib = targetOutPathImport; for(std::vector::iterator i = commands.begin(); -- cgit v0.12