ENH: change the syntax of the SET command, fix the combo box for larger strings

This commit is contained in:
Bill Hoffman 2001-05-24 12:57:33 -04:00
parent ad92f34fea
commit 5731bc9d54
7 changed files with 118 additions and 98 deletions

View File

@ -7,9 +7,8 @@
# #
IF (WIN32) IF (WIN32)
SET (OPENGL_LIBRARY opengl32 CACHE) SET (OPENGL_LIBRARY opengl32 CACHE STRING "OpenGL library for win32")
ELSE (WIN32) ELSE (WIN32)
FIND_PATH(OPENGL_INCLUDE_PATH GL/gl.h FIND_PATH(OPENGL_INCLUDE_PATH GL/gl.h
/usr/include /usr/include
/usr/local/include /usr/local/include
@ -18,7 +17,6 @@ ELSE (WIN32)
/usr/X11R6/include /usr/X11R6/include
) )
FIND_LIBRARY(OPENGL_LIBRARY GL FIND_LIBRARY(OPENGL_LIBRARY GL
/usr/lib /usr/lib
/usr/local/lib /usr/local/lib

View File

@ -104,10 +104,10 @@ BEGIN
WS_HSCROLL | WS_TABSTOP WS_HSCROLL | WS_TABSTOP
CTEXT "Right click on cache entries for additional options", CTEXT "Right click on cache entries for additional options",
IDC_STATIC,19,190,333,11 IDC_STATIC,19,190,333,11
COMBOBOX IDC_WhereBuild,147,25,133,68,CBS_DROPDOWN | WS_VSCROLL | COMBOBOX IDC_WhereBuild,129,26,133,68,CBS_DROPDOWN |
WS_TABSTOP CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_WhereSource,147,5,133,66,CBS_DROPDOWN | WS_VSCROLL | COMBOBOX IDC_WhereSource,127,6,135,66,CBS_DROPDOWN |
WS_TABSTOP CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
LTEXT "Static",IDC_CMAKE_VERSION,3,211,70,13,SS_CENTERIMAGE LTEXT "Static",IDC_CMAKE_VERSION,3,211,70,13,SS_CENTERIMAGE
END END

View File

@ -137,6 +137,8 @@ BOOL CMakeSetupDialog::OnInitDialog()
this->LoadFromRegistry(); this->LoadFromRegistry();
// try to load the cmake cache from disk // try to load the cmake cache from disk
this->LoadCacheFromDiskToGUI(); this->LoadCacheFromDiskToGUI();
m_WhereBuildControl.LimitText(2048);
m_WhereSourceControl.LimitText(2048);
// Set the version number // Set the version number
char tmp[1024]; char tmp[1024];
sprintf(tmp,"Version %s", cmMakefile::GetVersion()); sprintf(tmp,"Version %s", cmMakefile::GetVersion());
@ -435,15 +437,6 @@ void CMakeSetupDialog::OnBuildProjects()
CString makefileIn = m_WhereSource; CString makefileIn = m_WhereSource;
makefileIn += "/CMakeLists.txt"; makefileIn += "/CMakeLists.txt";
makefile.ReadListFile(makefileIn); makefile.ReadListFile(makefileIn);
if(!cmCacheManager::GetInstance()->GetCacheValue("CMAKE_CXX"))
{
if(!makefile.GetDefinition("CMAKE_CXX"))
{
makefile.AddDefinition("CMAKE_CXX", "VC60");
}
cmCacheManager::GetInstance()->AddCacheEntry("CMAKE_CXX", "VC60",
"Compiler used", cmCacheManager::STRING);
}
// Generate the project files // Generate the project files
makefile.GenerateMakefile(); makefile.GenerateMakefile();
// Save the cache // Save the cache

View File

@ -48,67 +48,72 @@ bool cmSetCommand::Invoke(std::vector<std::string>& args)
this->SetError("called with incorrect number of arguments"); this->SetError("called with incorrect number of arguments");
return false; return false;
} }
// SET (VAR ) // this is a no-op
if (args.size() == 1) if (args.size() == 1)
{ {
return true; return true;
} }
// here are the options with the num // here are the options
// SET VAR // SET (VAR)
// SET VAR value // SET (VAR value )
// SET VAR CACHE|CACHE_NO_REPLACE // SET (VAR CACHE TYPE "doc String")
// SET VAR value CACHE|CACHE_NO_REPLACE // SET (VAR value CACHE TYPE "doc string")
// SET VAR CACHE|CACHE_NO_REPLACE TYPE
// SET VAR value CACHE|CACHE_NO_REPLACE TYPE const char* variable = args[0].c_str(); // VAR is always first
const char* type = "STRING"; // set a default type of STRING std::string value; // optional
const char* value = "";// set a default value of the empty string bool cache = false; // optional
if(args.size() > 1) cmCacheManager::CacheEntryType type = cmCacheManager::STRING; // required if cache
const char* docstring = 0; // required if cache
std::string::size_type cacheStart = 0;
if(args.size() == 4)
{ {
// always expand the first argument // SET (VAR CACHE TYPE "doc String")
m_Makefile->ExpandVariablesInString(args[1]); cache = true;
value = args[1].c_str(); cacheStart = 1;
} }
else if(args.size() == 5)
{
// SET (VAR value CACHE TYPE "doc string")
cache = true;
value = args[1];
cacheStart = 2;
}
if(cache)
{
if(args[cacheStart] != "CACHE")
{
std::string error = "Error in arguments to cache, expected CACHE found:";
error += args[cacheStart];
this->SetError(error.c_str());
return false;
}
type = cmCacheManager::StringToType(args[cacheStart+1].c_str());
docstring = args[cacheStart+2].c_str();
}
// always expand the first argument
m_Makefile->ExpandVariablesInString(value);
// get the current cache value for the variable // get the current cache value for the variable
const char* cacheValue = const char* cacheValue =
cmCacheManager::GetInstance()->GetCacheValue(args[0].c_str()); cmCacheManager::GetInstance()->GetCacheValue(variable);
// assume this will not be cached
bool cache = false;
// search the arguments for key words CACHE and CACHE_NO_REPLACE
for(int i = 1; i < args.size() && !cache; ++i)
{
if(args[i] == "CACHE_NO_REPLACE")
{
// if already in cache, ignore entire command
if(cacheValue) if(cacheValue)
{
// if it is not a cached value, or it is a cached
// value that is not internal keep the value found
// in the cache
if(cache && type != cmCacheManager::INTERNAL)
{ {
return true; return true;
} }
cache = true;
} }
if(args[i] == "CACHE") // add the definition
{ m_Makefile->AddDefinition(variable, value.c_str());
cache = true; // if it is meant to be in the cache then define it in the cache
}
// if this is to be cached, find the value and type
if(cache) if(cache)
{ {
// if this is the cmCacheManager::GetInstance()->AddCacheEntry(variable,
if(i == 1) value.c_str(),
{ docstring,
value = ""; type);
}
if(i+1 < args.size())
{
type = args[i+1].c_str();
}
}
}
m_Makefile->AddDefinition(args[0].c_str(), value);
if(cache)
{
cmCacheManager::GetInstance()->AddCacheEntry(args[0].c_str(),
value,
"Value Computed by CMake",
cmCacheManager::StringToType(type));
} }
return true; return true;
} }

View File

@ -91,8 +91,13 @@ public:
virtual const char* GetFullDocumentation() virtual const char* GetFullDocumentation()
{ {
return return
"SET(FOO BAR)\n" "SET(VAR [VALUE] [CACHE TYPE DOCSTRING])\n"
"Within CMAKE sets FOO to the value BAR. BAR is expanded before FOO is set to it."; "Within CMAKE sets VAR to the value VALUE. VALUE is expanded before VAR "
"is set to it. If CACHE is present, then the VAR is put in the cache."
" TYPE and DOCSTRING are required. If TYPE is INTERNAL, then the "
" VALUE is Always written into the cache, replacing any values "
"existing in the cache. If it is not a CACHE VAR, then this always "
"writes into the current makefile.";
} }
cmTypeMacro(cmSetCommand, cmCommand); cmTypeMacro(cmSetCommand, cmCommand);

View File

@ -2,29 +2,44 @@
# CMakeLocal.make.in should be in the directory where you run configure # CMakeLocal.make.in should be in the directory where you run configure
# in, which need not be the source directory # in, which need not be the source directory
# #
SET (CMAKE_INSTALL_PREFIX @prefix@ CACHE_NO_REPLACE PATH) SET (CMAKE_INSTALL_PREFIX @prefix@ CACHE PATH
"Install path prefix, prepended onto install directories")
SET (CMAKE_WORDS_BIGENDIAN @CMAKE_WORDS_BIGENDIAN@ ) SET (CMAKE_WORDS_BIGENDIAN @CMAKE_WORDS_BIGENDIAN@ )
SET (CMAKE_USE_SPROC @CMAKE_USE_SPROC@ CACHE_NO_REPLACE BOOL) SET (CMAKE_USE_SPROC @CMAKE_USE_SPROC@ CACHE BOOL "Use sproc libs.")
SET (CMAKE_USE_PTHREADS @CMAKE_USE_PTHREADS@ CACHE_NO_REPLACE BOOL) SET (CMAKE_USE_PTHREADS @CMAKE_USE_PTHREADS@ CACHE BOOL
SET (CMAKE_HP_PTHREADS @CMAKE_HP_PTHREADS@ CACHE_NO_REPLACE BOOL) "Use the pthreads library")
SET (CMAKE_LIB_EXT @CMAKE_LIB_EXT@ CACHE_NO_REPLACE ) SET (CMAKE_HP_PTHREADS @CMAKE_HP_PTHREADS@ CACHE BOOL
SET (CMAKE_RANLIB "@RANLIB@" CACHE_NO_REPLACE ) "Use HP pthreads")
SET (CMAKE_AR "@CMAKE_AR@" CACHE_NO_REPLACE ) SET (CMAKE_LIB_EXT @CMAKE_LIB_EXT@ CACHE STRING
SET (CMAKE_CXX_COMPILER "@CXX@" CACHE_NO_REPLACE FILEPATH) "Library extension used by this machine" )
SET (CMAKE_CXX_FLAGS "@CXXFLAGS@" CACHE_NO_REPLACE ) SET (CMAKE_RANLIB "@RANLIB@" CACHE FILEPATH
SET (CMAKE_TEMPLATE_FLAGS "@CMAKE_TEMPLATE_FLAGS@" CACHE_NO_REPLACE ) " Library randomizer program used on archive libraries." )
SET (CMAKE_C_COMPILER "@CC@" CACHE_NO_REPLACE FILEPATH) SET (CMAKE_AR "@CMAKE_AR@" CACHE FILEPATH
SET (CMAKE_C_FLAGS "@CFLAGS@" CACHE_NO_REPLACE ) " Archive program used to make archive libraries." )
SET (CMAKE_SHLIB_CFLAGS "@CMAKE_SHLIB_CFLAGS@" CACHE_NO_REPLACE ) SET (CMAKE_CXX_COMPILER "@CXX@" CACHE FILEPATH "CXX compiler used.")
SET (CMAKE_SHLIB_BUILD_FLAGS "@CMAKE_SHLIB_BUILD_FLAGS@" CACHE_NO_REPLACE ) SET (CMAKE_CXX_FLAGS "@CXXFLAGS@" CACHE STRING
SET (CMAKE_SHLIB_SUFFIX @CMAKE_SHLIB_SUFFIX@ CACHE_NO_REPLACE ) "Flags used by CXX compiler")
SET (CMAKE_THREAD_LIBS "@CMAKE_THREAD_LIBS@" CACHE_NO_REPLACE ) SET (CMAKE_TEMPLATE_FLAGS "@CMAKE_TEMPLATE_FLAGS@" CACHE
SET (CMAKE_DL_LIBS "@CMAKE_DL_LIBS@" CACHE_NO_REPLACE ) "CXX template flags used by compiler")
SET (CMAKE_SHLIB_LINK_FLAGS "@CMAKE_SHLIB_LINK_FLAGS@" CACHE_NO_REPLACE ) SET (CMAKE_C_COMPILER "@CC@" CACHE FILEPATH
SET (CMAKE_SHLIB_LD_LIBS "@CMAKE_SHLIB_LD_LIBS@" CACHE_NO_REPLACE ) "C compiler used.")
SET (CMAKE_SHLIB_LD_LIBS "@CMAKE_SHLIB_LD_LIBS@" CACHE_NO_REPLACE_NO_REPLACE ) SET (CMAKE_C_FLAGS "@CFLAGS@" CACHE STRING "C compiler flags")
SET (CMAKE_SHLIB_CFLAGS "@CMAKE_SHLIB_CFLAGS@" CACHE STRING
"Flag used for building shared library objects" )
SET (CMAKE_SHLIB_BUILD_FLAGS "@CMAKE_SHLIB_BUILD_FLAGS@" CACHE STRING
"Flag used by CXX to build a shared library")
SET (CMAKE_SHLIB_SUFFIX @CMAKE_SHLIB_SUFFIX@ CACHE STRING
"Shared library suffix")
SET (CMAKE_THREAD_LIBS "@CMAKE_THREAD_LIBS@" CACHE STRING
"Thread library used")
SET (CMAKE_DL_LIBS "@CMAKE_DL_LIBS@" CACHE STRING
"Dynamic link library to link in.")
SET (CMAKE_SHLIB_LINK_FLAGS "@CMAKE_SHLIB_LINK_FLAGS@" CACHE STRING
"Flags used to link a shared library.")
SET (CMAKE_SHLIB_LD_LIBS "@CMAKE_SHLIB_LD_LIBS@" CACHE STRING
"Libraries used by LD for shared libraries")
# support for X11 # support for X11
SET (CMAKE_X_LIBS "@X_PRE_LIBS@ @X_LIBS@ -lX11 -lXext @X_EXTRA_LIBS@" CACHE_NO_REPLACE ) SET (CMAKE_X_LIBS "@X_PRE_LIBS@ @X_LIBS@ -lX11 -lXext @X_EXTRA_LIBS@" CACHE STRING "Libraries and options used in X11 programs")
SET (CMAKE_X_CFLAGS "@X_CFLAGS@" CACHE_NO_REPLACE) SET (CMAKE_X_CFLAGS "@X_CFLAGS@" CACHE STRING "X11 extra flags")
SET (CMAKE_HAS_X "@CMAKE_HAS_X@" CACHE_NO_REPLACE BOOL) SET (CMAKE_HAS_X "@CMAKE_HAS_X@" )

View File

@ -5,8 +5,12 @@
SET (WORDS_BIGENDIAN ) SET (WORDS_BIGENDIAN )
SET (HAVE_LIMITS_H 1) SET (HAVE_LIMITS_H 1)
SET (HAVE_UNISTD_H 1) SET (HAVE_UNISTD_H 1)
SET (CXX VC++60) SET (CXX VC++60 )
SET (CMAKE_CXX_FLAGS_RELEASE "/MD /O2" CACHE_NO_REPLACE) SET (CMAKE_CXX_FLAGS_RELEASE "/MD /O2" CACHE STRING
SET (CMAKE_CXX_FLAGS_MINSIZEREL "/MD /O1" CACHE_NO_REPLACE) "Flags used by the compiler during release builds")
SET (CMAKE_CXX_FLAGS_DEBUG "/MDd /Zi /Od /GZ" CACHE_NO_REPLACE) SET (CMAKE_CXX_FLAGS_MINSIZEREL "/MD /O1" CACHE STRING
SET (CMAKE_CXX_FLAGS "/W3 /Zm1000 /GX /GR" CACHE_NO_REPLACE) "Flags used by the compiler during release minsize builds")
SET (CMAKE_CXX_FLAGS_DEBUG "/MDd /Zi /Od /GZ" CACHE STRING
"Flags used by the compiler during debug builds")
SET (CMAKE_CXX_FLAGS "/W3 /Zm1000 /GX /GR" CACHE STRING
"Flags used by the compiler during all build types, /GX /GR are for exceptions and rtti in VC++")