diff options
author | Luis Ibanez <luis.ibanez@kitware.com> | 2001-06-15 11:51:55 (GMT) |
---|---|---|
committer | Luis Ibanez <luis.ibanez@kitware.com> | 2001-06-15 11:51:55 (GMT) |
commit | f055e512ae5e6f808e321ca27f3a9bcfd4ba1165 (patch) | |
tree | 4622a1311b8ba443b5cd2bc24a1c31494269d1c9 /Source/FLTKDialog/CMakeSetupGUIImplementation.cxx | |
parent | 38776d829b29d0a317e35bccfc7655c94d8dc04a (diff) | |
download | CMake-f055e512ae5e6f808e321ca27f3a9bcfd4ba1165.zip CMake-f055e512ae5e6f808e321ca27f3a9bcfd4ba1165.tar.gz CMake-f055e512ae5e6f808e321ca27f3a9bcfd4ba1165.tar.bz2 |
ENH: Absolute path to cmake resolved
Diffstat (limited to 'Source/FLTKDialog/CMakeSetupGUIImplementation.cxx')
-rw-r--r-- | Source/FLTKDialog/CMakeSetupGUIImplementation.cxx | 67 |
1 files changed, 46 insertions, 21 deletions
diff --git a/Source/FLTKDialog/CMakeSetupGUIImplementation.cxx b/Source/FLTKDialog/CMakeSetupGUIImplementation.cxx index 08ad2e8..ea91e5f 100644 --- a/Source/FLTKDialog/CMakeSetupGUIImplementation.cxx +++ b/Source/FLTKDialog/CMakeSetupGUIImplementation.cxx @@ -1,14 +1,14 @@ #include "CMakeSetupGUIImplementation.h" -#include "FL/fl_file_chooser.H" -#include "FL/filename.H" -#include "FL/fl_ask.H" +#include "Fl/fl_file_chooser.H" +#include "Fl/filename.H" +#include "Fl/fl_ask.H" #include "cstring" #include "../cmCacheManager.h" #include "../cmMakefile.h" #include <iostream> #include "FLTKPropertyList.h" -#include "FL/fl_draw.H" +#include "Fl/fl_draw.H" #include "../cmake.h" @@ -20,22 +20,6 @@ CMakeSetupGUIImplementation ::CMakeSetupGUIImplementation() { m_BuildPathChanged = false; - -// Construct the full path to cmake executable - -#if defined(_WIN32) - char fname[1024]; - ::GetModuleFileName(NULL,fname,1023); // Didn't found this method. (?) - m_PathToExecutable = cmSystemTools::GetProgramPath(fname).c_str(); - m_PathToExecutable += "/cmake.exe"; -#else - char fullPathToCMake[1024]; - filename_absolute( fullPathToCMake, "../cmake" ); - m_PathToExecutable = fullPathToCMake; -#endif - - std::cout << "Path to CMake executable " << m_PathToExecutable << std::endl; - } @@ -131,6 +115,47 @@ CMakeSetupGUIImplementation /** + * Set path to executable. Used to get the path to CMake + */ +void +CMakeSetupGUIImplementation +::SetPathToExecutable( const char * path ) +{ + m_PathToExecutable = path; + + char expandedPath[1024]; + filename_expand( expandedPath, path ); + + char absolutePath[1024]; + filename_absolute( absolutePath, expandedPath ); + + char * p = absolutePath + strlen( absolutePath ); + while( *p != '/' && *p != '\\' ) + { + p--; + } + p--; + while( *p != '/' && *p != '\\' ) + { + p--; + } + *p = '\0'; + + std::cout << "absolutePath = " << absolutePath << std::endl; + + m_PathToExecutable = absolutePath; + +#if defined(_WIN32) + m_PathToExecutable += "/CMake.exe"; +#else + m_PathToExecutable += "/cmake"; +#endif + std::cout << "Path to CMake executable = " << m_PathToExecutable << std::endl; +} + + + +/** * Set the source path */ bool @@ -358,7 +383,7 @@ CMakeSetupGUIImplementation { cmCacheManager::GetInstance()->LoadCache( m_WhereBuild.c_str() ); this->FillCacheGUIFromCacheManager(); - } + } } |