diff --git a/Modules/FindOpenGL.cmake b/Modules/FindOpenGL.cmake index 7bf2bf716..ce0f14afb 100644 --- a/Modules/FindOpenGL.cmake +++ b/Modules/FindOpenGL.cmake @@ -7,9 +7,8 @@ # IF (WIN32) - SET (OPENGL_LIBRARY opengl32 CACHE) + SET (OPENGL_LIBRARY opengl32 CACHE STRING "OpenGL library for win32") ELSE (WIN32) - FIND_PATH(OPENGL_INCLUDE_PATH GL/gl.h /usr/include /usr/local/include @@ -18,7 +17,6 @@ ELSE (WIN32) /usr/X11R6/include ) - FIND_LIBRARY(OPENGL_LIBRARY GL /usr/lib /usr/local/lib diff --git a/Source/MFCDialog/CMakeSetup.rc b/Source/MFCDialog/CMakeSetup.rc index 8be968b55..4688cb8cc 100644 --- a/Source/MFCDialog/CMakeSetup.rc +++ b/Source/MFCDialog/CMakeSetup.rc @@ -104,10 +104,10 @@ BEGIN WS_HSCROLL | WS_TABSTOP CTEXT "Right click on cache entries for additional options", IDC_STATIC,19,190,333,11 - COMBOBOX IDC_WhereBuild,147,25,133,68,CBS_DROPDOWN | WS_VSCROLL | - WS_TABSTOP - COMBOBOX IDC_WhereSource,147,5,133,66,CBS_DROPDOWN | WS_VSCROLL | - WS_TABSTOP + COMBOBOX IDC_WhereBuild,129,26,133,68,CBS_DROPDOWN | + CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_WhereSource,127,6,135,66,CBS_DROPDOWN | + CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP LTEXT "Static",IDC_CMAKE_VERSION,3,211,70,13,SS_CENTERIMAGE END diff --git a/Source/MFCDialog/CMakeSetupDialog.cpp b/Source/MFCDialog/CMakeSetupDialog.cpp index c93e652d8..804496e2a 100644 --- a/Source/MFCDialog/CMakeSetupDialog.cpp +++ b/Source/MFCDialog/CMakeSetupDialog.cpp @@ -137,6 +137,8 @@ BOOL CMakeSetupDialog::OnInitDialog() this->LoadFromRegistry(); // try to load the cmake cache from disk this->LoadCacheFromDiskToGUI(); + m_WhereBuildControl.LimitText(2048); + m_WhereSourceControl.LimitText(2048); // Set the version number char tmp[1024]; sprintf(tmp,"Version %s", cmMakefile::GetVersion()); @@ -435,15 +437,6 @@ void CMakeSetupDialog::OnBuildProjects() CString makefileIn = m_WhereSource; makefileIn += "/CMakeLists.txt"; 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 makefile.GenerateMakefile(); // Save the cache diff --git a/Source/cmSetCommand.cxx b/Source/cmSetCommand.cxx index 5760c8978..e5869a8aa 100644 --- a/Source/cmSetCommand.cxx +++ b/Source/cmSetCommand.cxx @@ -48,67 +48,72 @@ bool cmSetCommand::Invoke(std::vector& args) this->SetError("called with incorrect number of arguments"); return false; } + // SET (VAR ) // this is a no-op if (args.size() == 1) { - return true; + return true; } -// here are the options with the num -// SET VAR -// SET VAR value -// SET VAR CACHE|CACHE_NO_REPLACE -// SET VAR value CACHE|CACHE_NO_REPLACE -// SET VAR CACHE|CACHE_NO_REPLACE TYPE -// SET VAR value CACHE|CACHE_NO_REPLACE TYPE - const char* type = "STRING"; // set a default type of STRING - const char* value = "";// set a default value of the empty string - if(args.size() > 1) +// here are the options +// SET (VAR) +// SET (VAR value ) +// SET (VAR CACHE TYPE "doc String") +// SET (VAR value CACHE TYPE "doc string") + + const char* variable = args[0].c_str(); // VAR is always first + std::string value; // optional + bool cache = false; // optional + 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 - m_Makefile->ExpandVariablesInString(args[1]); - value = args[1].c_str(); + // SET (VAR CACHE TYPE "doc String") + cache = true; + cacheStart = 1; } - // get the current cache value for the variable - const char* cacheValue = - cmCacheManager::GetInstance()->GetCacheValue(args[0].c_str()); - // 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) + else if(args.size() == 5) { - if(args[i] == "CACHE_NO_REPLACE") - { - // if already in cache, ignore entire command - if(cacheValue) - { - return true; - } - cache = true; - } - if(args[i] == "CACHE") - { - cache = true; - } - // if this is to be cached, find the value and type - if(cache) - { - // if this is the - if(i == 1) - { - value = ""; - } - if(i+1 < args.size()) - { - type = args[i+1].c_str(); - } - } + // SET (VAR value CACHE TYPE "doc string") + cache = true; + value = args[1]; + cacheStart = 2; } - 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)); + 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 + const char* cacheValue = + cmCacheManager::GetInstance()->GetCacheValue(variable); + 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; + } + } + // add the definition + m_Makefile->AddDefinition(variable, value.c_str()); + // if it is meant to be in the cache then define it in the cache + if(cache) + { + cmCacheManager::GetInstance()->AddCacheEntry(variable, + value.c_str(), + docstring, + type); } return true; } diff --git a/Source/cmSetCommand.h b/Source/cmSetCommand.h index 45bccbd8b..8a97240ca 100644 --- a/Source/cmSetCommand.h +++ b/Source/cmSetCommand.h @@ -91,8 +91,13 @@ public: virtual const char* GetFullDocumentation() { return - "SET(FOO BAR)\n" - "Within CMAKE sets FOO to the value BAR. BAR is expanded before FOO is set to it."; + "SET(VAR [VALUE] [CACHE TYPE DOCSTRING])\n" + "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); diff --git a/Templates/CMakeSystemConfig.cmake.in b/Templates/CMakeSystemConfig.cmake.in index 95db8c9a5..f7d65ceda 100644 --- a/Templates/CMakeSystemConfig.cmake.in +++ b/Templates/CMakeSystemConfig.cmake.in @@ -2,29 +2,44 @@ # CMakeLocal.make.in should be in the directory where you run configure # 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_USE_SPROC @CMAKE_USE_SPROC@ CACHE_NO_REPLACE BOOL) -SET (CMAKE_USE_PTHREADS @CMAKE_USE_PTHREADS@ CACHE_NO_REPLACE BOOL) -SET (CMAKE_HP_PTHREADS @CMAKE_HP_PTHREADS@ CACHE_NO_REPLACE BOOL) -SET (CMAKE_LIB_EXT @CMAKE_LIB_EXT@ CACHE_NO_REPLACE ) -SET (CMAKE_RANLIB "@RANLIB@" CACHE_NO_REPLACE ) -SET (CMAKE_AR "@CMAKE_AR@" CACHE_NO_REPLACE ) -SET (CMAKE_CXX_COMPILER "@CXX@" CACHE_NO_REPLACE FILEPATH) -SET (CMAKE_CXX_FLAGS "@CXXFLAGS@" CACHE_NO_REPLACE ) -SET (CMAKE_TEMPLATE_FLAGS "@CMAKE_TEMPLATE_FLAGS@" CACHE_NO_REPLACE ) -SET (CMAKE_C_COMPILER "@CC@" CACHE_NO_REPLACE FILEPATH) -SET (CMAKE_C_FLAGS "@CFLAGS@" CACHE_NO_REPLACE ) -SET (CMAKE_SHLIB_CFLAGS "@CMAKE_SHLIB_CFLAGS@" CACHE_NO_REPLACE ) -SET (CMAKE_SHLIB_BUILD_FLAGS "@CMAKE_SHLIB_BUILD_FLAGS@" CACHE_NO_REPLACE ) -SET (CMAKE_SHLIB_SUFFIX @CMAKE_SHLIB_SUFFIX@ CACHE_NO_REPLACE ) -SET (CMAKE_THREAD_LIBS "@CMAKE_THREAD_LIBS@" CACHE_NO_REPLACE ) -SET (CMAKE_DL_LIBS "@CMAKE_DL_LIBS@" CACHE_NO_REPLACE ) -SET (CMAKE_SHLIB_LINK_FLAGS "@CMAKE_SHLIB_LINK_FLAGS@" CACHE_NO_REPLACE ) -SET (CMAKE_SHLIB_LD_LIBS "@CMAKE_SHLIB_LD_LIBS@" CACHE_NO_REPLACE ) -SET (CMAKE_SHLIB_LD_LIBS "@CMAKE_SHLIB_LD_LIBS@" CACHE_NO_REPLACE_NO_REPLACE ) +SET (CMAKE_USE_SPROC @CMAKE_USE_SPROC@ CACHE BOOL "Use sproc libs.") +SET (CMAKE_USE_PTHREADS @CMAKE_USE_PTHREADS@ CACHE BOOL + "Use the pthreads library") +SET (CMAKE_HP_PTHREADS @CMAKE_HP_PTHREADS@ CACHE BOOL + "Use HP pthreads") +SET (CMAKE_LIB_EXT @CMAKE_LIB_EXT@ CACHE STRING + "Library extension used by this machine" ) +SET (CMAKE_RANLIB "@RANLIB@" CACHE FILEPATH + " Library randomizer program used on archive libraries." ) +SET (CMAKE_AR "@CMAKE_AR@" CACHE FILEPATH + " Archive program used to make archive libraries." ) +SET (CMAKE_CXX_COMPILER "@CXX@" CACHE FILEPATH "CXX compiler used.") +SET (CMAKE_CXX_FLAGS "@CXXFLAGS@" CACHE STRING + "Flags used by CXX compiler") +SET (CMAKE_TEMPLATE_FLAGS "@CMAKE_TEMPLATE_FLAGS@" CACHE + "CXX template flags used by compiler") +SET (CMAKE_C_COMPILER "@CC@" CACHE FILEPATH + "C compiler used.") +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 -SET (CMAKE_X_LIBS "@X_PRE_LIBS@ @X_LIBS@ -lX11 -lXext @X_EXTRA_LIBS@" CACHE_NO_REPLACE ) -SET (CMAKE_X_CFLAGS "@X_CFLAGS@" CACHE_NO_REPLACE) -SET (CMAKE_HAS_X "@CMAKE_HAS_X@" CACHE_NO_REPLACE BOOL) +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 STRING "X11 extra flags") +SET (CMAKE_HAS_X "@CMAKE_HAS_X@" ) diff --git a/Templates/CMakeWindowsSystemConfig.cmake b/Templates/CMakeWindowsSystemConfig.cmake index cad970fa0..eeb0c6f4a 100644 --- a/Templates/CMakeWindowsSystemConfig.cmake +++ b/Templates/CMakeWindowsSystemConfig.cmake @@ -5,8 +5,12 @@ 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" CACHE_NO_REPLACE) -SET (CMAKE_CXX_FLAGS "/W3 /Zm1000 /GX /GR" CACHE_NO_REPLACE) +SET (CXX VC++60 ) +SET (CMAKE_CXX_FLAGS_RELEASE "/MD /O2" CACHE STRING + "Flags used by the compiler during release builds") +SET (CMAKE_CXX_FLAGS_MINSIZEREL "/MD /O1" CACHE STRING + "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++")