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 /Source/QtDialog | |
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
Diffstat (limited to 'Source/QtDialog')
-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 |
4 files changed, 33 insertions, 5 deletions
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 |