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

This commit is contained in:
Brad King 2001-06-19 15:50:39 -04:00
parent 7a3af0474d
commit a5087b8cca
2 changed files with 14 additions and 26 deletions

View File

@ -43,27 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// cmBuildSharedLibrariesCommand // cmBuildSharedLibrariesCommand
bool cmBuildSharedLibrariesCommand::InitialPass(std::vector<std::string>& args) bool cmBuildSharedLibrariesCommand::InitialPass(std::vector<std::string>& args)
{ {
// Now check and see if the value has been stored in the cache this->SetError("This command has been deprecated. The BUILD_SHARED_LIBS\n"
// already, if so use that value and don't look for the program "cache entry is now always added by CMake.\n");
const char* cacheValue return false;
= 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;
} }

View File

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