浏览代码

ENH: CMake now always adds the BUILD_SHARED_LIBS cache entry. The BUILD_SHARED_LIBRARIES command that used to be used is now deprecated.

Brad King 24 年之前
父节点
当前提交
a5087b8cca
共有 2 个文件被更改,包括 14 次插入26 次删除
  1. 3 23
      Source/cmBuildSharedLibrariesCommand.cxx
  2. 11 3
      Source/cmake.cxx

+ 3 - 23
Source/cmBuildSharedLibrariesCommand.cxx

@@ -43,27 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 // cmBuildSharedLibrariesCommand
 bool cmBuildSharedLibrariesCommand::InitialPass(std::vector<std::string>& args)
 {
-  // Now check and see if the value has been stored in the cache
-  // already, if so use that value and don't look for the program
-  const char* cacheValue
-    = cmCacheManager::GetInstance()->GetCacheValue("BUILD_SHARED_LIBS");
-  if(!cacheValue)
-    {
-    cmCacheManager::GetInstance()->
-      AddCacheEntry("BUILD_SHARED_LIBS",
-                    false,
-                    "If ON, the resulting project or makefiles will "
-                    "produce shared libraries.  WARNING! On some "
-                    "UNIX platforms, changing this setting will require"
-                    " removing all .o files, as they will have to be recompiled "
-                    " with -fpic or some other flag.");
-    m_Makefile->AddDefinition("BUILD_SHARED_LIBS", false);
-    }
-  else
-    {
-    m_Makefile->AddDefinition("BUILD_SHARED_LIBS", 
-                              cmCacheManager::
-                              GetInstance()->IsOn("BUILD_SHARED_LIBS"));
-    }
-  return true;
+  this->SetError("This command has been deprecated.  The BUILD_SHARED_LIBS\n"
+                 "cache entry is now always added by CMake.\n");
+  return false;
 }

+ 11 - 3
Source/cmake.cxx

@@ -231,9 +231,11 @@ int cmake::Generate(const std::vector<std::string>& args)
   mf.GenerateMakefile();
   
   // Before saving the cache
-  // if the project did not define LIBRARY_OUTPUT_PATH and
-  // EXECUTABLE_OUTPUT_PATH, add them now, so users
-  // can edit the values in the cache.
+  // if the project did not define one of the entries below, add them now
+  // so users can edit the values in the cache:
+  // LIBRARY_OUTPUT_PATH
+  // EXECUTABLE_OUTPUT_PATH
+  // BUILD_SHARED_LIBS
   if(!cmCacheManager::GetInstance()->GetCacheValue("LIBRARY_OUTPUT_PATH"))
     {
     cmCacheManager::GetInstance()->AddCacheEntry("LIBRARY_OUTPUT_PATH", "",
@@ -246,6 +248,12 @@ int cmake::Generate(const std::vector<std::string>& args)
                                                  "Single output directory for building all executables.",
                                                  cmCacheManager::PATH);
     }
+  if(!cmCacheManager::GetInstance()->GetCacheValue("BUILD_SHARED_LIBS"))
+    {
+    cmCacheManager::GetInstance()->AddCacheEntry("BUILD_SHARED_LIBS", "OFF",
+                                                 "Build with shared libraries.",
+                                                 cmCacheManager::BOOL);
+    } 
   
   
   cmCacheManager::GetInstance()->SaveCache(&mf);