MantisBT - CMake
View Issue Details
0006286CMakeQtDialogpublic2008-01-29 16:032008-02-20 08:34
Mike Jackson 
Clinton Stimpson 
normalmajoralways
closedfixed 
 
 
0006286: QtDialog does not properly find cmake on OS X
QtDialog properly sets the path to cmake in the constructor of QCmake.cxx. During the 'configure' operation, when cmake::AddPaths() is called the value of this->CMakeCommand is NOT checked first for a valid path and instead a new incorrect path is constructed. This blocks the QtDialog from being used on a daily basis. This will effect OS X systems. Suggested code to fix issue is in additional Information.
In the cmake.cxx file the top of the AddPaths() method should be changed to the following:

// at the end of this CMAKE_ROOT and CMAKE_COMMAND should be added to the
// cache
int cmake::AddCMakePaths()
{
  std::string cMakeSelf = this->CMakeCommand;
  if ( cMakeSelf.empty() == true)
    {
    // Find the cmake executable
    cMakeSelf = cmSystemTools::GetExecutableDirectory();
    cMakeSelf += "/cmake";
    cMakeSelf += cmSystemTools::GetExecutableExtension();
    std::cout << "cmake::AddCMakePaths() cMakeSelf: " << cMakeSelf << std::endl;
    if(!cmSystemTools::FileExists(cMakeSelf.c_str()))
      {
      cmSystemTools::Error("CMake executable cannot be found at ",
                           cMakeSelf.c_str());
      return 0;
      }
    }


No tags attached.
Issue History
2008-01-29 16:03Mike JacksonNew Issue
2008-01-29 16:06Mike JacksonNote Added: 0010334
2008-02-06 11:24Clinton StimpsonNote Added: 0010396
2008-02-06 13:16Alex NeundorfAssigned To => Clinton Stimpson
2008-02-06 13:16Alex NeundorfStatusnew => assigned
2008-02-06 14:47Clinton StimpsonNote Added: 0010400
2008-02-18 16:17Clinton StimpsonStatusassigned => closed
2008-02-18 16:17Clinton StimpsonNote Added: 0010550
2008-02-18 16:17Clinton StimpsonResolutionopen => fixed
2008-02-20 08:34Mike JacksonNote Added: 0010597

Notes
(0010334)
Mike Jackson   
2008-01-29 16:06   
The following should be added to the CMakeLists.txt file in the QtDialog directory.

    IF (APPLE)
        MESSAGE (STATUS "HELLO HELLO")
        FILE(MAKE_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}/QtDialog.app/Contents/bin)
        SET (QTDIALOG_OS_X_BUNDLE_FILES
          ccmake cmake cmakexbuild cpack ctest DumpDocumentation OSXScriptLauncher
        )
    
        FOREACH ( _file ${QTDIALOG_OS_X_BUNDLE_FILES} )
           SET (dest "${EXECUTABLE_OUTPUT_PATH}/QtDialog.app/Contents/bin/${_file}")
           MESSAGE(STATUS " Copying ${dest}")
           ADD_CUSTOM_COMMAND (
             TARGET QtDialog
             POST_BUILD
             COMMAND ${CMAKE_COMMAND}
             ARGS -E copy ${EXECUTABLE_OUTPUT_PATH}/${_file} ${dest}
             )
             
        ENDFOREACH ( _file ${QTDIALOG_OS_X_BUNDLE_FILES} )
    ENDIF (APPLE)

This will ensure the binaries are properly copied into the Application bundle.
(0010396)
Clinton Stimpson   
2008-02-06 11:24   
I tried that patch for cmake.cxx, and it works if you always run QtDialog, but the makefile breaks if you have the makefile do a cmake run.

One idea would be to have all the cmake apps call SetCMakeCommand with a full path (some do and some don't).

Then the suggested cmake.cxx patch could be simplified, and just throw an error if CMakeCommand isn't set correctly.
(0010400)
Clinton Stimpson   
2008-02-06 14:47   
I actually changed Source/QtDialog/CMakeSetup.cxx (revision 1.12), so it reports to the cmake library the correct location of the cmake executables dir. There's no need to patch cmake.cxx.
(0010550)
Clinton Stimpson   
2008-02-18 16:17   
The finding of cmake was fixed.
If you still have a problem with deployment, please make a separate bug for it.
Someone else appears to have been working on that.
(0010597)
Mike Jackson   
2008-02-20 08:34   
The latest CMake does indeed properly find cmake now.