diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2008-04-04 20:02:50 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2008-04-04 20:02:50 (GMT) |
commit | 45ce11a0757a1006a235f34637892115ffeae66e (patch) | |
tree | be7370a18622502f98d774b00cd5606f3fa2ff72 | |
parent | d1c660d49550af6f174cbfac4ce81bd7d7ce7a75 (diff) | |
download | CMake-45ce11a0757a1006a235f34637892115ffeae66e.zip CMake-45ce11a0757a1006a235f34637892115ffeae66e.tar.gz CMake-45ce11a0757a1006a235f34637892115ffeae66e.tar.bz2 |
ENH: install the mac application bundle into /Applications directly with no enclosing folder
-rw-r--r-- | CMakeLists.txt | 9 | ||||
-rw-r--r-- | Source/QtDialog/CMakeLists.txt | 10 | ||||
-rw-r--r-- | Source/QtDialog/CMakeSetup.cxx | 8 | ||||
-rw-r--r-- | Source/QtDialog/QMacInstallDialog.cxx | 17 | ||||
-rwxr-xr-x | Source/QtDialog/postflight.sh.in | 3 | ||||
-rw-r--r-- | Source/cmFileCommand.cxx | 3 | ||||
-rw-r--r-- | Source/cmake.cxx | 13 |
7 files changed, 53 insertions, 10 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 596c8f4..a54953d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -417,12 +417,13 @@ ENDIF(BUILD_CursesDialog) IF(BUILD_QtDialog) IF(APPLE) - SET(CMAKE_INSTALL_SUBDIR + SET(CMAKE_BUNDLE_NAME "CMake ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}-${CMake_VERSION_PATCH}") IF(CMake_VERSION_DATE) - SET(CMAKE_INSTALL_SUBDIR + SET(CMAKE_BUNDLE_NAME "CMake ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}-${CMake_VERSION_DATE}") ENDIF(CMake_VERSION_DATE) + SET(CMAKE_BUNDLE_LOCATION "${CMAKE_INSTALL_PREFIX}") # make sure CMAKE_INSTALL_PREFIX ends in / STRING(LENGTH "${CMAKE_INSTALL_PREFIX}" LEN) MATH(EXPR LEN "${LEN} -1" ) @@ -430,8 +431,8 @@ IF(BUILD_QtDialog) IF(NOT "${ENDCH}" STREQUAL "/") SET(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/") ENDIF(NOT "${ENDCH}" STREQUAL "/") - SET(CMAKE_BUNDLE_LOCATION "${CMAKE_INSTALL_PREFIX}${CMAKE_INSTALL_SUBDIR}") - SET(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}${CMAKE_INSTALL_SUBDIR}/cmake-gui.app/Contents") + SET(CMAKE_INSTALL_PREFIX + "${CMAKE_INSTALL_PREFIX}${CMAKE_BUNDLE_NAME}.app/Contents") ENDIF(APPLE) SET(QT_NEED_RPATH FALSE) diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt index 2e61c29..de13a7e 100644 --- a/Source/QtDialog/CMakeLists.txt +++ b/Source/QtDialog/CMakeLists.txt @@ -55,6 +55,10 @@ ELSE(NOT QT4_FOUND) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) ADD_EXECUTABLE(cmake-gui WIN32 MACOSX_BUNDLE ${SRCS}) + IF(APPLE) + SET_TARGET_PROPERTIES(cmake-gui PROPERTIES + OUTPUT_NAME ${CMAKE_BUNDLE_NAME}) + ENDIF(APPLE) TARGET_LINK_LIBRARIES(cmake-gui CMakeLib ${QT_QTMAIN_LIBRARY} ${QT_LIBRARIES}) IF(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.4) SET(CMAKE_INSTALL_DESTINATION_ARGS @@ -84,8 +88,10 @@ ELSE(NOT QT4_FOUND) "${CMake_BINARY_DIR}/Source/QtDialog/postflight.sh") configure_file("${CMake_SOURCE_DIR}/Source/QtDialog/postupgrade.sh.in" "${CMake_BINARY_DIR}/Source/QtDialog/postupgrade.sh") - INSTALL(CODE "set(input_file - \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/MacOS/cmake-gui\")") + INSTALL(CODE "execute_process(COMMAND ln -s \"../MacOS/${CMAKE_BUNDLE_NAME}\" cmake-gui + WORKING_DIRECTORY \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/bin)") + INSTALL(CODE "set(input_file + \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/MacOS/${CMAKE_BUNDLE_NAME}\")") INSTALL(SCRIPT "${CMake_SOURCE_DIR}/Source/QtDialog/CMakeIngestOSXBundleLibraries.cmake") ENDIF(APPLE) CONFIGURE_FILE("${QtDialog_SOURCE_DIR}/QtDialogCPack.cmake.in" diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx index bdc8a66..bf78890 100644 --- a/Source/QtDialog/CMakeSetup.cxx +++ b/Source/QtDialog/CMakeSetup.cxx @@ -66,6 +66,7 @@ static const char * cmDocumentationOptions[][3] = int main(int argc, char** argv) { + cmSystemTools::FindExecutableDirectory(argv[0]); QApplication app(argc, argv); // clean out standard Qt paths for plugins, which we don't use anyway @@ -113,7 +114,12 @@ int main(int argc, char** argv) // Construct and print requested documentation. cmake hcm; hcm.AddCMakePaths(); - doc.SetCMakeRoot(hcm.GetCacheDefinition("CMAKE_ROOT")); + // just incase the install is bad avoid a seg fault + const char* root = hcm.GetCacheDefinition("CMAKE_ROOT"); + if(root) + { + doc.SetCMakeRoot(root); + } std::vector<cmDocumentationEntry> commands; std::vector<cmDocumentationEntry> compatCommands; std::map<std::string,cmDocumentationSection *> propDocs; diff --git a/Source/QtDialog/QMacInstallDialog.cxx b/Source/QtDialog/QMacInstallDialog.cxx index 28c2c1a..70293f8 100644 --- a/Source/QtDialog/QMacInstallDialog.cxx +++ b/Source/QtDialog/QMacInstallDialog.cxx @@ -1,4 +1,5 @@ #include "QMacInstallDialog.h" +#include <QMessageBox> #include "cmSystemTools.h" #include <iostream> #include <QFileDialog> @@ -33,6 +34,22 @@ void QMacInstallDialog::DoInstall() { QDir installDir(this->Internals->InstallPrefix->text()); std::string installTo = installDir.path().toStdString(); + if(!cmSystemTools::FileExists(installTo.c_str())) + { + QString message = tr("Build install does not exist, " + "should I create it?") + + "\n\n" + + tr("Directory: "); + message += installDir.path(); + QString title = tr("Create Directory"); + QMessageBox::StandardButton btn; + btn = QMessageBox::information(this, title, message, + QMessageBox::Yes | QMessageBox::No); + if(btn == QMessageBox::Yes) + { + cmSystemTools::MakeDirectory(installTo.c_str()); + } + } QDir cmExecDir(QApplication::applicationDirPath()); cmExecDir.cd("../bin"); QFileInfoList list = cmExecDir.entryInfoList(); diff --git a/Source/QtDialog/postflight.sh.in b/Source/QtDialog/postflight.sh.in index 88dd066..33be352 100755 --- a/Source/QtDialog/postflight.sh.in +++ b/Source/QtDialog/postflight.sh.in @@ -1,4 +1,3 @@ #!/bin/bash -echo "$2/@CMAKE_INSTALL_SUBDIR@/cmake-gui.app/Contents/MacOS/cmake-gui" >>/tmp/mylog -"$2/@CMAKE_INSTALL_SUBDIR@/cmake-gui.app/Contents/MacOS/cmake-gui" --mac-install +"$2@CMAKE_INSTALL_SUBDIR@/@CMAKE_BUNDLE_NAME@.app/Contents/MacOS/@CMAKE_BUNDLE_NAME@" --mac-install exit 0 diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index aa9731b..4aa04e3 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -1244,7 +1244,8 @@ void cmFileCommand bool cmFileCommand::HandleInstallDestination(cmFileInstaller& installer, std::string& destination) { - if ( destination.size() < 2 ) + // allow for / to be a valid destination + if ( destination.size() < 2 && destination != "/" ) { this->SetError("called with inapropriate arguments. " "No DESTINATION provided or ."); diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 5256fd0..5e5859b 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -786,6 +786,19 @@ int cmake::AddCMakePaths() cMakeSelf = cmSystemTools::GetRealPath(cMakeSelf.c_str()); cMakeSelf += "/cmake"; cMakeSelf += cmSystemTools::GetExecutableExtension(); +#if __APPLE__ + // on the apple this might be the gui bundle + if(!cmSystemTools::FileExists(cMakeSelf.c_str())) + { + cMakeSelf = cmSystemTools::GetExecutableDirectory(); + cMakeSelf = cmSystemTools::GetRealPath(cMakeSelf.c_str()); + cMakeSelf += "../../../.."; + cMakeSelf = cmSystemTools::GetRealPath(cMakeSelf.c_str()); + cMakeSelf = cmSystemTools::CollapseFullPath(cMakeSelf.c_str()); + cMakeSelf += "/cmake"; + std::cerr << cMakeSelf.c_str() << "\n"; + } +#endif if(!cmSystemTools::FileExists(cMakeSelf.c_str())) { cmSystemTools::Error("CMake executable cannot be found at ", |