diff options
103 files changed, 1900 insertions, 805 deletions
@@ -1,2 +1,7 @@ # Exclude MacOS Finder files. .DS_Store + +*.user* + +*.pyc +Testing diff --git a/CMakeCPack.cmake b/CMakeCPack.cmake index 4d7c6fd..47bb7cf 100644 --- a/CMakeCPack.cmake +++ b/CMakeCPack.cmake @@ -190,31 +190,6 @@ if(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake") set(CPACK_PACKAGE_EXECUTABLES "ccmake" "CMake") endif() - # cygwin specific packaging stuff - if(CYGWIN) - # setup the cygwin package name - set(CPACK_PACKAGE_NAME cmake) - # setup the name of the package for cygwin cmake-2.4.3 - set(CPACK_PACKAGE_FILE_NAME - "${CPACK_PACKAGE_NAME}-${CMake_VERSION}") - # the source has the same name as the binary - set(CPACK_SOURCE_PACKAGE_FILE_NAME ${CPACK_PACKAGE_FILE_NAME}) - # Create a cygwin version number in case there are changes for cygwin - # that are not reflected upstream in CMake - set(CPACK_CYGWIN_PATCH_NUMBER 1 CACHE STRING "patch number for CMake cygwin packages") - mark_as_advanced(CPACK_CYGWIN_PATCH_NUMBER) - # These files are required by the cmCPackCygwinSourceGenerator and the files - # put into the release tar files. - set(CPACK_CYGWIN_BUILD_SCRIPT - "${CMake_BINARY_DIR}/${CPACK_PACKAGE_FILE_NAME}-${CPACK_CYGWIN_PATCH_NUMBER}.sh") - set(CPACK_CYGWIN_PATCH_FILE - "${CMake_BINARY_DIR}/${CPACK_PACKAGE_FILE_NAME}-${CPACK_CYGWIN_PATCH_NUMBER}.patch") - # include the sub directory cmake file for cygwin that - # configures some files and adds some install targets - # this file uses some of the package file name variables - include(Utilities/Release/Cygwin/CMakeLists.txt) - endif() - set(CPACK_WIX_UPGRADE_GUID "8ffd1d72-b7f1-11e2-8ee5-00238bca4991") if(MSVC AND NOT "$ENV{WIX}" STREQUAL "") diff --git a/Help/command/export.rst b/Help/command/export.rst index 4419dc1..53675a7 100644 --- a/Help/command/export.rst +++ b/Help/command/export.rst @@ -55,3 +55,18 @@ build tree. In some cases, for example for packaging and for system wide installations, it is not desirable to write the user package registry. If the :variable:`CMAKE_EXPORT_NO_PACKAGE_REGISTRY` variable is enabled, the ``export(PACKAGE)`` command will do nothing. + +:: + + export(TARGETS [target1 [target2 [...]]] [ANDROID_MK <filename>]) + +This signature exports cmake built targets to the android ndk build system +by creating an Android.mk file that references the prebuilt targets. The +Android NDK supports the use of prebuilt libraries, both static and shared. +This allows cmake to build the libraries of a project and make them available +to an ndk build system complete with transitive dependencies, include flags +and defines required to use the libraries. The signature takes a list of +targets and puts them in the Android.mk file specified by the ``<filename>`` +given. This signature can only be used if policy CMP0022 is NEW for all +targets given. A error will be issued if that policy is set to OLD for one +of the targets. diff --git a/Help/command/file.rst b/Help/command/file.rst index 256d16d..f8727f0 100644 --- a/Help/command/file.rst +++ b/Help/command/file.rst @@ -222,6 +222,9 @@ Options to both ``DOWNLOAD`` and ``UPLOAD`` are: ``TIMEOUT <seconds>`` Terminate the operation after a given total time has elapsed. +``USERPWD <username>:<password>`` + Set username and password for operation. + Additional options to ``DOWNLOAD`` are: ``EXPECTED_HASH ALGO=<value>`` diff --git a/Help/command/install.rst b/Help/command/install.rst index aaf12cc..d57dd75 100644 --- a/Help/command/install.rst +++ b/Help/command/install.rst @@ -314,7 +314,8 @@ Installing Exports :: install(EXPORT <export-name> DESTINATION <dir> - [NAMESPACE <namespace>] [FILE <name>.cmake] + [NAMESPACE <namespace>] [[FILE <name>.cmake]| + [EXPORT_ANDROID_MK <name>.mk]] [PERMISSIONS permissions...] [CONFIGURATIONS [Debug|Release|...]] [EXPORT_LINK_INTERFACE_LIBRARIES] @@ -342,6 +343,13 @@ specified that does not match that given to the targets associated with included in the export but a target to which it links is not included the behavior is unspecified. +In additon to cmake language files, the ``EXPORT_ANDROID_MK`` option maybe +used to specifiy an export to the android ndk build system. The Android +NDK supports the use of prebuilt libraries, both static and shared. This +allows cmake to build the libraries of a project and make them available +to an ndk build system complete with transitive dependencies, include flags +and defines required to use the libraries. + The ``EXPORT`` form is useful to help outside projects use targets built and installed by the current project. For example, the code @@ -349,9 +357,11 @@ and installed by the current project. For example, the code install(TARGETS myexe EXPORT myproj DESTINATION bin) install(EXPORT myproj NAMESPACE mp_ DESTINATION lib/myproj) + install(EXPORT_ANDROID_MK myexp DESTINATION share/ndk-modules) will install the executable myexe to ``<prefix>/bin`` and code to import -it in the file ``<prefix>/lib/myproj/myproj.cmake``. An outside project +it in the file ``<prefix>/lib/myproj/myproj.cmake`` and +``<prefix>/lib/share/ndk-modules/Android.mk``. An outside project may load this file with the include command and reference the ``myexe`` executable from the installation tree using the imported target name ``mp_myexe`` as if the target were built in its own tree. diff --git a/Help/command/separate_arguments.rst b/Help/command/separate_arguments.rst index 0e3e5a5..1fd3cd1 100644 --- a/Help/command/separate_arguments.rst +++ b/Help/command/separate_arguments.rst @@ -13,19 +13,21 @@ entire command line must be given in one "<args>" argument. The ``UNIX_COMMAND`` mode separates arguments by unquoted whitespace. It recognizes both single-quote and double-quote pairs. A backslash -escapes the next literal character (\" is "); there are no special -escapes (\n is just n). +escapes the next literal character (``\"`` is ``"``); there are no special +escapes (``\n`` is just ``n``). The ``WINDOWS_COMMAND`` mode parses a windows command-line using the same syntax the runtime library uses to construct argv at startup. It separates arguments by whitespace that is not double-quoted. Backslashes are literal unless they precede double-quotes. See the -MSDN article "Parsing C Command-Line Arguments" for details. +MSDN article `Parsing C Command-Line Arguments`_ for details. + +.. _`Parsing C Command-Line Arguments`: https://msdn.microsoft.com/library/a1y7w461.aspx :: - separate_arguments(VARIABLE) + separate_arguments(<var>) -Convert the value of ``VARIABLE`` to a semi-colon separated list. All +Convert the value of ``<var>`` to a semi-colon separated list. All spaces are replaced with ';'. This helps with generating command lines. diff --git a/Help/command/string.rst b/Help/command/string.rst index 19a095a..8028333 100644 --- a/Help/command/string.rst +++ b/Help/command/string.rst @@ -278,12 +278,14 @@ specifiers: %I The hour on a 12-hour clock (01-12). %j The day of the current year (001-366). %m The month of the current year (01-12). + %b Abbreviated month name (e.g. Oct). %M The minute of the current hour (00-59). %s Seconds since midnight (UTC) 1-Jan-1970 (UNIX time). %S The second of the current minute. 60 represents a leap second. (00-60) %U The week number of the current year (00-53). %w The day of the current week. 0 is Sunday. (0-6) + %a Abbreviated weekday name (e.g. Fri). %y The last two digits of the current year (00-99) %Y The current year. diff --git a/Help/release/dev/add_androidmk_generator.rst b/Help/release/dev/add_androidmk_generator.rst new file mode 100644 index 0000000..dd7867c --- /dev/null +++ b/Help/release/dev/add_androidmk_generator.rst @@ -0,0 +1,10 @@ +add_androidmk_generator +----------------------- + +* The :command:`install` command gained an ``EXPORT_ANDROID_MK`` + subcommand to install ``Android.mk`` files referencing installed + libraries as prebuilts for the Android NDK build system. + +* The :command:`export` command gained an ``ANDROID_MK`` option + to generate ``Android.mk`` files referencing CMake-built + libraries as prebuilts for the Android NDK build system. diff --git a/Help/release/dev/bzip2-imported-targets.rst b/Help/release/dev/bzip2-imported-targets.rst new file mode 100644 index 0000000..be58b96 --- /dev/null +++ b/Help/release/dev/bzip2-imported-targets.rst @@ -0,0 +1,4 @@ +bzip2-imported-targets +---------------------- + +* The :module:`FindBZip2` module now provides imported targets. diff --git a/Help/release/dev/cmake-gui-open-project.rst b/Help/release/dev/cmake-gui-open-project.rst new file mode 100644 index 0000000..32f0f0f --- /dev/null +++ b/Help/release/dev/cmake-gui-open-project.rst @@ -0,0 +1,5 @@ +cmake-gui-open-project +---------------------- + +* :manual:`cmake-gui(1)` gained a button to open the generated project file + for :ref:`Visual Studio Generators` and the :generator:`Xcode` generator. diff --git a/Help/release/dev/file-curl-userpw.rst b/Help/release/dev/file-curl-userpw.rst new file mode 100644 index 0000000..4ae1fee --- /dev/null +++ b/Help/release/dev/file-curl-userpw.rst @@ -0,0 +1,5 @@ +file-curl-userpw +---------------- + +* The :command:`file(DOWNLOAD)` and :command:`file(UPLOAD)` commands + gained a ``USERPWD <username>:<password>`` option. diff --git a/Help/release/dev/timestamp-names.rst b/Help/release/dev/timestamp-names.rst new file mode 100644 index 0000000..ea54b5c --- /dev/null +++ b/Help/release/dev/timestamp-names.rst @@ -0,0 +1,6 @@ +timestamp-names +--------------- + +* The :command:`string(TIMESTAMP)` and :command:`file(TIMESTAMP)` + commands gained support for the ``%a`` and ``%b`` placeholders. + These are the abbreviated weekday and month names. diff --git a/Help/release/dev/wix-feature-patch.rst b/Help/release/dev/wix-feature-patch.rst new file mode 100644 index 0000000..0b1cbe3 --- /dev/null +++ b/Help/release/dev/wix-feature-patch.rst @@ -0,0 +1,5 @@ +wix-feature-patch +----------------- + +* The CPack WIX generator now supports + CPACK_WIX_PATCH_FILE fragments for Feature elements. diff --git a/Modules/CPackWIX.cmake b/Modules/CPackWIX.cmake index 08ff0cb..d02df2d 100644 --- a/Modules/CPackWIX.cmake +++ b/Modules/CPackWIX.cmake @@ -147,7 +147,7 @@ # } # # Currently fragments can be injected into most -# Component, File and Directory elements. +# Component, File, Directory and Feature elements. # # The following additional special Ids can be used: # diff --git a/Modules/FindBZip2.cmake b/Modules/FindBZip2.cmake index b670025..152d812 100644 --- a/Modules/FindBZip2.cmake +++ b/Modules/FindBZip2.cmake @@ -4,7 +4,16 @@ # # Try to find BZip2 # -# Once done this will define +# IMPORTED Targets +# ^^^^^^^^^^^^^^^^ +# +# This module defines :prop_tgt:`IMPORTED` target ``BZip2::BZip2``, if +# BZip2 has been found. +# +# Result Variables +# ^^^^^^^^^^^^^^^^ +# +# This module defines the following variables: # # :: # @@ -64,6 +73,31 @@ if (BZIP2_FOUND) set(CMAKE_REQUIRED_LIBRARIES ${BZIP2_LIBRARIES}) CHECK_SYMBOL_EXISTS(BZ2_bzCompressInit "bzlib.h" BZIP2_NEED_PREFIX) cmake_pop_check_state() + + if(NOT TARGET BZip2::BZip2) + add_library(BZip2::BZip2 UNKNOWN IMPORTED) + set_target_properties(BZip2::BZip2 PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${BZIP2_INCLUDE_DIRS}") + + if(BZIP2_LIBRARY_RELEASE) + set_property(TARGET BZip2::BZip2 APPEND PROPERTY + IMPORTED_CONFIGURATIONS RELEASE) + set_target_properties(BZip2::BZip2 PROPERTIES + IMPORTED_LOCATION_RELEASE "${BZIP2_LIBRARY_RELEASE}") + endif() + + if(BZIP2_LIBRARY_DEBUG) + set_property(TARGET BZip2::BZip2 APPEND PROPERTY + IMPORTED_CONFIGURATIONS DEBUG) + set_target_properties(BZip2::BZip2 PROPERTIES + IMPORTED_LOCATION_DEBUG "${BZIP2_LIBRARY_DEBUG}") + endif() + + if(NOT BZIP2_LIBRARY_RELEASE AND NOT BZIP2_LIBRARY_DEBUG) + set_property(TARGET BZip2::BZip2 APPEND PROPERTY + IMPORTED_LOCATION "${BZIP2_LIBRARY}") + endif() + endif() endif () mark_as_advanced(BZIP2_INCLUDE_DIR) diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index f5c2e52..39773e1 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -221,10 +221,14 @@ set(SRCS cmExprLexer.cxx cmExprParser.cxx cmExprParserHelper.cxx + cmExportBuildAndroidMKGenerator.h + cmExportBuildAndroidMKGenerator.cxx cmExportBuildFileGenerator.h cmExportBuildFileGenerator.cxx cmExportFileGenerator.h cmExportFileGenerator.cxx + cmExportInstallAndroidMKGenerator.h + cmExportInstallAndroidMKGenerator.cxx cmExportInstallFileGenerator.h cmExportInstallFileGenerator.cxx cmExportTryCompileFileGenerator.h diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index e77c982..c61ef42 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 6) -set(CMake_VERSION_PATCH 20160912) +set(CMake_VERSION_PATCH 20160914) #set(CMake_VERSION_RC 1) diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index 85e0ae3..ba5787e 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -628,7 +628,7 @@ bool cmCPackWIXGenerator::CreateFeatureHierarchy( i != ComponentGroups.end(); ++i) { cmCPackComponentGroup const& group = i->second; if (group.ParentGroup == 0) { - featureDefinitions.EmitFeatureForComponentGroup(group); + featureDefinitions.EmitFeatureForComponentGroup(group, *this->Patch); } } @@ -638,7 +638,7 @@ bool cmCPackWIXGenerator::CreateFeatureHierarchy( cmCPackComponent const& component = i->second; if (!component.Group) { - featureDefinitions.EmitFeatureForComponent(component); + featureDefinitions.EmitFeatureForComponent(component, *this->Patch); } } diff --git a/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx b/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx index 7794935..c9f17cc 100644 --- a/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx +++ b/Source/CPack/WiX/cmWIXFeaturesSourceWriter.cxx @@ -42,7 +42,7 @@ void cmWIXFeaturesSourceWriter::CreateCMakePackageRegistryEntry( } void cmWIXFeaturesSourceWriter::EmitFeatureForComponentGroup( - cmCPackComponentGroup const& group) + cmCPackComponentGroup const& group, cmWIXPatch& patch) { BeginElement("Feature"); AddAttribute("Id", "CM_G_" + group.Name); @@ -57,20 +57,22 @@ void cmWIXFeaturesSourceWriter::EmitFeatureForComponentGroup( for (std::vector<cmCPackComponentGroup*>::const_iterator i = group.Subgroups.begin(); i != group.Subgroups.end(); ++i) { - EmitFeatureForComponentGroup(**i); + EmitFeatureForComponentGroup(**i, patch); } for (std::vector<cmCPackComponent*>::const_iterator i = group.Components.begin(); i != group.Components.end(); ++i) { - EmitFeatureForComponent(**i); + EmitFeatureForComponent(**i, patch); } + patch.ApplyFragment("CM_G_" + group.Name, *this); + EndElement("Feature"); } void cmWIXFeaturesSourceWriter::EmitFeatureForComponent( - cmCPackComponent const& component) + cmCPackComponent const& component, cmWIXPatch& patch) { BeginElement("Feature"); AddAttribute("Id", "CM_C_" + component.Name); @@ -90,6 +92,8 @@ void cmWIXFeaturesSourceWriter::EmitFeatureForComponent( AddAttribute("Level", "2"); } + patch.ApplyFragment("CM_C_" + component.Name, *this); + EndElement("Feature"); } diff --git a/Source/CPack/WiX/cmWIXFeaturesSourceWriter.h b/Source/CPack/WiX/cmWIXFeaturesSourceWriter.h index 9974b63..124ed42 100644 --- a/Source/CPack/WiX/cmWIXFeaturesSourceWriter.h +++ b/Source/CPack/WiX/cmWIXFeaturesSourceWriter.h @@ -13,6 +13,7 @@ #ifndef cmWIXFeaturesSourceWriter_h #define cmWIXFeaturesSourceWriter_h +#include "cmWIXPatch.h" #include "cmWIXSourceWriter.h" #include <CPack/cmCPackGenerator.h> @@ -29,9 +30,11 @@ public: void CreateCMakePackageRegistryEntry(std::string const& package, std::string const& upgradeGuid); - void EmitFeatureForComponentGroup(const cmCPackComponentGroup& group); + void EmitFeatureForComponentGroup(const cmCPackComponentGroup& group, + cmWIXPatch& patch); - void EmitFeatureForComponent(const cmCPackComponent& component); + void EmitFeatureForComponent(const cmCPackComponent& component, + cmWIXPatch& patch); void EmitComponentRef(std::string const& id); }; diff --git a/Source/CPack/cygwin.readme b/Source/CPack/cygwin.readme deleted file mode 100644 index c0cd4b9..0000000 --- a/Source/CPack/cygwin.readme +++ /dev/null @@ -1,69 +0,0 @@ -http://cygwin.com/setup.html - - -Need to produce two tar files: - -Source- - -- create subdirs -- copy src -- duplicate src -- configure files into duplicate src - CPack.cygwin-readme.in - CPack.cygwin-install.sh.in - CPack.setup.hint.in -- diff duplicate src and orig src -- write diff into toplevel -- create tar file call super class - -cmake-2.2.3-1 - - -1. a source release -cmake-2.2.3-2-src.tar.bz2 - -cmake-2.2.3-2.patch has cmake-2.2.3/CYGWIN-PATCHES/cmake.README cmake-2.2.3/CYGWIN-PATCHES/setup.hint -cmake-2.2.3-2.sh -> script to create cygwin release -cmake-2.2.3.tar.bz2 -> unmodified cmake sources for 2.2.3 - - - - - -2 a binary release -cmake-2.2.3-2.tar.bz2 - -normal binary release with use as the root of the tree: - -Here is the bootstrap command used: - - ${SOURCE_DIR}/bootstrap --prefix=/usr --datadir=/share/cmake-${VER} \ - --docdir=/share/doc/cmake-${VER} --mandir=/share/man - -CMAKE_DOC_DIR /share/doc/${PKG}-${VER} -CMAKE_MAN_DIR /share/man -CMAKE_DATA_DIR /share/${PKG}-${VER} - -Here is the directory stucture: - -usr/bin/cmake.exe -usr/share/doc/cmake-2.2.3/MANIFEST *** -usr/share/doc/Cygwin/cmake-2.2.3-2.README **** -usr/share/cmake-2.2.3/Modules - - - -usr/bin -usr/share/cmake-2.2.3/include -usr/share/cmake-2.2.3/Modules/Platform -usr/share/cmake-2.2.3/Modules -usr/share/cmake-2.2.3/Templates -usr/share/cmake-2.2.3 -usr/share/doc/cmake-2.2.3 -usr/share/doc/Cygwin -usr/share/doc -usr/share/man/man1 -usr/share/man -usr/share -usr - diff --git a/Source/CTest/cmCTestSVN.cxx b/Source/CTest/cmCTestSVN.cxx index f680612..0832820 100644 --- a/Source/CTest/cmCTestSVN.cxx +++ b/Source/CTest/cmCTestSVN.cxx @@ -108,13 +108,8 @@ std::string cmCTestSVN::LoadInfo(SVNInfo& svninfo) void cmCTestSVN::NoteOldRevision() { - // Info for root repository - this->Repositories.push_back(SVNInfo("")); - this->RootInfo = &(this->Repositories.back()); - // Info for the external repositories - this->LoadExternals(); + this->LoadRepositories(); - // Get info for all the repositories std::list<SVNInfo>::iterator itbeg = this->Repositories.begin(); std::list<SVNInfo>::iterator itend = this->Repositories.end(); for (; itbeg != itend; itbeg++) { @@ -134,7 +129,8 @@ void cmCTestSVN::NoteOldRevision() void cmCTestSVN::NoteNewRevision() { - // Get info for the external repositories + this->LoadRepositories(); + std::list<SVNInfo>::iterator itbeg = this->Repositories.begin(); std::list<SVNInfo>::iterator itend = this->Repositories.end(); for (; itbeg != itend; itbeg++) { @@ -534,8 +530,13 @@ private: } }; -void cmCTestSVN::LoadExternals() +void cmCTestSVN::LoadRepositories() { + // Info for root repository + this->Repositories.clear(); + this->Repositories.push_back(SVNInfo("")); + this->RootInfo = &(this->Repositories.back()); + // Run "svn status" to get the list of external repositories std::vector<const char*> svn_status; svn_status.push_back("status"); diff --git a/Source/CTest/cmCTestSVN.h b/Source/CTest/cmCTestSVN.h index 6f2374d..2301b10 100644 --- a/Source/CTest/cmCTestSVN.h +++ b/Source/CTest/cmCTestSVN.h @@ -86,7 +86,7 @@ private: SVNInfo* RootInfo; std::string LoadInfo(SVNInfo& svninfo); - void LoadExternals(); + void LoadRepositories(); void LoadModifications() CM_OVERRIDE; void LoadRevisions() CM_OVERRIDE; void LoadRevisions(SVNInfo& svninfo); diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx index 5b84597..14ce3f7 100644 --- a/Source/QtDialog/CMakeSetupDialog.cxx +++ b/Source/QtDialog/CMakeSetupDialog.cxx @@ -14,6 +14,7 @@ #include <QCloseEvent> #include <QCoreApplication> +#include <QDesktopServices> #include <QDialogButtonBox> #include <QDragEnterEvent> #include <QFileDialog> @@ -227,6 +228,8 @@ void CMakeSetupDialog::initialize() QObject::connect(this->GenerateButton, SIGNAL(clicked(bool)), this, SLOT(doGenerate())); + QObject::connect(this->OpenProjectButton, SIGNAL(clicked(bool)), this, + SLOT(doOpenProject())); QObject::connect(this->BrowseSourceDirectoryButton, SIGNAL(clicked(bool)), this, SLOT(doSourceBrowse())); @@ -499,6 +502,26 @@ void CMakeSetupDialog::doGenerate() this->ConfigureNeeded = true; } +QString CMakeSetupDialog::getProjectFilename() +{ + QStringList nameFilter; + nameFilter << "*.sln" + << "*.xcodeproj"; + QDir directory(this->BinaryDirectory->currentText()); + QStringList nlnFile = directory.entryList(nameFilter); + + if (nlnFile.count() == 1) { + return this->BinaryDirectory->currentText() + "/" + nlnFile.at(0); + } + + return QString(); +} + +void CMakeSetupDialog::doOpenProject() +{ + QDesktopServices::openUrl(QUrl::fromLocalFile(this->getProjectFilename())); +} + void CMakeSetupDialog::closeEvent(QCloseEvent* e) { // prompt for close if there are unsaved changes, and we're not busy @@ -617,6 +640,11 @@ void CMakeSetupDialog::updateBinaryDirectory(const QString& dir) this->BinaryDirectory->setEditText(dir); this->BinaryDirectory->blockSignals(false); } + if (!this->getProjectFilename().isEmpty()) { + this->OpenProjectButton->setEnabled(true); + } else { + this->OpenProjectButton->setEnabled(false); + } } void CMakeSetupDialog::doBinaryBrowse() @@ -1002,22 +1030,28 @@ void CMakeSetupDialog::enterState(CMakeSetupDialog::State s) if (s == Interrupting) { this->ConfigureButton->setEnabled(false); this->GenerateButton->setEnabled(false); + this->OpenProjectButton->setEnabled(false); } else if (s == Configuring) { this->setEnabledState(false); this->GenerateButton->setEnabled(false); this->GenerateAction->setEnabled(false); + this->OpenProjectButton->setEnabled(false); this->ConfigureButton->setText(tr("&Stop")); } else if (s == Generating) { this->CacheModified = false; this->setEnabledState(false); this->ConfigureButton->setEnabled(false); this->GenerateAction->setEnabled(false); + this->OpenProjectButton->setEnabled(false); this->GenerateButton->setText(tr("&Stop")); } else if (s == ReadyConfigure) { this->setEnabledState(true); this->GenerateButton->setEnabled(true); this->GenerateAction->setEnabled(true); this->ConfigureButton->setEnabled(true); + if (!this->getProjectFilename().isEmpty()) { + this->OpenProjectButton->setEnabled(true); + } this->ConfigureButton->setText(tr("&Configure")); this->GenerateButton->setText(tr("&Generate")); } else if (s == ReadyGenerate) { @@ -1025,6 +1059,9 @@ void CMakeSetupDialog::enterState(CMakeSetupDialog::State s) this->GenerateButton->setEnabled(true); this->GenerateAction->setEnabled(true); this->ConfigureButton->setEnabled(true); + if (!this->getProjectFilename().isEmpty()) { + this->OpenProjectButton->setEnabled(true); + } this->ConfigureButton->setText(tr("&Configure")); this->GenerateButton->setText(tr("&Generate")); } diff --git a/Source/QtDialog/CMakeSetupDialog.h b/Source/QtDialog/CMakeSetupDialog.h index 2a4ea7a..992de01 100644 --- a/Source/QtDialog/CMakeSetupDialog.h +++ b/Source/QtDialog/CMakeSetupDialog.h @@ -41,6 +41,8 @@ protected slots: void initialize(); void doConfigure(); void doGenerate(); + QString getProjectFilename(); + void doOpenProject(); void doInstallForCommandLine(); void doHelp(); void doAbout(); diff --git a/Source/QtDialog/CMakeSetupDialog.ui b/Source/QtDialog/CMakeSetupDialog.ui index b04bd93..8d8e0cd 100644 --- a/Source/QtDialog/CMakeSetupDialog.ui +++ b/Source/QtDialog/CMakeSetupDialog.ui @@ -238,6 +238,13 @@ </property> </widget> </item> + <item> + <widget class="QPushButton" name="OpenProjectButton"> + <property name="text"> + <string>Open &Project</string> + </property> + </widget> + </item> <item> <widget class="QLabel" name="Generator"> <property name="text"> diff --git a/Source/QtDialog/QCMakeCacheView.cxx b/Source/QtDialog/QCMakeCacheView.cxx index 88ea049..ed11f7b 100644 --- a/Source/QtDialog/QCMakeCacheView.cxx +++ b/Source/QtDialog/QCMakeCacheView.cxx @@ -95,10 +95,7 @@ protected: // if there are no children if (!m->hasChildren(idx)) { bool adv = m->data(idx, QCMakeCacheModel::AdvancedRole).toBool(); - if (!adv || (adv && this->ShowAdvanced)) { - return true; - } - return false; + return !adv || this->ShowAdvanced; } // check children @@ -554,14 +551,16 @@ QWidget* QCMakeCacheModelDelegate::createEditor( QObject::connect(editor, SIGNAL(fileDialogExists(bool)), this, SLOT(setFileDialogFlag(bool))); return editor; - } else if (type == QCMakeProperty::FILEPATH) { + } + if (type == QCMakeProperty::FILEPATH) { QCMakeFilePathEditor* editor = new QCMakeFilePathEditor(p, var.data(Qt::DisplayRole).toString()); QObject::connect(editor, SIGNAL(fileDialogExists(bool)), this, SLOT(setFileDialogFlag(bool))); return editor; - } else if (type == QCMakeProperty::STRING && - var.data(QCMakeCacheModel::StringsRole).isValid()) { + } + if (type == QCMakeProperty::STRING && + var.data(QCMakeCacheModel::StringsRole).isValid()) { QCMakeComboBox* editor = new QCMakeComboBox( p, var.data(QCMakeCacheModel::StringsRole).toStringList()); editor->setFrame(false); diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index b7e006d..eb4c1ec 100644 --- a/Source/cmDependsFortran.cxx +++ b/Source/cmDependsFortran.cxx @@ -712,10 +712,5 @@ bool cmDependsFortran::ModulesDiffer(const char* modFile, // Compare the remaining content. If no compiler id matched above, // including the case none was given, this will compare the whole // content. - if (!cmFortranStreamsDiffer(finModFile, finStampFile)) { - return false; - } - - // The modules are different. - return true; + return cmFortranStreamsDiffer(finModFile, finStampFile); } diff --git a/Source/cmExportBuildAndroidMKGenerator.cxx b/Source/cmExportBuildAndroidMKGenerator.cxx new file mode 100644 index 0000000..3247cc8 --- /dev/null +++ b/Source/cmExportBuildAndroidMKGenerator.cxx @@ -0,0 +1,193 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#include "cmExportBuildAndroidMKGenerator.h" + +#include "cmExportSet.h" +#include "cmGeneratorTarget.h" +#include "cmGlobalGenerator.h" +#include "cmLocalGenerator.h" +#include "cmMakefile.h" +#include "cmTargetExport.h" + +cmExportBuildAndroidMKGenerator::cmExportBuildAndroidMKGenerator() +{ + this->LG = CM_NULLPTR; + this->ExportSet = CM_NULLPTR; +} + +void cmExportBuildAndroidMKGenerator::GenerateImportHeaderCode( + std::ostream& os, const std::string&) +{ + os << "LOCAL_PATH := $(call my-dir)\n\n"; +} + +void cmExportBuildAndroidMKGenerator::GenerateImportFooterCode(std::ostream&) +{ +} + +void cmExportBuildAndroidMKGenerator::GenerateExpectedTargetsCode( + std::ostream&, const std::string&) +{ +} + +void cmExportBuildAndroidMKGenerator::GenerateImportTargetCode( + std::ostream& os, const cmGeneratorTarget* target) +{ + std::string targetName = this->Namespace; + targetName += target->GetExportName(); + os << "include $(CLEAR_VARS)\n"; + os << "LOCAL_MODULE := "; + os << targetName << "\n"; + os << "LOCAL_SRC_FILES := "; + std::string path = target->GetLocalGenerator()->ConvertToOutputFormat( + target->GetFullPath(), cmOutputConverter::MAKERULE); + os << path << "\n"; +} + +void cmExportBuildAndroidMKGenerator::GenerateImportPropertyCode( + std::ostream&, const std::string&, cmGeneratorTarget const*, + ImportPropertyMap const&) +{ +} + +void cmExportBuildAndroidMKGenerator::GenerateMissingTargetsCheckCode( + std::ostream&, const std::vector<std::string>&) +{ +} + +void cmExportBuildAndroidMKGenerator::GenerateInterfaceProperties( + const cmGeneratorTarget* target, std::ostream& os, + const ImportPropertyMap& properties) +{ + std::string config = ""; + if (this->Configurations.size()) { + config = this->Configurations[0]; + } + cmExportBuildAndroidMKGenerator::GenerateInterfaceProperties( + target, os, properties, cmExportBuildAndroidMKGenerator::BUILD, config); +} + +void cmExportBuildAndroidMKGenerator::GenerateInterfaceProperties( + const cmGeneratorTarget* target, std::ostream& os, + const ImportPropertyMap& properties, GenerateType type, + std::string const& config) +{ + const bool newCMP0022Behavior = + target->GetPolicyStatusCMP0022() != cmPolicies::WARN && + target->GetPolicyStatusCMP0022() != cmPolicies::OLD; + if (!newCMP0022Behavior) { + std::ostringstream w; + if (type == cmExportBuildAndroidMKGenerator::BUILD) { + w << "export(TARGETS ... ANDROID_MK) called with policy CMP0022"; + } else { + w << "install( EXPORT_ANDROID_MK ...) called with policy CMP0022"; + } + w << " set to OLD for target " << target->Target->GetName() << ". " + << "The export will only work with CMP0022 set to NEW."; + target->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str()); + } + if (!properties.empty()) { + os << "LOCAL_CPP_FEATURES := rtti exceptions\n"; + for (ImportPropertyMap::const_iterator pi = properties.begin(); + pi != properties.end(); ++pi) { + if (pi->first == "INTERFACE_COMPILE_OPTIONS") { + os << "LOCAL_CPP_FEATURES += "; + os << (pi->second) << "\n"; + } else if (pi->first == "INTERFACE_LINK_LIBRARIES") { + // need to look at list in pi->second and see if static or shared + // FindTargetToLink + // target->GetLocalGenerator()->FindGeneratorTargetToUse() + // then add to LOCAL_CPPFLAGS + std::vector<std::string> libraries; + cmSystemTools::ExpandListArgument(pi->second, libraries); + std::string staticLibs; + std::string sharedLibs; + std::string ldlibs; + for (std::vector<std::string>::iterator i = libraries.begin(); + i != libraries.end(); ++i) { + cmGeneratorTarget* gt = + target->GetLocalGenerator()->FindGeneratorTargetToUse(*i); + if (gt) { + + if (gt->GetType() == cmState::SHARED_LIBRARY || + gt->GetType() == cmState::MODULE_LIBRARY) { + sharedLibs += " " + *i; + } else { + staticLibs += " " + *i; + } + } else { + // evaluate any generator expressions with the current + // build type of the makefile + cmGeneratorExpression ge; + CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(*i); + std::string evaluated = + cge->Evaluate(target->GetLocalGenerator(), config); + bool relpath = false; + if (type == cmExportBuildAndroidMKGenerator::INSTALL) { + relpath = i->substr(0, 3) == "../"; + } + // check for full path or if it already has a -l, or + // in the case of an install check for relative paths + // if it is full or a link library then use string directly + if (cmSystemTools::FileIsFullPath(evaluated) || + evaluated.substr(0, 2) == "-l" || relpath) { + ldlibs += " " + evaluated; + // if it is not a path and does not have a -l then add -l + } else if (!evaluated.empty()) { + ldlibs += " -l" + evaluated; + } + } + } + if (!sharedLibs.empty()) { + os << "LOCAL_SHARED_LIBRARIES :=" << sharedLibs << "\n"; + } + if (!staticLibs.empty()) { + os << "LOCAL_STATIC_LIBRARIES :=" << staticLibs << "\n"; + } + if (!ldlibs.empty()) { + os << "LOCAL_EXPORT_LDLIBS :=" << ldlibs << "\n"; + } + } else if (pi->first == "INTERFACE_INCLUDE_DIRECTORIES") { + std::string includes = pi->second; + std::vector<std::string> includeList; + cmSystemTools::ExpandListArgument(includes, includeList); + os << "LOCAL_EXPORT_C_INCLUDES := "; + std::string end; + for (std::vector<std::string>::iterator i = includeList.begin(); + i != includeList.end(); ++i) { + os << end << *i; + end = "\\\n"; + } + os << "\n"; + } else { + os << "# " << pi->first << " " << (pi->second) << "\n"; + } + } + } + switch (target->GetType()) { + case cmState::SHARED_LIBRARY: + case cmState::MODULE_LIBRARY: + os << "include $(PREBUILT_SHARED_LIBRARY)\n"; + break; + case cmState::STATIC_LIBRARY: + os << "include $(PREBUILT_STATIC_LIBRARY)\n"; + break; + case cmState::EXECUTABLE: + case cmState::UTILITY: + case cmState::OBJECT_LIBRARY: + case cmState::GLOBAL_TARGET: + case cmState::INTERFACE_LIBRARY: + case cmState::UNKNOWN_LIBRARY: + break; + } + os << "\n"; +} diff --git a/Source/cmExportBuildAndroidMKGenerator.h b/Source/cmExportBuildAndroidMKGenerator.h new file mode 100644 index 0000000..e26aba0 --- /dev/null +++ b/Source/cmExportBuildAndroidMKGenerator.h @@ -0,0 +1,68 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cmExportBuildAndroidMKGenerator_h +#define cmExportBuildAndroidMKGenerator_h + +#include "cmExportBuildFileGenerator.h" +#include "cmListFileCache.h" + +class cmExportSet; + +/** \class cmExportBuildAndroidMKGenerator + * \brief Generate a file exporting targets from a build tree. + * + * cmExportBuildAndroidMKGenerator generates a file exporting targets from + * a build tree. This exports the targets to the Android ndk build tool + * makefile format for prebuilt libraries. + * + * This is used to implement the EXPORT() command. + */ +class cmExportBuildAndroidMKGenerator : public cmExportBuildFileGenerator +{ +public: + cmExportBuildAndroidMKGenerator(); + // this is so cmExportInstallAndroidMKGenerator can share this + // function as they are almost the same + enum GenerateType + { + BUILD, + INSTALL + }; + static void GenerateInterfaceProperties(cmGeneratorTarget const* target, + std::ostream& os, + const ImportPropertyMap& properties, + GenerateType type, + std::string const& config); + +protected: + // Implement virtual methods from the superclass. + virtual void GeneratePolicyHeaderCode(std::ostream&) {} + virtual void GeneratePolicyFooterCode(std::ostream&) {} + virtual void GenerateImportHeaderCode(std::ostream& os, + const std::string& config = ""); + virtual void GenerateImportFooterCode(std::ostream& os); + virtual void GenerateImportTargetCode(std::ostream& os, + const cmGeneratorTarget* target); + virtual void GenerateExpectedTargetsCode(std::ostream& os, + const std::string& expectedTargets); + virtual void GenerateImportPropertyCode(std::ostream& os, + const std::string& config, + cmGeneratorTarget const* target, + ImportPropertyMap const& properties); + virtual void GenerateMissingTargetsCheckCode( + std::ostream& os, const std::vector<std::string>& missingTargets); + virtual void GenerateInterfaceProperties( + cmGeneratorTarget const* target, std::ostream& os, + const ImportPropertyMap& properties); +}; + +#endif diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx index fc62492..134a63f 100644 --- a/Source/cmExportCommand.cxx +++ b/Source/cmExportCommand.cxx @@ -18,6 +18,7 @@ #include <cmsys/Encoding.hxx> #include <cmsys/RegularExpression.hxx> +#include "cmExportBuildAndroidMKGenerator.h" #include "cmExportBuildFileGenerator.h" #if defined(__HAIKU__) @@ -34,6 +35,7 @@ cmExportCommand::cmExportCommand() , Namespace(&Helper, "NAMESPACE", &ArgumentGroup) , Filename(&Helper, "FILE", &ArgumentGroup) , ExportOld(&Helper, "EXPORT_LINK_INTERFACE_LIBRARIES", &ArgumentGroup) + , AndroidMKFile(&Helper, "ANDROID_MK") { this->ExportSet = CM_NULLPTR; } @@ -66,13 +68,18 @@ bool cmExportCommand::InitialPass(std::vector<std::string> const& args, } std::string fname; - if (!this->Filename.WasFound()) { + bool android = false; + if (this->AndroidMKFile.WasFound()) { + fname = this->AndroidMKFile.GetString(); + android = true; + } + if (!this->Filename.WasFound() && fname.empty()) { if (args[0] != "EXPORT") { this->SetError("FILE <filename> option missing."); return false; } fname = this->ExportSetName.GetString() + ".cmake"; - } else { + } else if (fname.empty()) { // Make sure the file has a .cmake extension. if (cmSystemTools::GetFilenameLastExtension(this->Filename.GetCString()) != ".cmake") { @@ -176,7 +183,12 @@ bool cmExportCommand::InitialPass(std::vector<std::string> const& args, } // Setup export file generation. - cmExportBuildFileGenerator* ebfg = new cmExportBuildFileGenerator; + cmExportBuildFileGenerator* ebfg = CM_NULLPTR; + if (android) { + ebfg = new cmExportBuildAndroidMKGenerator; + } else { + ebfg = new cmExportBuildFileGenerator; + } ebfg->SetExportFile(fname.c_str()); ebfg->SetNamespace(this->Namespace.GetCString()); ebfg->SetAppendMode(this->Append.IsEnabled()); diff --git a/Source/cmExportCommand.h b/Source/cmExportCommand.h index 0a149af..481d2c5 100644 --- a/Source/cmExportCommand.h +++ b/Source/cmExportCommand.h @@ -54,6 +54,7 @@ private: cmCAString Namespace; cmCAString Filename; cmCAEnabler ExportOld; + cmCAString AndroidMKFile; cmExportSet* ExportSet; diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index 23c77d9..c4c7d7d 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -96,24 +96,8 @@ bool cmExportFileGenerator::GenerateImportFile() } std::ostream& os = *foutPtr; - // Protect that file against use with older CMake versions. - /* clang-format off */ - os << "# Generated by CMake\n\n"; - os << "if(\"${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}\" LESS 2.5)\n" - << " message(FATAL_ERROR \"CMake >= 2.6.0 required\")\n" - << "endif()\n"; - /* clang-format on */ - - // Isolate the file policy level. - // We use 2.6 here instead of the current version because newer - // versions of CMake should be able to export files imported by 2.6 - // until the import format changes. - /* clang-format off */ - os << "cmake_policy(PUSH)\n" - << "cmake_policy(VERSION 2.6)\n"; - /* clang-format on */ - // Start with the import file header. + this->GeneratePolicyHeaderCode(os); this->GenerateImportHeaderCode(os); // Create all the imported targets. @@ -121,7 +105,7 @@ bool cmExportFileGenerator::GenerateImportFile() // End with the import file footer. this->GenerateImportFooterCode(os); - os << "cmake_policy(POP)\n"; + this->GeneratePolicyFooterCode(os); return result; } @@ -832,6 +816,31 @@ void cmExportFileGenerator::SetImportLinkProperty( properties[prop] = link_entries; } +void cmExportFileGenerator::GeneratePolicyHeaderCode(std::ostream& os) +{ + // Protect that file against use with older CMake versions. + /* clang-format off */ + os << "# Generated by CMake\n\n"; + os << "if(\"${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}\" LESS 2.5)\n" + << " message(FATAL_ERROR \"CMake >= 2.6.0 required\")\n" + << "endif()\n"; + /* clang-format on */ + + // Isolate the file policy level. + // We use 2.6 here instead of the current version because newer + // versions of CMake should be able to export files imported by 2.6 + // until the import format changes. + /* clang-format off */ + os << "cmake_policy(PUSH)\n" + << "cmake_policy(VERSION 2.6)\n"; + /* clang-format on */ +} + +void cmExportFileGenerator::GeneratePolicyFooterCode(std::ostream& os) +{ + os << "cmake_policy(POP)\n"; +} + void cmExportFileGenerator::GenerateImportHeaderCode(std::ostream& os, const std::string& config) { diff --git a/Source/cmExportFileGenerator.h b/Source/cmExportFileGenerator.h index 354994a..d106ab7 100644 --- a/Source/cmExportFileGenerator.h +++ b/Source/cmExportFileGenerator.h @@ -78,25 +78,28 @@ protected: std::vector<std::string>& missingTargets); // Methods to implement export file code generation. - void GenerateImportHeaderCode(std::ostream& os, - const std::string& config = ""); - void GenerateImportFooterCode(std::ostream& os); + virtual void GeneratePolicyHeaderCode(std::ostream& os); + virtual void GeneratePolicyFooterCode(std::ostream& os); + virtual void GenerateImportHeaderCode(std::ostream& os, + const std::string& config = ""); + virtual void GenerateImportFooterCode(std::ostream& os); void GenerateImportVersionCode(std::ostream& os); - void GenerateImportTargetCode(std::ostream& os, - cmGeneratorTarget const* target); - void GenerateImportPropertyCode(std::ostream& os, const std::string& config, - cmGeneratorTarget const* target, - ImportPropertyMap const& properties); - void GenerateImportedFileChecksCode( + virtual void GenerateImportTargetCode(std::ostream& os, + cmGeneratorTarget const* target); + virtual void GenerateImportPropertyCode(std::ostream& os, + const std::string& config, + cmGeneratorTarget const* target, + ImportPropertyMap const& properties); + virtual void GenerateImportedFileChecksCode( std::ostream& os, cmGeneratorTarget* target, ImportPropertyMap const& properties, const std::set<std::string>& importedLocations); - void GenerateImportedFileCheckLoop(std::ostream& os); - void GenerateMissingTargetsCheckCode( + virtual void GenerateImportedFileCheckLoop(std::ostream& os); + virtual void GenerateMissingTargetsCheckCode( std::ostream& os, const std::vector<std::string>& missingTargets); - void GenerateExpectedTargetsCode(std::ostream& os, - const std::string& expectedTargets); + virtual void GenerateExpectedTargetsCode(std::ostream& os, + const std::string& expectedTargets); // Collect properties with detailed information about targets beyond // their location on disk. @@ -140,9 +143,9 @@ protected: ImportPropertyMap& properties); void PopulateCompatibleInterfaceProperties(cmGeneratorTarget* target, ImportPropertyMap& properties); - void GenerateInterfaceProperties(cmGeneratorTarget const* target, - std::ostream& os, - const ImportPropertyMap& properties); + virtual void GenerateInterfaceProperties( + cmGeneratorTarget const* target, std::ostream& os, + const ImportPropertyMap& properties); void PopulateIncludeDirectoriesInterface( cmTargetExport* target, cmGeneratorExpression::PreprocessContext preprocessRule, @@ -169,8 +172,8 @@ protected: std::vector<std::string>& missingTargets, FreeTargetsReplace replace = NoReplaceFreeTargets); - void GenerateRequiredCMakeVersion(std::ostream& os, - const char* versionString); + virtual void GenerateRequiredCMakeVersion(std::ostream& os, + const char* versionString); // The namespace in which the exports are placed in the generated file. std::string Namespace; diff --git a/Source/cmExportInstallAndroidMKGenerator.cxx b/Source/cmExportInstallAndroidMKGenerator.cxx new file mode 100644 index 0000000..8f815b7 --- /dev/null +++ b/Source/cmExportInstallAndroidMKGenerator.cxx @@ -0,0 +1,146 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#include "cmExportInstallAndroidMKGenerator.h" + +#include "cmAlgorithms.h" +#include "cmExportBuildAndroidMKGenerator.h" +#include "cmExportSet.h" +#include "cmExportSetMap.h" +#include "cmGeneratedFileStream.h" +#include "cmGeneratorTarget.h" +#include "cmGlobalGenerator.h" +#include "cmInstallExportGenerator.h" +#include "cmInstallTargetGenerator.h" +#include "cmLocalGenerator.h" +#include "cmTargetExport.h" + +cmExportInstallAndroidMKGenerator::cmExportInstallAndroidMKGenerator( + cmInstallExportGenerator* iegen) + : cmExportInstallFileGenerator(iegen) +{ +} + +void cmExportInstallAndroidMKGenerator::GenerateImportHeaderCode( + std::ostream& os, const std::string&) +{ + std::string installDir = this->IEGen->GetDestination(); + os << "LOCAL_PATH := $(call my-dir)\n"; + size_t numDotDot = cmSystemTools::CountChar(installDir.c_str(), '/'); + numDotDot += (installDir.size() > 0) ? 1 : 0; + std::string path; + for (size_t n = 0; n < numDotDot; n++) { + path += "/.."; + } + os << "_IMPORT_PREFIX := " + << "$(LOCAL_PATH)" << path << "\n\n"; + for (std::vector<cmTargetExport*>::const_iterator tei = + this->IEGen->GetExportSet()->GetTargetExports()->begin(); + tei != this->IEGen->GetExportSet()->GetTargetExports()->end(); ++tei) { + // Collect import properties for this target. + cmTargetExport const* te = *tei; + if (te->Target->GetType() == cmState::INTERFACE_LIBRARY) { + continue; + } + std::string dest; + if (te->LibraryGenerator) { + dest = te->LibraryGenerator->GetDestination(""); + } + if (te->ArchiveGenerator) { + dest = te->ArchiveGenerator->GetDestination(""); + } + te->Target->Target->SetProperty("__dest", dest.c_str()); + } +} + +void cmExportInstallAndroidMKGenerator::GenerateImportFooterCode(std::ostream&) +{ +} + +void cmExportInstallAndroidMKGenerator::GenerateImportTargetCode( + std::ostream& os, const cmGeneratorTarget* target) +{ + std::string targetName = this->Namespace; + targetName += target->GetExportName(); + os << "include $(CLEAR_VARS)\n"; + os << "LOCAL_MODULE := "; + os << targetName << "\n"; + os << "LOCAL_SRC_FILES := $(_IMPORT_PREFIX)/"; + os << target->Target->GetProperty("__dest") << "/"; + std::string config = ""; + if (this->Configurations.size()) { + config = this->Configurations[0]; + } + os << target->GetFullName(config) << "\n"; +} + +void cmExportInstallAndroidMKGenerator::GenerateExpectedTargetsCode( + std::ostream&, const std::string&) +{ +} + +void cmExportInstallAndroidMKGenerator::GenerateImportPropertyCode( + std::ostream&, const std::string&, cmGeneratorTarget const*, + ImportPropertyMap const&) +{ +} + +void cmExportInstallAndroidMKGenerator::GenerateMissingTargetsCheckCode( + std::ostream&, const std::vector<std::string>&) +{ +} + +void cmExportInstallAndroidMKGenerator::GenerateInterfaceProperties( + cmGeneratorTarget const* target, std::ostream& os, + const ImportPropertyMap& properties) +{ + std::string config = ""; + if (this->Configurations.size()) { + config = this->Configurations[0]; + } + cmExportBuildAndroidMKGenerator::GenerateInterfaceProperties( + target, os, properties, cmExportBuildAndroidMKGenerator::INSTALL, config); +} + +void cmExportInstallAndroidMKGenerator::LoadConfigFiles(std::ostream&) +{ +} + +void cmExportInstallAndroidMKGenerator::GenerateImportPrefix(std::ostream&) +{ +} + +void cmExportInstallAndroidMKGenerator::GenerateRequiredCMakeVersion( + std::ostream&, const char*) +{ +} + +void cmExportInstallAndroidMKGenerator::CleanupTemporaryVariables( + std::ostream&) +{ +} + +void cmExportInstallAndroidMKGenerator::GenerateImportedFileCheckLoop( + std::ostream&) +{ +} + +void cmExportInstallAndroidMKGenerator::GenerateImportedFileChecksCode( + std::ostream&, cmGeneratorTarget*, ImportPropertyMap const&, + const std::set<std::string>&) +{ +} + +bool cmExportInstallAndroidMKGenerator::GenerateImportFileConfig( + const std::string&, std::vector<std::string>&) +{ + return true; +} diff --git a/Source/cmExportInstallAndroidMKGenerator.h b/Source/cmExportInstallAndroidMKGenerator.h new file mode 100644 index 0000000..4b9f51c --- /dev/null +++ b/Source/cmExportInstallAndroidMKGenerator.h @@ -0,0 +1,72 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cmExportInstallAndroidMKGenerator_h +#define cmExportInstallAndroidMKGenerator_h + +#include "cmExportInstallFileGenerator.h" + +class cmInstallExportGenerator; +class cmInstallTargetGenerator; + +/** \class cmExportInstallAndroidMKGenerator + * \brief Generate a file exporting targets from an install tree. + * + * cmExportInstallAndroidMKGenerator generates files exporting targets from + * install an installation tree. The files are placed in a temporary + * location for installation by cmInstallExportGenerator. The file format + * is for the ndk build system and is a makefile fragment specifing prebuilt + * libraries to the ndk build system. + * + * This is used to implement the INSTALL(EXPORT_ANDROID_MK) command. + */ +class cmExportInstallAndroidMKGenerator : public cmExportInstallFileGenerator +{ +public: + /** Construct with the export installer that will install the + files. */ + cmExportInstallAndroidMKGenerator(cmInstallExportGenerator* iegen); + +protected: + // Implement virtual methods from the superclass. + virtual void GeneratePolicyHeaderCode(std::ostream&) {} + virtual void GeneratePolicyFooterCode(std::ostream&) {} + virtual void GenerateImportHeaderCode(std::ostream& os, + const std::string& config = ""); + virtual void GenerateImportFooterCode(std::ostream& os); + virtual void GenerateImportTargetCode(std::ostream& os, + const cmGeneratorTarget* target); + virtual void GenerateExpectedTargetsCode(std::ostream& os, + const std::string& expectedTargets); + virtual void GenerateImportPropertyCode(std::ostream& os, + const std::string& config, + cmGeneratorTarget const* target, + ImportPropertyMap const& properties); + virtual void GenerateMissingTargetsCheckCode( + std::ostream& os, const std::vector<std::string>& missingTargets); + virtual void GenerateInterfaceProperties( + cmGeneratorTarget const* target, std::ostream& os, + const ImportPropertyMap& properties); + virtual void GenerateImportPrefix(std::ostream& os); + virtual void LoadConfigFiles(std::ostream&); + virtual void GenerateRequiredCMakeVersion(std::ostream& os, + const char* versionString); + virtual void CleanupTemporaryVariables(std::ostream&); + virtual void GenerateImportedFileCheckLoop(std::ostream& os); + virtual void GenerateImportedFileChecksCode( + std::ostream& os, cmGeneratorTarget* target, + ImportPropertyMap const& properties, + const std::set<std::string>& importedLocations); + virtual bool GenerateImportFileConfig(const std::string& config, + std::vector<std::string>&); +}; + +#endif diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index bcadaa0..f47038f 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -75,58 +75,8 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) this->GenerateExpectedTargetsCode(os, expectedTargets); } - // Set an _IMPORT_PREFIX variable for import location properties - // to reference if they are relative to the install prefix. - std::string installPrefix = - this->IEGen->GetLocalGenerator()->GetMakefile()->GetSafeDefinition( - "CMAKE_INSTALL_PREFIX"); - std::string const& expDest = this->IEGen->GetDestination(); - if (cmSystemTools::FileIsFullPath(expDest)) { - // The export file is being installed to an absolute path so the - // package is not relocatable. Use the configured install prefix. - /* clang-format off */ - os << - "# The installation prefix configured by this project.\n" - "set(_IMPORT_PREFIX \"" << installPrefix << "\")\n" - "\n"; - /* clang-format on */ - } else { - // Add code to compute the installation prefix relative to the - // import file location. - std::string absDest = installPrefix + "/" + expDest; - std::string absDestS = absDest + "/"; - os << "# Compute the installation prefix relative to this file.\n" - << "get_filename_component(_IMPORT_PREFIX" - << " \"${CMAKE_CURRENT_LIST_FILE}\" PATH)\n"; - if (cmHasLiteralPrefix(absDestS.c_str(), "/lib/") || - cmHasLiteralPrefix(absDestS.c_str(), "/lib64/") || - cmHasLiteralPrefix(absDestS.c_str(), "/usr/lib/") || - cmHasLiteralPrefix(absDestS.c_str(), "/usr/lib64/")) { - // Handle "/usr move" symlinks created by some Linux distros. - /* clang-format off */ - os << - "# Use original install prefix when loaded through a\n" - "# cross-prefix symbolic link such as /lib -> /usr/lib.\n" - "get_filename_component(_realCurr \"${_IMPORT_PREFIX}\" REALPATH)\n" - "get_filename_component(_realOrig \"" << absDest << "\" REALPATH)\n" - "if(_realCurr STREQUAL _realOrig)\n" - " set(_IMPORT_PREFIX \"" << absDest << "\")\n" - "endif()\n" - "unset(_realOrig)\n" - "unset(_realCurr)\n"; - /* clang-format on */ - } - std::string dest = expDest; - while (!dest.empty()) { - os << "get_filename_component(_IMPORT_PREFIX \"${_IMPORT_PREFIX}\" " - "PATH)\n"; - dest = cmSystemTools::GetFilenamePath(dest); - } - os << "if(_IMPORT_PREFIX STREQUAL \"/\")\n" - << " set(_IMPORT_PREFIX \"\")\n" - << "endif()\n" - << "\n"; - } + // Compute the relative import prefix for the file + this->GenerateImportPrefix(os); std::vector<std::string> missingTargets; @@ -204,24 +154,9 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) this->GenerateRequiredCMakeVersion(os, "2.8.12"); } - // Now load per-configuration properties for them. - /* clang-format off */ - os << "# Load information for each installed configuration.\n" - << "get_filename_component(_DIR \"${CMAKE_CURRENT_LIST_FILE}\" PATH)\n" - << "file(GLOB CONFIG_FILES \"${_DIR}/" - << this->GetConfigImportFileGlob() << "\")\n" - << "foreach(f ${CONFIG_FILES})\n" - << " include(${f})\n" - << "endforeach()\n" - << "\n"; - /* clang-format on */ + this->LoadConfigFiles(os); - // Cleanup the import prefix variable. - /* clang-format off */ - os << "# Cleanup temporary variables.\n" - << "set(_IMPORT_PREFIX)\n" - << "\n"; - /* clang-format on */ + this->CleanupTemporaryVariables(os); this->GenerateImportedFileCheckLoop(os); bool result = true; @@ -242,6 +177,86 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) return result; } +void cmExportInstallFileGenerator::GenerateImportPrefix(std::ostream& os) +{ + // Set an _IMPORT_PREFIX variable for import location properties + // to reference if they are relative to the install prefix. + std::string installPrefix = + this->IEGen->GetLocalGenerator()->GetMakefile()->GetSafeDefinition( + "CMAKE_INSTALL_PREFIX"); + std::string const& expDest = this->IEGen->GetDestination(); + if (cmSystemTools::FileIsFullPath(expDest)) { + // The export file is being installed to an absolute path so the + // package is not relocatable. Use the configured install prefix. + /* clang-format off */ + os << + "# The installation prefix configured by this project.\n" + "set(_IMPORT_PREFIX \"" << installPrefix << "\")\n" + "\n"; + /* clang-format on */ + } else { + // Add code to compute the installation prefix relative to the + // import file location. + std::string absDest = installPrefix + "/" + expDest; + std::string absDestS = absDest + "/"; + os << "# Compute the installation prefix relative to this file.\n" + << "get_filename_component(_IMPORT_PREFIX" + << " \"${CMAKE_CURRENT_LIST_FILE}\" PATH)\n"; + if (cmHasLiteralPrefix(absDestS.c_str(), "/lib/") || + cmHasLiteralPrefix(absDestS.c_str(), "/lib64/") || + cmHasLiteralPrefix(absDestS.c_str(), "/usr/lib/") || + cmHasLiteralPrefix(absDestS.c_str(), "/usr/lib64/")) { + // Handle "/usr move" symlinks created by some Linux distros. + /* clang-format off */ + os << + "# Use original install prefix when loaded through a\n" + "# cross-prefix symbolic link such as /lib -> /usr/lib.\n" + "get_filename_component(_realCurr \"${_IMPORT_PREFIX}\" REALPATH)\n" + "get_filename_component(_realOrig \"" << absDest << "\" REALPATH)\n" + "if(_realCurr STREQUAL _realOrig)\n" + " set(_IMPORT_PREFIX \"" << absDest << "\")\n" + "endif()\n" + "unset(_realOrig)\n" + "unset(_realCurr)\n"; + /* clang-format on */ + } + std::string dest = expDest; + while (!dest.empty()) { + os << "get_filename_component(_IMPORT_PREFIX \"${_IMPORT_PREFIX}\" " + "PATH)\n"; + dest = cmSystemTools::GetFilenamePath(dest); + } + os << "if(_IMPORT_PREFIX STREQUAL \"/\")\n" + << " set(_IMPORT_PREFIX \"\")\n" + << "endif()\n" + << "\n"; + } +} + +void cmExportInstallFileGenerator::CleanupTemporaryVariables(std::ostream& os) +{ + /* clang-format off */ + os << "# Cleanup temporary variables.\n" + << "set(_IMPORT_PREFIX)\n" + << "\n"; + /* clang-format on */ +} + +void cmExportInstallFileGenerator::LoadConfigFiles(std::ostream& os) +{ + // Now load per-configuration properties for them. + /* clang-format off */ + os << "# Load information for each installed configuration.\n" + << "get_filename_component(_DIR \"${CMAKE_CURRENT_LIST_FILE}\" PATH)\n" + << "file(GLOB CONFIG_FILES \"${_DIR}/" + << this->GetConfigImportFileGlob() << "\")\n" + << "foreach(f ${CONFIG_FILES})\n" + << " include(${f})\n" + << "endforeach()\n" + << "\n"; + /* clang-format on */ +} + void cmExportInstallFileGenerator::ReplaceInstallPrefix(std::string& input) { std::string::size_type pos = 0; diff --git a/Source/cmExportInstallFileGenerator.h b/Source/cmExportInstallFileGenerator.h index c693dc1..63f2d40 100644 --- a/Source/cmExportInstallFileGenerator.h +++ b/Source/cmExportInstallFileGenerator.h @@ -80,9 +80,17 @@ protected: std::vector<std::string> FindNamespaces(cmGlobalGenerator* gg, const std::string& name); + /** Generate the relative import prefix. */ + virtual void GenerateImportPrefix(std::ostream&); + + /** Generate the relative import prefix. */ + virtual void LoadConfigFiles(std::ostream&); + + virtual void CleanupTemporaryVariables(std::ostream&); + /** Generate a per-configuration file for the targets. */ - bool GenerateImportFileConfig(const std::string& config, - std::vector<std::string>& missingTargets); + virtual bool GenerateImportFileConfig( + const std::string& config, std::vector<std::string>& missingTargets); /** Fill in properties indicating installed file locations. */ void SetImportLocationProperty(const std::string& config, diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 835b118..2c226cd 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -2481,6 +2481,7 @@ bool cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args) std::string hashMatchMSG; CM_AUTO_PTR<cmCryptoHash> hash; bool showProgress = false; + std::string userpwd; while (i != args.end()) { if (*i == "TIMEOUT") { @@ -2564,6 +2565,18 @@ bool cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args) return false; } hashMatchMSG = algo + " hash"; + } else if (*i == "USERPWD") { + ++i; + if (i == args.end()) { + this->SetError("DOWNLOAD missing string for USERPWD."); + return false; + } + userpwd = *i; + } else { + // Do not return error for compatibility reason. + std::string err = "Unexpected argument: "; + err += *i; + this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, err.c_str()); } ++i; } @@ -2698,6 +2711,11 @@ bool cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args) check_curl_result(res, "DOWNLOAD cannot set progress data: "); } + if (!userpwd.empty()) { + res = ::curl_easy_setopt(curl, CURLOPT_USERPWD, userpwd.c_str()); + check_curl_result(res, "DOWNLOAD cannot set user password: "); + } + res = ::curl_easy_perform(curl); /* always cleanup */ @@ -2778,6 +2796,7 @@ bool cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args) std::string logVar; std::string statusVar; bool showProgress = false; + std::string userpwd; while (i != args.end()) { if (*i == "TIMEOUT") { @@ -2812,6 +2831,18 @@ bool cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args) statusVar = *i; } else if (*i == "SHOW_PROGRESS") { showProgress = true; + } else if (*i == "USERPWD") { + ++i; + if (i == args.end()) { + this->SetError("UPLOAD missing string for USERPWD."); + return false; + } + userpwd = *i; + } else { + // Do not return error for compatibility reason. + std::string err = "Unexpected argument: "; + err += *i; + this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, err.c_str()); } ++i; @@ -2920,6 +2951,11 @@ bool cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args) ::curl_easy_setopt(curl, CURLOPT_INFILESIZE, static_cast<long>(file_size)); check_curl_result(res, "UPLOAD cannot set input file size: "); + if (!userpwd.empty()) { + res = ::curl_easy_setopt(curl, CURLOPT_USERPWD, userpwd.c_str()); + check_curl_result(res, "UPLOAD cannot set user password: "); + } + res = ::curl_easy_perform(curl); /* always cleanup */ diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 8bb43ee..ac9c8ef 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -482,6 +482,10 @@ void cmGlobalVisualStudio10Generator::GenerateBuildCommand( bool cmGlobalVisualStudio10Generator::Find64BitTools(cmMakefile* mf) { + if (this->DefaultPlatformToolset == "v100") { + // The v100 64-bit toolset does not exist in the express edition. + this->DefaultPlatformToolset.clear(); + } if (this->GetPlatformToolset()) { return true; } diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx index 4912eac..e464bce 100644 --- a/Source/cmInstallCommand.cxx +++ b/Source/cmInstallCommand.cxx @@ -83,6 +83,8 @@ bool cmInstallCommand::InitialPass(std::vector<std::string> const& args, return this->HandleDirectoryMode(args); } else if (args[0] == "EXPORT") { return this->HandleExportMode(args); + } else if (args[0] == "EXPORT_ANDROID_MK") { + return this->HandleExportAndroidMKMode(args); } // Unknown mode. @@ -1097,6 +1099,100 @@ bool cmInstallCommand::HandleDirectoryMode( return true; } +bool cmInstallCommand::HandleExportAndroidMKMode( + std::vector<std::string> const& args) +{ +#ifdef CMAKE_BUILD_WITH_CMAKE + // This is the EXPORT mode. + cmInstallCommandArguments ica(this->DefaultComponentName); + cmCAString exp(&ica.Parser, "EXPORT_ANDROID_MK"); + cmCAString name_space(&ica.Parser, "NAMESPACE", &ica.ArgumentGroup); + cmCAEnabler exportOld(&ica.Parser, "EXPORT_LINK_INTERFACE_LIBRARIES", + &ica.ArgumentGroup); + cmCAString filename(&ica.Parser, "FILE", &ica.ArgumentGroup); + exp.Follows(0); + + ica.ArgumentGroup.Follows(&exp); + std::vector<std::string> unknownArgs; + ica.Parse(&args, &unknownArgs); + + if (!unknownArgs.empty()) { + // Unknown argument. + std::ostringstream e; + e << args[0] << " given unknown argument \"" << unknownArgs[0] << "\"."; + this->SetError(e.str()); + return false; + } + + if (!ica.Finalize()) { + return false; + } + + // Make sure there is a destination. + if (ica.GetDestination().empty()) { + // A destination is required. + std::ostringstream e; + e << args[0] << " given no DESTINATION!"; + this->SetError(e.str()); + return false; + } + + // Check the file name. + std::string fname = filename.GetString(); + if (fname.find_first_of(":/\\") != fname.npos) { + std::ostringstream e; + e << args[0] << " given invalid export file name \"" << fname << "\". " + << "The FILE argument may not contain a path. " + << "Specify the path in the DESTINATION argument."; + this->SetError(e.str()); + return false; + } + + // Check the file extension. + if (!fname.empty() && + cmSystemTools::GetFilenameLastExtension(fname) != ".mk") { + std::ostringstream e; + e << args[0] << " given invalid export file name \"" << fname << "\". " + << "The FILE argument must specify a name ending in \".mk\"."; + this->SetError(e.str()); + return false; + } + if (fname.find_first_of(":/\\") != fname.npos) { + std::ostringstream e; + e << args[0] << " given export name \"" << exp.GetString() << "\". " + << "This name cannot be safely converted to a file name. " + << "Specify a different export name or use the FILE option to set " + << "a file name explicitly."; + this->SetError(e.str()); + return false; + } + // Use the default name + if (fname.empty()) { + fname = "Android.mk"; + } + + cmExportSet* exportSet = + this->Makefile->GetGlobalGenerator()->GetExportSets()[exp.GetString()]; + + cmInstallGenerator::MessageLevel message = + cmInstallGenerator::SelectMessageLevel(this->Makefile); + + // Create the export install generator. + cmInstallExportGenerator* exportGenerator = new cmInstallExportGenerator( + exportSet, ica.GetDestination().c_str(), ica.GetPermissions().c_str(), + ica.GetConfigurations(), ica.GetComponent().c_str(), message, + ica.GetExcludeFromAll(), fname.c_str(), name_space.GetCString(), + exportOld.IsEnabled(), true); + this->Makefile->AddInstallGenerator(exportGenerator); + + return true; +#else + static_cast<void>(args); + this->SetError("EXPORT_ANDROID_MK not supported in bootstrap cmake"); + return false; +#endif +} + bool cmInstallCommand::HandleExportMode(std::vector<std::string> const& args) { // This is the EXPORT mode. @@ -1203,7 +1299,7 @@ bool cmInstallCommand::HandleExportMode(std::vector<std::string> const& args) exportSet, ica.GetDestination().c_str(), ica.GetPermissions().c_str(), ica.GetConfigurations(), ica.GetComponent().c_str(), message, ica.GetExcludeFromAll(), fname.c_str(), name_space.GetCString(), - exportOld.IsEnabled()); + exportOld.IsEnabled(), false); this->Makefile->AddInstallGenerator(exportGenerator); return true; diff --git a/Source/cmInstallCommand.h b/Source/cmInstallCommand.h index 3718ad5..7bc974c 100644 --- a/Source/cmInstallCommand.h +++ b/Source/cmInstallCommand.h @@ -48,6 +48,7 @@ private: bool HandleFilesMode(std::vector<std::string> const& args); bool HandleDirectoryMode(std::vector<std::string> const& args); bool HandleExportMode(std::vector<std::string> const& args); + bool HandleExportAndroidMKMode(std::vector<std::string> const& args); bool MakeFilesFullPath(const char* modeName, const std::vector<std::string>& relFiles, std::vector<std::string>& absFiles); diff --git a/Source/cmInstallExportAndroidMKGenerator.cxx b/Source/cmInstallExportAndroidMKGenerator.cxx new file mode 100644 index 0000000..43bdc01 --- /dev/null +++ b/Source/cmInstallExportAndroidMKGenerator.cxx @@ -0,0 +1,149 @@ + +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#include "cmInstallExportAndroidMKGenerator.h" + +#include <stdio.h> + +#include "cmExportInstallFileGenerator.h" +#include "cmExportSet.h" +#include "cmGeneratedFileStream.h" +#include "cmGlobalGenerator.h" +#include "cmInstallFilesGenerator.h" +#include "cmInstallTargetGenerator.h" +#include "cmLocalGenerator.h" +#include "cmMakefile.h" +#include "cmake.h" + +cmInstallExportAndroidMKGenerator::cmInstallExportAndroidMKGenerator( + cmExportSet* exportSet, const char* destination, + const char* file_permissions, std::vector<std::string> const& configurations, + const char* component, MessageLevel message, bool exclude_from_all, + const char* filename, const char* name_space, bool exportOld) + : cmInstallExportGenerator(exportSet, destination, file_permissions, + configurations, component, message, + exclude_from_all, filename, name_space, exportOld) +{ +} + +cmInstallExportAndroidMKGenerator::~cmInstallExportAndroidMKGenerator() +{ +} + +void cmInstallExportAndroidMKGenerator::Compute(cmLocalGenerator* lg) +{ + this->LocalGenerator = lg; + this->ExportSet->Compute(lg); +} + +void cmInstallExportAndroidMKGenerator::GenerateScript(std::ostream& os) +{ + // Skip empty sets. + if (ExportSet->GetTargetExports()->empty()) { + std::ostringstream e; + e << "INSTALL(EXPORT) given unknown export \"" << ExportSet->GetName() + << "\""; + cmSystemTools::Error(e.str().c_str()); + return; + } + + // Create the temporary directory in which to store the files. + this->ComputeTempDir(); + cmSystemTools::MakeDirectory(this->TempDir.c_str()); + + // Construct a temporary location for the file. + this->MainImportFile = this->TempDir; + this->MainImportFile += "/"; + this->MainImportFile += this->FileName; + + // Generate the import file for this export set. + this->EFGen->SetExportFile(this->MainImportFile.c_str()); + this->EFGen->SetNamespace(this->Namespace); + this->EFGen->SetExportOld(this->ExportOld); + if (this->ConfigurationTypes->empty()) { + if (!this->ConfigurationName.empty()) { + this->EFGen->AddConfiguration(this->ConfigurationName); + } else { + this->EFGen->AddConfiguration(""); + } + } else { + for (std::vector<std::string>::const_iterator ci = + this->ConfigurationTypes->begin(); + ci != this->ConfigurationTypes->end(); ++ci) { + this->EFGen->AddConfiguration(*ci); + } + } + this->EFGen->GenerateImportFile(); + + // Perform the main install script generation. + this->cmInstallGenerator::GenerateScript(os); +} + +void cmInstallExportAndroidMKGenerator::GenerateScriptConfigs( + std::ostream& os, Indent const& indent) +{ + // Create the main install rules first. + this->cmInstallGenerator::GenerateScriptConfigs(os, indent); + + // Now create a configuration-specific install rule for the import + // file of each configuration. + std::vector<std::string> files; + for (std::map<std::string, std::string>::const_iterator i = + this->EFGen->GetConfigImportFiles().begin(); + i != this->EFGen->GetConfigImportFiles().end(); ++i) { + files.push_back(i->second); + std::string config_test = this->CreateConfigTest(i->first); + os << indent << "if(" << config_test << ")\n"; + this->AddInstallRule(os, this->Destination, cmInstallType_FILES, files, + false, this->FilePermissions.c_str(), CM_NULLPTR, + CM_NULLPTR, CM_NULLPTR, indent.Next()); + os << indent << "endif()\n"; + files.clear(); + } +} + +void cmInstallExportAndroidMKGenerator::GenerateScriptActions( + std::ostream& os, Indent const& indent) +{ + // Remove old per-configuration export files if the main changes. + std::string installedDir = "$ENV{DESTDIR}"; + installedDir += this->ConvertToAbsoluteDestination(this->Destination); + installedDir += "/"; + std::string installedFile = installedDir; + installedFile += this->FileName; + os << indent << "if(EXISTS \"" << installedFile << "\")\n"; + Indent indentN = indent.Next(); + Indent indentNN = indentN.Next(); + Indent indentNNN = indentNN.Next(); + /* clang-format off */ + os << indentN << "file(DIFFERENT EXPORT_FILE_CHANGED FILES\n" + << indentN << " \"" << installedFile << "\"\n" + << indentN << " \"" << this->MainImportFile << "\")\n"; + os << indentN << "if(EXPORT_FILE_CHANGED)\n"; + os << indentNN << "file(GLOB OLD_CONFIG_FILES \"" << installedDir + << this->EFGen->GetConfigImportFileGlob() << "\")\n"; + os << indentNN << "if(OLD_CONFIG_FILES)\n"; + os << indentNNN << "message(STATUS \"Old export file \\\"" << installedFile + << "\\\" will be replaced. Removing files [${OLD_CONFIG_FILES}].\")\n"; + os << indentNNN << "file(REMOVE ${OLD_CONFIG_FILES})\n"; + os << indentNN << "endif()\n"; + os << indentN << "endif()\n"; + os << indent << "endif()\n"; + /* clang-format on */ + + // Install the main export file. + std::vector<std::string> files; + files.push_back(this->MainImportFile); + this->AddInstallRule(os, this->Destination, cmInstallType_FILES, files, + false, this->FilePermissions.c_str(), CM_NULLPTR, + CM_NULLPTR, CM_NULLPTR, indent); +} diff --git a/Source/cmInstallExportAndroidMKGenerator.h b/Source/cmInstallExportAndroidMKGenerator.h new file mode 100644 index 0000000..158972d --- /dev/null +++ b/Source/cmInstallExportAndroidMKGenerator.h @@ -0,0 +1,46 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#ifndef cmInstallExportAndroidMKGenerator_h +#define cmInstallExportAndroidMKGenerator_h + +#include "cmInstallExportGenerator.h" + +class cmExportInstallFileGenerator; +class cmInstallFilesGenerator; +class cmInstallTargetGenerator; +class cmExportSet; +class cmMakefile; + +/** \class cmInstallExportAndroidMKGenerator + * \brief Generate rules for creating an export files. + */ +class cmInstallExportAndroidMKGenerator : public cmInstallExportGenerator +{ +public: + cmInstallExportAndroidMKGenerator( + cmExportSet* exportSet, const char* dest, const char* file_permissions, + const std::vector<std::string>& configurations, const char* component, + MessageLevel message, bool exclude_from_all, const char* filename, + const char* name_space, bool exportOld); + ~cmInstallExportAndroidMKGenerator(); + + void Compute(cmLocalGenerator* lg); + +protected: + virtual void GenerateScript(std::ostream& os); + virtual void GenerateScriptConfigs(std::ostream& os, Indent const& indent); + virtual void GenerateScriptActions(std::ostream& os, Indent const& indent); + void GenerateImportFile(cmExportSet const* exportSet); + void GenerateImportFile(const char* config, cmExportSet const* exportSet); +}; + +#endif diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx index 27628f4..5ea7faf 100644 --- a/Source/cmInstallExportGenerator.cxx +++ b/Source/cmInstallExportGenerator.cxx @@ -16,6 +16,9 @@ #include <sstream> #include <utility> +#ifdef CMAKE_BUILD_WITH_CMAKE +#include "cmExportInstallAndroidMKGenerator.h" +#endif #include "cmExportInstallFileGenerator.h" #include "cmExportSet.h" #include "cmInstallType.h" @@ -27,7 +30,7 @@ cmInstallExportGenerator::cmInstallExportGenerator( cmExportSet* exportSet, const char* destination, const char* file_permissions, std::vector<std::string> const& configurations, const char* component, MessageLevel message, bool exclude_from_all, - const char* filename, const char* name_space, bool exportOld) + const char* filename, const char* name_space, bool exportOld, bool android) : cmInstallGenerator(destination, configurations, component, message, exclude_from_all) , ExportSet(exportSet) @@ -37,7 +40,13 @@ cmInstallExportGenerator::cmInstallExportGenerator( , ExportOld(exportOld) , LocalGenerator(CM_NULLPTR) { - this->EFGen = new cmExportInstallFileGenerator(this); + if (android) { +#ifdef CMAKE_BUILD_WITH_CMAKE + this->EFGen = new cmExportInstallAndroidMKGenerator(this); +#endif + } else { + this->EFGen = new cmExportInstallFileGenerator(this); + } exportSet->AddInstallation(this); } diff --git a/Source/cmInstallExportGenerator.h b/Source/cmInstallExportGenerator.h index 5539827..ac02386 100644 --- a/Source/cmInstallExportGenerator.h +++ b/Source/cmInstallExportGenerator.h @@ -37,7 +37,8 @@ public: const std::vector<std::string>& configurations, const char* component, MessageLevel message, bool exclude_from_all, const char* filename, - const char* name_space, bool exportOld); + const char* name_space, bool exportOld, + bool android); ~cmInstallExportGenerator() CM_OVERRIDE; cmExportSet* GetExportSet() { return this->ExportSet; } diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 694a9f6..a76bed3 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -175,15 +175,14 @@ void cmLocalGenerator::GenerateTestFiles() (*gi)->Compute(this); (*gi)->Generate(fout, config, configurationTypes); } - size_t i; - std::vector<cmState::Snapshot> children = - this->Makefile->GetStateSnapshot().GetChildren(); - for (i = 0; i < children.size(); ++i) { + typedef std::vector<cmState::Snapshot> vec_t; + vec_t const& children = this->Makefile->GetStateSnapshot().GetChildren(); + for (vec_t::const_iterator i = children.begin(); i != children.end(); ++i) { // TODO: Use add_subdirectory instead? - fout << "subdirs("; - std::string outP = children[i].GetDirectory().GetCurrentBinary(); - fout << this->ConvertToRelativePath(outP, START_OUTPUT); - fout << ")" << std::endl; + std::string outP = i->GetDirectory().GetCurrentBinary(); + outP = this->ConvertToRelativePath(outP, START_OUTPUT); + outP = cmOutputConverter::EscapeForCMake(outP); + fout << "subdirs(" << outP << ")" << std::endl; } } @@ -1531,9 +1530,6 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries, linkLibs += " "; } - // Write the library flags to the build rule. - fout << linkLibs; - // Check what kind of rpath flags to use. if (cli.GetRuntimeSep().empty()) { // Each rpath entry gets its own option ("-R a -R b -R c") @@ -1560,6 +1556,9 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries, } } + // Write the library flags to the build rule. + fout << linkLibs; + // Add the linker runtime search path if any. std::string rpath_link = cli.GetRPathLinkString(); if (!cli.GetRPathLinkFlag().empty() && !rpath_link.empty()) { diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 7da9975..7352217 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -1766,9 +1766,7 @@ bool cmSystemTools::CopyFileTime(const char* fromFile, const char* toFile) if (!GetFileTime(hFrom, &timeCreation, &timeLastAccess, &timeLastWrite)) { return false; } - if (!SetFileTime(hTo, &timeCreation, &timeLastAccess, &timeLastWrite)) { - return false; - } + return SetFileTime(hTo, &timeCreation, &timeLastAccess, &timeLastWrite) != 0; #else struct stat fromStat; if (stat(fromFile, &fromStat) < 0) { @@ -1778,11 +1776,8 @@ bool cmSystemTools::CopyFileTime(const char* fromFile, const char* toFile) struct utimbuf buf; buf.actime = fromStat.st_atime; buf.modtime = fromStat.st_mtime; - if (utime(toFile, &buf) < 0) { - return false; - } + return utime(toFile, &buf) >= 0; #endif - return true; } cmSystemToolsFileTime* cmSystemTools::FileTimeNew() @@ -1828,16 +1823,11 @@ bool cmSystemTools::FileTimeSet(const char* fname, cmSystemToolsFileTime* t) if (!h) { return false; } - if (!SetFileTime(h, &t->timeCreation, &t->timeLastAccess, - &t->timeLastWrite)) { - return false; - } + return SetFileTime(h, &t->timeCreation, &t->timeLastAccess, + &t->timeLastWrite) != 0; #else - if (utime(fname, &t->timeBuf) < 0) { - return false; - } + return utime(fname, &t->timeBuf) >= 0; #endif - return true; } #ifdef _WIN32 diff --git a/Source/cmTimestamp.cxx b/Source/cmTimestamp.cxx index 61b74db..a94212c 100644 --- a/Source/cmTimestamp.cxx +++ b/Source/cmTimestamp.cxx @@ -123,6 +123,8 @@ std::string cmTimestamp::AddTimestampComponent(char flag, formatString += flag; switch (flag) { + case 'a': + case 'b': case 'd': case 'H': case 'I': diff --git a/Source/cmake.cxx b/Source/cmake.cxx index d6bea3d..0d61a3d 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -35,7 +35,7 @@ #if defined(CMAKE_BUILD_WITH_CMAKE) #include "cmGraphVizWriter.h" #include "cmVariableWatch.h" -#include <cm_jsoncpp_value.h> + #include <cm_jsoncpp_writer.h> #endif @@ -233,10 +233,9 @@ cmake::~cmake() delete this->FileComparison; } -std::string cmake::ReportCapabilities() const -{ - std::string result; #if defined(CMAKE_BUILD_WITH_CMAKE) +Json::Value cmake::ReportCapabilitiesJson() const +{ Json::Value obj = Json::objectValue; // Version information: Json::Value version = Json::objectValue; @@ -287,8 +286,16 @@ std::string cmake::ReportCapabilities() const #else obj["serverMode"] = false; #endif + return obj; +} +#endif + +std::string cmake::ReportCapabilities() const +{ + std::string result; +#if defined(CMAKE_BUILD_WITH_CMAKE) Json::FastWriter writer; - result = writer.write(obj); + result = writer.write(this->ReportCapabilitiesJson()); #else result = "Not supported"; #endif @@ -1039,6 +1046,28 @@ const char* cmake::GetHomeOutputDirectory() const return this->State->GetBinaryDirectory(); } +std::string cmake::FindCacheFile(const std::string& binaryDir) const +{ + std::string cachePath = binaryDir; + cmSystemTools::ConvertToUnixSlashes(cachePath); + std::string cacheFile = cachePath; + cacheFile += "/CMakeCache.txt"; + if (!cmSystemTools::FileExists(cacheFile.c_str())) { + // search in parent directories for cache + std::string cmakeFiles = cachePath; + cmakeFiles += "/CMakeFiles"; + if (cmSystemTools::FileExists(cmakeFiles.c_str())) { + std::string cachePathFound = + cmSystemTools::FileExistsInParentDirectories("CMakeCache.txt", + cachePath.c_str(), "/"); + if (!cachePathFound.empty()) { + cachePath = cmSystemTools::GetFilenamePath(cachePathFound); + } + } + } + return cachePath; +} + void cmake::SetGlobalGenerator(cmGlobalGenerator* gg) { if (!gg) { @@ -2337,24 +2366,8 @@ int cmake::Build(const std::string& dir, const std::string& target, std::cerr << "Error: " << dir << " is not a directory\n"; return 1; } - std::string cachePath = dir; - cmSystemTools::ConvertToUnixSlashes(cachePath); - std::string cacheFile = cachePath; - cacheFile += "/CMakeCache.txt"; - if (!cmSystemTools::FileExists(cacheFile.c_str())) { - // search in parent directories for cache - std::string cmakeFiles = cachePath; - cmakeFiles += "/CMakeFiles"; - if (cmSystemTools::FileExists(cmakeFiles.c_str())) { - std::string cachePathFound = - cmSystemTools::FileExistsInParentDirectories("CMakeCache.txt", - cachePath.c_str(), "/"); - if (!cachePathFound.empty()) { - cachePath = cmSystemTools::GetFilenamePath(cachePathFound); - } - } - } + std::string cachePath = FindCacheFile(dir); if (!this->LoadCache(cachePath)) { std::cerr << "Error: could not load cache\n"; return 1; diff --git a/Source/cmake.h b/Source/cmake.h index 9dc429d..30661d9 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -24,6 +24,10 @@ #include <string> #include <vector> +#if defined(CMAKE_BUILD_WITH_CMAKE) +#include "cm_jsoncpp_value.h" +#endif + class cmExternalMakefileProjectGeneratorFactory; class cmFileTimeComparison; class cmGlobalGenerator; @@ -118,6 +122,9 @@ public: /// Destructor ~cmake(); +#if defined(CMAKE_BUILD_WITH_CMAKE) + Json::Value ReportCapabilitiesJson() const; +#endif std::string ReportCapabilities() const; static const char* GetCMakeFilesDirectory() { return "/CMakeFiles"; } @@ -186,6 +193,9 @@ public: return this->GlobalGenerator; } + ///! Return the full path to where the CMakeCache.txt file should be. + std::string FindCacheFile(const std::string& binaryDir) const; + ///! Return the global generator assigned to this instance of cmake void SetGlobalGenerator(cmGlobalGenerator*); diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index c2e1d53..900bba0 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -91,9 +91,9 @@ void CMakeCommandUsage(const char* program) << " remove_directory dir - remove a directory and its contents\n" << " rename oldname newname - rename a file or directory " "(on one volume)\n" + << " sleep <number>... - sleep for given number of seconds\n" << " tar [cxt][vf][zjJ] file.tar [file/dir1 file/dir2 ...]\n" << " - create or extract a tar or zip archive\n" - << " sleep <number>... - sleep for given number of seconds\n" << " time command [args...] - run command and return elapsed time\n" << " touch file - touch a file.\n" << " touch_nocreate file - touch a file but do not create it.\n" diff --git a/Templates/cygwin-package.sh.in b/Templates/cygwin-package.sh.in deleted file mode 100755 index 69b6c0f..0000000 --- a/Templates/cygwin-package.sh.in +++ /dev/null @@ -1,103 +0,0 @@ -#!/bin/sh - -# this is a sample shell script used for building a cmake -# based project for a cygwin setup package. - -# get the current directory -TOP_DIR=`cd \`echo "$0" | sed -n '/\//{s/\/[^\/]*$//;p;}'\`;pwd` - -# create build directory -mkdirs() -{ - ( - mkdir -p "$TOP_DIR/@CPACK_PACKAGE_FILE_NAME@/.build" - ) -} - -# cd into -# untar source tree and apply patch -prep() -{ - ( - cd "$TOP_DIR" && - tar xvfj @CPACK_PACKAGE_FILE_NAME@.tar.bz2 - patch -p0 < "@CPACK_PACKAGE_FILE_NAME@-@CPACK_CYGWIN_PATCH_NUMBER@.patch" && - mkdirs - ) -} - -# configure the build tree in .build directory -# of the source tree -conf() -{ - ( - cd "$TOP_DIR/@CPACK_PACKAGE_FILE_NAME@/.build" && - cmake .. - ) -} - -# build the package in the .build directory -build() -{ - ( - cd "$TOP_DIR/@CPACK_PACKAGE_FILE_NAME@/.build" && - make && - make test - ) -} - -# clean the build tree -clean() -{ - ( - cd "$TOP_DIR/@CPACK_PACKAGE_FILE_NAME@/.build" && - make clean - ) -} - -# create the package -pkg() -{ - ( - cd "$TOP_DIR/@CPACK_PACKAGE_FILE_NAME@/.build" && - cpack && - mv @CPACK_PACKAGE_FILE_NAME@-@CPACK_CYGWIN_PATCH_NUMBER@.tar.bz2 "$TOP_DIR" - ) -} - -# create the source package -spkg() -{ - ( - cd "$TOP_DIR/@CPACK_PACKAGE_FILE_NAME@/.build" && - cpack --config CPackSourceConfig.cmake && - mv @CPACK_PACKAGE_FILE_NAME@-@CPACK_CYGWIN_PATCH_NUMBER@-src.tar.bz2 "$TOP_DIR" - ) -} - -# clean up -finish() -{ - ( - rm -rf "@CPACK_PACKAGE_FILE_NAME@" - ) -} - -case $1 in - prep) prep ; STATUS=$? ;; - mkdirs) mkdirs ; STATUS=$? ;; - conf) conf ; STATUS=$? ;; - build) build ; STATUS=$? ;; - clean) clean ; STATUS=$? ;; - package) pkg ; STATUS=$? ;; - pkg) pkg ; STATUS=$? ;; - src-package) spkg ; STATUS=$? ;; - spkg) spkg ; STATUS=$? ;; - finish) finish ; STATUS=$? ;; - all) ( - prep && conf && build && pkg && spkg && finish ; - STATUS=$? - ) ;; - *) echo "Error: bad argument (all or one of these: prep mkdirs conf build clean package pkg src-package spkg finish)" ; exit 1 ;; -esac -exit ${STATUS} diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 7f43ec7..97770ed 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1356,6 +1356,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release add_subdirectory(FindBoost) endif() + if(CMake_TEST_FindBZip2) + add_subdirectory(FindBZip2) + endif() + if(CMake_TEST_FindGSL) add_subdirectory(FindGSL) endif() diff --git a/Tests/CMakeTests/String-TIMESTAMP-MonthWeekNames.cmake b/Tests/CMakeTests/String-TIMESTAMP-MonthWeekNames.cmake new file mode 100644 index 0000000..1cd44ff --- /dev/null +++ b/Tests/CMakeTests/String-TIMESTAMP-MonthWeekNames.cmake @@ -0,0 +1,11 @@ +string(TIMESTAMP output "%a;%b") +message("~${output}~") + +list(LENGTH output output_length) + +set(expected_output_length 2) + +if(NOT output_length EQUAL ${expected_output_length}) + message(FATAL_ERROR "expected ${expected_output_length} entries in output " + "with all specifiers; found ${output_length}") +endif() diff --git a/Tests/CMakeTests/StringTest.cmake.in b/Tests/CMakeTests/StringTest.cmake.in index aba35fe..a45b205 100644 --- a/Tests/CMakeTests/StringTest.cmake.in +++ b/Tests/CMakeTests/StringTest.cmake.in @@ -36,6 +36,8 @@ set(TIMESTAMP-IncompleteSpecifier-RESULT 0) set(TIMESTAMP-IncompleteSpecifier-STDERR "~foobar%~") set(TIMESTAMP-AllSpecifiers-RESULT 0) set(TIMESTAMP-AllSpecifiers-STDERR "~[0-9]+(;[0-9]+)*~") +set(TIMESTAMP-MonthWeekNames-RESULT 0) +set(TIMESTAMP-MonthWeekNames-STDERR "~[^%]+;[^%]+~") set(TIMESTAMP-UnixTime-RESULT 0) set(TIMESTAMP-UnixTime-STDERR "~[1-9][0-9]+~") @@ -60,6 +62,7 @@ check_cmake_test(String TIMESTAMP-UnknownSpecifier TIMESTAMP-IncompleteSpecifier TIMESTAMP-AllSpecifiers + TIMESTAMP-MonthWeekNames TIMESTAMP-UnixTime ) diff --git a/Tests/FindBZip2/CMakeLists.txt b/Tests/FindBZip2/CMakeLists.txt new file mode 100644 index 0000000..0eb3b99 --- /dev/null +++ b/Tests/FindBZip2/CMakeLists.txt @@ -0,0 +1,10 @@ +add_test(NAME FindBZip2.Test COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindBZip2/Test" + "${CMake_BINARY_DIR}/Tests/FindBZip2/Test" + ${build_generator_args} + --build-project TestFindBZip2 + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) diff --git a/Tests/FindBZip2/Test/CMakeLists.txt b/Tests/FindBZip2/Test/CMakeLists.txt new file mode 100644 index 0000000..e9cb618 --- /dev/null +++ b/Tests/FindBZip2/Test/CMakeLists.txt @@ -0,0 +1,16 @@ +cmake_minimum_required(VERSION 3.4) +project(TestFindBZip2 C) +include(CTest) + +find_package(BZip2 REQUIRED) + +add_definitions(-DCMAKE_EXPECTED_BZip2_VERSION="${BZip2_VERSION_STRING}") + +add_executable(test_tgt main.c) +target_link_libraries(test_tgt BZip2::BZip2) +add_test(NAME test_tgt COMMAND test_tgt) + +add_executable(test_var main.c) +target_include_directories(test_var PRIVATE ${BZIP2_INCLUDE_DIRS}) +target_link_libraries(test_var PRIVATE ${BZIP2_LIBRARIES}) +add_test(NAME test_var COMMAND test_var) diff --git a/Tests/FindBZip2/Test/main.c b/Tests/FindBZip2/Test/main.c new file mode 100644 index 0000000..8e24c94 --- /dev/null +++ b/Tests/FindBZip2/Test/main.c @@ -0,0 +1,23 @@ +#include <bzlib.h> +#include <stdio.h> +#include <stdlib.h> + +int main() +{ + int chunksize = 1024; + FILE* file = fopen("test.bzip2", "wb"); + char* buf = malloc(sizeof(char) * chunksize); + int error, rsize; + unsigned int in, out; + BZFILE* bzfile = BZ2_bzWriteOpen(&error, file, 64, 1, 10); + + /* Don't actually write anything for the purposes of the test */ + + BZ2_bzWriteClose(&error, bzfile, 1, &in, &out); + free(buf); + fclose(file); + + remove("test.bzip2"); + + return 0; +} diff --git a/Tests/RunCMake/AndroidMK/AndroidMK-check.cmake b/Tests/RunCMake/AndroidMK/AndroidMK-check.cmake new file mode 100644 index 0000000..691e326 --- /dev/null +++ b/Tests/RunCMake/AndroidMK/AndroidMK-check.cmake @@ -0,0 +1,30 @@ +# This file does a regex file compare on the generated +# Android.mk files from the AndroidMK test + +macro(compare_file_to_expected file expected_file) + file(READ "${file}" ANDROID_MK) + # clean up new lines + string(REGEX REPLACE "\r\n" "\n" ANDROID_MK "${ANDROID_MK}") + string(REGEX REPLACE "\n+$" "" ANDROID_MK "${ANDROID_MK}") + # read in the expected regex file + file(READ "${expected_file}" expected) + # clean up new lines + string(REGEX REPLACE "\r\n" "\n" expected "${expected}") + string(REGEX REPLACE "\n+$" "" expected "${expected}") + # compare the file to the expected regex and if there is not a match + # put an error message in RunCMake_TEST_FAILED + if(NOT "${ANDROID_MK}" MATCHES "${expected}") + set(RunCMake_TEST_FAILED + "${file} does not match ${expected_file}: + +Android.mk contents = [\n${ANDROID_MK}\n] +Expected = [\n${expected}\n]") + endif() +endmacro() + +compare_file_to_expected( +"${RunCMake_BINARY_DIR}/AndroidMK-build/Android.mk" +"${RunCMake_TEST_SOURCE_DIR}/expectedBuildAndroidMK.txt") +compare_file_to_expected( +"${RunCMake_BINARY_DIR}/AndroidMK-build/CMakeFiles/Export/share/ndk-modules/Android.mk" +"${RunCMake_TEST_SOURCE_DIR}/expectedInstallAndroidMK.txt") diff --git a/Tests/RunCMake/AndroidMK/AndroidMK.cmake b/Tests/RunCMake/AndroidMK/AndroidMK.cmake new file mode 100644 index 0000000..ed21e58 --- /dev/null +++ b/Tests/RunCMake/AndroidMK/AndroidMK.cmake @@ -0,0 +1,11 @@ +project(build) +set(CMAKE_BUILD_TYPE Debug) +add_library(foo foo.cxx) +add_library(car foo.cxx) +add_library(bar foo.cxx) +add_library(dog foo.cxx) +target_link_libraries(foo car bar dog debug -lm) +export(TARGETS bar dog car foo ANDROID_MK + ${build_BINARY_DIR}/Android.mk) +install(TARGETS bar dog car foo DESTINATION lib EXPORT myexp) +install(EXPORT_ANDROID_MK myexp DESTINATION share/ndk-modules) diff --git a/Tests/RunCMake/AndroidMK/CMakeLists.txt b/Tests/RunCMake/AndroidMK/CMakeLists.txt new file mode 100644 index 0000000..576787a --- /dev/null +++ b/Tests/RunCMake/AndroidMK/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.5) +project(${RunCMake_TEST} NONE) # or languages needed +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/AndroidMK/RunCMakeTest.cmake b/Tests/RunCMake/AndroidMK/RunCMakeTest.cmake new file mode 100644 index 0000000..786d45b --- /dev/null +++ b/Tests/RunCMake/AndroidMK/RunCMakeTest.cmake @@ -0,0 +1,2 @@ +include(RunCMake) +run_cmake(AndroidMK) diff --git a/Tests/RunCMake/AndroidMK/expectedBuildAndroidMK.txt b/Tests/RunCMake/AndroidMK/expectedBuildAndroidMK.txt new file mode 100644 index 0000000..def8fcb --- /dev/null +++ b/Tests/RunCMake/AndroidMK/expectedBuildAndroidMK.txt @@ -0,0 +1,23 @@ +LOCAL_PATH.*call my-dir.* +include.*CLEAR_VARS.* +LOCAL_MODULE.*bar +LOCAL_SRC_FILES.*bar.* +include.*PREBUILT_STATIC_LIBRARY.* +.* +include.*CLEAR_VARS.* +LOCAL_MODULE.*dog +LOCAL_SRC_FILES.*.*dog.* +include.*PREBUILT_STATIC_LIBRARY.* +.* +include.*CLEAR_VARS.* +LOCAL_MODULE.*car +LOCAL_SRC_FILES.*.*car.* +include.*PREBUILT_STATIC_LIBRARY.* +.* +include.*CLEAR_VARS.* +LOCAL_MODULE.*foo +LOCAL_SRC_FILES.*.*foo.* +LOCAL_CPP_FEATURES.*rtti exceptions +LOCAL_STATIC_LIBRARIES.*car bar dog +LOCAL_EXPORT_LDLIBS := -lm +include.*PREBUILT_STATIC_LIBRARY.* diff --git a/Tests/RunCMake/AndroidMK/expectedInstallAndroidMK.txt b/Tests/RunCMake/AndroidMK/expectedInstallAndroidMK.txt new file mode 100644 index 0000000..1bdb308 --- /dev/null +++ b/Tests/RunCMake/AndroidMK/expectedInstallAndroidMK.txt @@ -0,0 +1,25 @@ +LOCAL_PATH.*call my-dir.* +_IMPORT_PREFIX.*LOCAL_PATH./../.. + +include.*CLEAR_VARS.* +LOCAL_MODULE.*bar +LOCAL_SRC_FILES.*_IMPORT_PREFIX./lib.*bar.* +include.*PREBUILT_STATIC_LIBRARY.* + +include.*CLEAR_VARS. +LOCAL_MODULE.*dog +LOCAL_SRC_FILES.*_IMPORT_PREFIX./lib.*dog.* +include.*PREBUILT_STATIC_LIBRARY.* + +include.*CLEAR_VARS.* +LOCAL_MODULE.*car +LOCAL_SRC_FILES.*_IMPORT_PREFIX./lib.*car.* +include.*PREBUILT_STATIC_LIBRARY.* + +include.*CLEAR_VARS.* +LOCAL_MODULE.*foo +LOCAL_SRC_FILES.*_IMPORT_PREFIX\)/lib.*foo.* +LOCAL_CPP_FEATURES.*rtti exceptions +LOCAL_STATIC_LIBRARIES.*car bar dog +LOCAL_EXPORT_LDLIBS := -lm +include.*PREBUILT_STATIC_LIBRARY.* diff --git a/Tests/RunCMake/AndroidMK/foo.cxx b/Tests/RunCMake/AndroidMK/foo.cxx new file mode 100644 index 0000000..3695dc9 --- /dev/null +++ b/Tests/RunCMake/AndroidMK/foo.cxx @@ -0,0 +1,3 @@ +void foo() +{ +} diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index fa3d0f9..e36b2a6 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -331,6 +331,8 @@ add_RunCMake_test_group(CPack "DEB;RPM;TGZ") # for MSVC compilers CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS property is used add_RunCMake_test(AutoExportDll) +add_RunCMake_test(AndroidMK) + if(CMake_TEST_ANDROID_NDK OR CMake_TEST_ANDROID_STANDALONE_TOOLCHAIN) if(NOT "${CMAKE_GENERATOR}" MATCHES "Make|Ninja") message(FATAL_ERROR "Android tests supported only by Makefile and Ninja generators") diff --git a/Tests/RunCMake/GenerateExportHeader/GEH-failures.cmake b/Tests/RunCMake/GenerateExportHeader/GEH-failures.cmake new file mode 100644 index 0000000..7182cdf --- /dev/null +++ b/Tests/RunCMake/GenerateExportHeader/GEH-failures.cmake @@ -0,0 +1,67 @@ +set(failure_test_executables + ${CMAKE_CURRENT_BINARY_DIR}/failure_test_targets) +file(WRITE ${failure_test_executables} "") + +# Check if we should do anything. If the compiler doesn't support hidden +# visibility, the failure tests won't fail, so just write an empty targets +# list and punt. +if(NOT WIN32 AND NOT CYGWIN AND NOT COMPILER_HAS_HIDDEN_VISIBILITY) + return() +endif() + +# Read the input source file +file(READ ${CMAKE_CURRENT_SOURCE_DIR}/exportheader_test.cpp content_post) +set(content_pre "") + +# Generate source files for failure test executables +set(counter 0) +while(1) + # Find first occurrence of link error marker in remaining content + string(REGEX MATCH "//([^;\n]+;) LINK ERROR( [(][^)]+[)])?\n(.*)" + match "${content_post}") + if(match STREQUAL "") + # No more matches + break() + endif() + + # Shift content buffers and extract failing statement + string(LENGTH "${content_post}" content_post_length) + string(LENGTH "${match}" matched_length) + math(EXPR shift_length "${content_post_length} - ${matched_length}") + + string(SUBSTRING "${content_post}" 0 ${shift_length} shift) + set(content_pre "${content_pre}${shift}") + set(content_post "${CMAKE_MATCH_3}") + set(content_active "//${CMAKE_MATCH_1} LINK ERROR${CMAKE_MATCH_2}") + set(statement "${CMAKE_MATCH_1}") + + # Check if potential error is conditional, and evaluate condition if so + string(REGEX REPLACE " [(]([^)]+)[)]" "\\1" condition "${CMAKE_MATCH_2}") + if(NOT condition STREQUAL "") + string(REGEX REPLACE " +" ";" condition "${condition}") + if(${condition}) + else() + message(STATUS "Not testing '${statement}'; " + "condition (${condition}) is FALSE") + set(content_pre "${content_pre}// link error removed\n") + continue() + endif() + endif() + + if(NOT skip) + message(STATUS "Creating failure test for '${statement}'") + math(EXPR counter "${counter} + 1") + + # Write new source file + set(out ${CMAKE_CURRENT_BINARY_DIR}/exportheader_failtest-${counter}.cpp) + file(WRITE ${out} "${content_pre}${statement}\n${content_post}") + + # Add executable for failure test + add_executable(GEH-fail-${counter} EXCLUDE_FROM_ALL ${out}) + target_link_libraries(GEH-fail-${counter} ${link_libraries}) + file(APPEND ${failure_test_executables} "GEH-fail-${counter}\n") + endif() + + # Add placeholder where failing statement was removed + set(content_pre "${content_pre}${content_active}\n") +endwhile() diff --git a/Tests/RunCMake/GenerateExportHeader/GEH-link-error-result.txt b/Tests/RunCMake/GenerateExportHeader/GEH-link-error-result.txt new file mode 100644 index 0000000..d197c91 --- /dev/null +++ b/Tests/RunCMake/GenerateExportHeader/GEH-link-error-result.txt @@ -0,0 +1 @@ +[^0] diff --git a/Tests/RunCMake/GenerateExportHeader/GEH-link-error-stderr.txt b/Tests/RunCMake/GenerateExportHeader/GEH-link-error-stderr.txt new file mode 100644 index 0000000..8d98f9d --- /dev/null +++ b/Tests/RunCMake/GenerateExportHeader/GEH-link-error-stderr.txt @@ -0,0 +1 @@ +.* diff --git a/Tests/RunCMake/GenerateExportHeader/GEH.cmake b/Tests/RunCMake/GenerateExportHeader/GEH.cmake index ee0871b..cddba29 100644 --- a/Tests/RunCMake/GenerateExportHeader/GEH.cmake +++ b/Tests/RunCMake/GenerateExportHeader/GEH.cmake @@ -123,3 +123,5 @@ target_compile_definitions(GenerateExportHeader "SRC_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}/reference/${_platform}\"" "BIN_DIR=\"${CMAKE_CURRENT_BINARY_DIR}\"" ) + +include(${CMAKE_CURRENT_LIST_DIR}/GEH-failures.cmake) diff --git a/Tests/RunCMake/GenerateExportHeader/RunCMakeTest.cmake b/Tests/RunCMake/GenerateExportHeader/RunCMakeTest.cmake index e534c1f..9423ef5 100644 --- a/Tests/RunCMake/GenerateExportHeader/RunCMakeTest.cmake +++ b/Tests/RunCMake/GenerateExportHeader/RunCMakeTest.cmake @@ -12,6 +12,16 @@ function(run_GEH) run_cmake(GEH) run_cmake_command(GEH-build ${CMAKE_COMMAND} --build . --config Debug) run_cmake_command(GEH-run ${RunCMake_TEST_BINARY_DIR}/GenerateExportHeader) + + file(STRINGS "${RunCMake_TEST_BINARY_DIR}/failure_test_targets" + failure_test_targets) + + foreach(failure_test_target ${failure_test_targets}) + run_cmake_command(GEH-link-error ${CMAKE_COMMAND} + --build . + --config Debug + --target ${failure_test_target}) + endforeach() endfunction() run_GEH() diff --git a/Tests/RunCMake/GenerateExportHeader/exportheader_test.cpp b/Tests/RunCMake/GenerateExportHeader/exportheader_test.cpp index 26bea7e..7e3e0e4 100644 --- a/Tests/RunCMake/GenerateExportHeader/exportheader_test.cpp +++ b/Tests/RunCMake/GenerateExportHeader/exportheader_test.cpp @@ -3,14 +3,6 @@ #include "libstatic.h" -// #define BUILD_FAIL - -#ifndef BUILD_FAIL -#define DOES_NOT_BUILD(function) -#else -#define DOES_NOT_BUILD(function) function -#endif - #include <fstream> #include <iostream> #include <stdlib.h> @@ -64,74 +56,114 @@ void compare(const char* refName, const char* testName) int main() { { - Libshared l; - l.libshared(); - l.libshared_exported(); - l.libshared_deprecated(); - l.libshared_not_exported(); - - DOES_NOT_BUILD(l.libshared_excluded();) + libshared::Class l; + // l.method(); LINK ERROR + l.method_exported(); + // l.method_deprecated(); LINK ERROR + l.method_deprecated_exported(); + // l.method_excluded(); LINK ERROR + + // use_int(l.data); LINK ERROR + use_int(l.data_exported); + // use_int(l.data_excluded); LINK ERROR } { - LibsharedNotExported l; - DOES_NOT_BUILD(l.libshared();) - l.libshared_exported(); - l.libshared_deprecated(); - DOES_NOT_BUILD(l.libshared_not_exported();) - DOES_NOT_BUILD(l.libshared_excluded();) + libshared::ExportedClass l; + l.method(); + l.method_deprecated(); +#if defined(_WIN32) || defined(__CYGWIN__) + l.method_excluded(); +#else +// l.method_excluded(); LINK ERROR (NOT WIN32 AND NOT CYGWIN) +#endif + + use_int(l.data); +#if defined(_WIN32) || defined(__CYGWIN__) + use_int(l.data_excluded); +#else +// use_int(l.data_excluded); LINK ERROR (NOT WIN32 AND NOT CYGWIN) +#endif } { - LibsharedExcluded l; - DOES_NOT_BUILD(l.libshared();) - l.libshared_exported(); - l.libshared_deprecated(); - DOES_NOT_BUILD(l.libshared_not_exported();) - DOES_NOT_BUILD(l.libshared_excluded();) + libshared::ExcludedClass l; + // l.method(); LINK ERROR + l.method_exported(); + // l.method_deprecated(); LINK ERROR + l.method_deprecated_exported(); + // l.method_excluded(); LINK ERROR + + // use_int(l.data); LINK ERROR + use_int(l.data_exported); + // use_int(l.data_excluded); LINK ERROR } - libshared_exported(); - libshared_deprecated(); - DOES_NOT_BUILD(libshared_not_exported();) - DOES_NOT_BUILD(libshared_excluded();) + // libshared::function(); LINK ERROR + libshared::function_exported(); + // libshared::function_deprecated(); LINK ERROR + libshared::function_deprecated_exported(); + // libshared::function_excluded(); LINK ERROR + + // use_int(libshared::data); LINK ERROR + use_int(libshared::data_exported); + // use_int(libshared::data_excluded); LINK ERROR { - Libstatic l; - l.libstatic(); - l.libstatic_exported(); - l.libstatic_deprecated(); - l.libstatic_not_exported(); - l.libstatic_excluded(); + libstatic::Class l; + l.method(); + l.method_exported(); + l.method_deprecated(); + l.method_deprecated_exported(); + l.method_excluded(); + + use_int(l.data); + use_int(l.data_exported); + use_int(l.data_excluded); } { - LibstaticNotExported l; - l.libstatic(); - l.libstatic_exported(); - l.libstatic_deprecated(); - l.libstatic_not_exported(); - l.libstatic_excluded(); + libstatic::ExportedClass l; + l.method(); + l.method_exported(); + l.method_deprecated(); + l.method_deprecated_exported(); + l.method_excluded(); + + use_int(l.data); + use_int(l.data_exported); + use_int(l.data_excluded); } { - LibstaticExcluded l; - l.libstatic(); - l.libstatic_exported(); - l.libstatic_deprecated(); - l.libstatic_not_exported(); - l.libstatic_excluded(); + libstatic::ExcludedClass l; + l.method(); + l.method_exported(); + l.method_deprecated(); + l.method_deprecated_exported(); + l.method_excluded(); + + use_int(l.data); + use_int(l.data_exported); + use_int(l.data_excluded); } - libstatic_exported(); - libstatic_deprecated(); - libstatic_not_exported(); - libstatic_excluded(); + libstatic::function(); + libstatic::function_exported(); + libstatic::function_deprecated(); + libstatic::function_deprecated_exported(); + libstatic::function_excluded(); + + use_int(libstatic::data); + use_int(libstatic::data_exported); + use_int(libstatic::data_excluded); +#if defined(SRC_DIR) && defined(BIN_DIR) compare(SRC_DIR "/libshared_export.h", BIN_DIR "/libshared/libshared_export.h"); compare(SRC_DIR "/libstatic_export.h", BIN_DIR "/libstatic/libstatic_export.h"); +#endif return 0; } diff --git a/Tests/RunCMake/GenerateExportHeader/lib_shared_and_static/libshared_and_static.cpp b/Tests/RunCMake/GenerateExportHeader/lib_shared_and_static/libshared_and_static.cpp index 846c207..9ac8381 100644 --- a/Tests/RunCMake/GenerateExportHeader/lib_shared_and_static/libshared_and_static.cpp +++ b/Tests/RunCMake/GenerateExportHeader/lib_shared_and_static/libshared_and_static.cpp @@ -1,106 +1,121 @@ - #include "libshared_and_static.h" #ifndef MY_CUSTOM_CONTENT_ADDED #error "MY_CUSTOM_CONTENT_ADDED not defined!" #endif -int LibsharedAndStatic::libshared_and_static() const +int libshared_and_static::Class::method() const { return 0; } -int LibsharedAndStatic::libshared_and_static_exported() const +int libshared_and_static::Class::method_exported() const { return 0; } -int LibsharedAndStatic::libshared_and_static_deprecated() const +int libshared_and_static::Class::method_deprecated() const { return 0; } -int LibsharedAndStatic::libshared_and_static_not_exported() const +int libshared_and_static::Class::method_deprecated_exported() const { return 0; } -int LibsharedAndStatic::libshared_and_static_excluded() const +int libshared_and_static::Class::method_excluded() const { return 0; } -int LibsharedAndStaticNotExported::libshared_and_static() const -{ - return 0; -} +int const libshared_and_static::Class::data = 1; -int LibsharedAndStaticNotExported::libshared_and_static_exported() const +int const libshared_and_static::Class::data_exported = 1; + +int const libshared_and_static::Class::data_excluded = 1; + +int libshared_and_static::ExportedClass::method() const { return 0; } -int LibsharedAndStaticNotExported::libshared_and_static_deprecated() const +int libshared_and_static::ExportedClass::method_deprecated() const { return 0; } -int LibsharedAndStaticNotExported::libshared_and_static_not_exported() const +int libshared_and_static::ExportedClass::method_excluded() const { return 0; } -int LibsharedAndStaticNotExported::libshared_and_static_excluded() const +int const libshared_and_static::ExportedClass::data = 1; + +int const libshared_and_static::ExportedClass::data_excluded = 1; + +int libshared_and_static::ExcludedClass::method() const { return 0; } -int LibsharedAndStaticExcluded::libshared_and_static() const +int libshared_and_static::ExcludedClass::method_exported() const { return 0; } -int LibsharedAndStaticExcluded::libshared_and_static_exported() const +int libshared_and_static::ExcludedClass::method_deprecated() const { return 0; } -int LibsharedAndStaticExcluded::libshared_and_static_deprecated() const +int libshared_and_static::ExcludedClass::method_deprecated_exported() const { return 0; } -int LibsharedAndStaticExcluded::libshared_and_static_not_exported() const +int libshared_and_static::ExcludedClass::method_excluded() const { return 0; } -int LibsharedAndStaticExcluded::libshared_and_static_excluded() const +int const libshared_and_static::ExcludedClass::data = 1; + +int const libshared_and_static::ExcludedClass::data_exported = 1; + +int const libshared_and_static::ExcludedClass::data_excluded = 1; + +int libshared_and_static::function() { return 0; } -int libshared_and_static() +int libshared_and_static::function_exported() { return 0; } -int libshared_and_static_exported() +int libshared_and_static::function_deprecated() { return 0; } -int libshared_and_static_deprecated() +int libshared_and_static::function_deprecated_exported() { return 0; } -int libshared_and_static_not_exported() +int libshared_and_static::function_excluded() { return 0; } -int libshared_and_static_excluded() +int const libshared_and_static::data = 1; + +int const libshared_and_static::data_exported = 1; + +int const libshared_and_static::data_excluded = 1; + +void use_int(int) { - return 0; } diff --git a/Tests/RunCMake/GenerateExportHeader/lib_shared_and_static/libshared_and_static.h b/Tests/RunCMake/GenerateExportHeader/lib_shared_and_static/libshared_and_static.h index ea672fe..2c3fcfd 100644 --- a/Tests/RunCMake/GenerateExportHeader/lib_shared_and_static/libshared_and_static.h +++ b/Tests/RunCMake/GenerateExportHeader/lib_shared_and_static/libshared_and_static.h @@ -1,66 +1,83 @@ - -#ifndef SHARED_AND_STATIC_H -#define SHARED_AND_STATIC_H +#ifndef LIBSHARED_AND_STATIC_H +#define LIBSHARED_AND_STATIC_H #include "libshared_and_static_export.h" -class MYPREFIX_LIBSHARED_AND_STATIC_EXPORT LibsharedAndStatic +namespace libshared_and_static { + +class Class { public: - int libshared_and_static() const; + int method() const; + + int MYPREFIX_LIBSHARED_AND_STATIC_EXPORT method_exported() const; + + int MYPREFIX_LIBSHARED_AND_STATIC_DEPRECATED method_deprecated() const; - int libshared_and_static_exported() const; + int MYPREFIX_LIBSHARED_AND_STATIC_DEPRECATED_EXPORT + method_deprecated_exported() const; - int MYPREFIX_LIBSHARED_AND_STATIC_DEPRECATED - libshared_and_static_deprecated() const; + int MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT method_excluded() const; - int libshared_and_static_not_exported() const; + static int const data; - int MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT - libshared_and_static_excluded() const; + static int const MYPREFIX_LIBSHARED_AND_STATIC_EXPORT data_exported; + + static int const MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT data_excluded; }; -class LibsharedAndStaticNotExported +class MYPREFIX_LIBSHARED_AND_STATIC_EXPORT ExportedClass { public: - int libshared_and_static() const; + int method() const; - int MYPREFIX_LIBSHARED_AND_STATIC_EXPORT - libshared_and_static_exported() const; + int MYPREFIX_LIBSHARED_AND_STATIC_DEPRECATED method_deprecated() const; - int MYPREFIX_LIBSHARED_AND_STATIC_DEPRECATED - libshared_and_static_deprecated() const; + int MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT method_excluded() const; - int libshared_and_static_not_exported() const; + static int const data; - int MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT - libshared_and_static_excluded() const; + static int const MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT data_excluded; }; -class MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT LibsharedAndStaticExcluded +class MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT ExcludedClass { public: - int libshared_and_static() const; + int method() const; + + int MYPREFIX_LIBSHARED_AND_STATIC_EXPORT method_exported() const; + + int MYPREFIX_LIBSHARED_AND_STATIC_DEPRECATED method_deprecated() const; - int MYPREFIX_LIBSHARED_AND_STATIC_EXPORT - libshared_and_static_exported() const; + int MYPREFIX_LIBSHARED_AND_STATIC_DEPRECATED_EXPORT + method_deprecated_exported() const; - int MYPREFIX_LIBSHARED_AND_STATIC_DEPRECATED - libshared_and_static_deprecated() const; + int MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT method_excluded() const; - int libshared_and_static_not_exported() const; + static int const data; - int MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT - libshared_and_static_excluded() const; + static int const MYPREFIX_LIBSHARED_AND_STATIC_EXPORT data_exported; + + static int const MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT data_excluded; }; -MYPREFIX_LIBSHARED_AND_STATIC_EXPORT int libshared_and_static_exported(); +int function(); + +int MYPREFIX_LIBSHARED_AND_STATIC_EXPORT function_exported(); + +int MYPREFIX_LIBSHARED_AND_STATIC_DEPRECATED function_deprecated(); + +int MYPREFIX_LIBSHARED_AND_STATIC_DEPRECATED_EXPORT +function_deprecated_exported(); + +int MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT function_excluded(); + +extern int const data; -MYPREFIX_LIBSHARED_AND_STATIC_DEPRECATED_EXPORT int -libshared_and_static_deprecated(); +extern int const MYPREFIX_LIBSHARED_AND_STATIC_EXPORT data_exported; -int libshared_and_static_not_exported(); +extern int const MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT data_excluded; -int MYPREFIX_LIBSHARED_AND_STATIC_NO_EXPORT libshared_and_static_excluded(); +} // namespace libshared_and_static #endif diff --git a/Tests/RunCMake/GenerateExportHeader/libshared/libshared.cpp b/Tests/RunCMake/GenerateExportHeader/libshared/libshared.cpp index ad6d356..328ef6f 100644 --- a/Tests/RunCMake/GenerateExportHeader/libshared/libshared.cpp +++ b/Tests/RunCMake/GenerateExportHeader/libshared/libshared.cpp @@ -1,102 +1,117 @@ - #include "libshared.h" -int Libshared::libshared() const +int libshared::Class::method() const { return 0; } -int Libshared::libshared_exported() const +int libshared::Class::method_exported() const { return 0; } -int Libshared::libshared_deprecated() const +int libshared::Class::method_deprecated() const { return 0; } -int Libshared::libshared_not_exported() const +int libshared::Class::method_deprecated_exported() const { return 0; } -int Libshared::libshared_excluded() const +int libshared::Class::method_excluded() const { return 0; } -int LibsharedNotExported::libshared() const -{ - return 0; -} +int const libshared::Class::data = 1; -int LibsharedNotExported::libshared_exported() const +int const libshared::Class::data_exported = 1; + +int const libshared::Class::data_excluded = 1; + +int libshared::ExportedClass::method() const { return 0; } -int LibsharedNotExported::libshared_deprecated() const +int libshared::ExportedClass::method_deprecated() const { return 0; } -int LibsharedNotExported::libshared_not_exported() const +int libshared::ExportedClass::method_excluded() const { return 0; } -int LibsharedNotExported::libshared_excluded() const +int const libshared::ExportedClass::data = 1; + +int const libshared::ExportedClass::data_excluded = 1; + +int libshared::ExcludedClass::method() const { return 0; } -int LibsharedExcluded::libshared() const +int libshared::ExcludedClass::method_exported() const { return 0; } -int LibsharedExcluded::libshared_exported() const +int libshared::ExcludedClass::method_deprecated() const { return 0; } -int LibsharedExcluded::libshared_deprecated() const +int libshared::ExcludedClass::method_deprecated_exported() const { return 0; } -int LibsharedExcluded::libshared_not_exported() const +int libshared::ExcludedClass::method_excluded() const { return 0; } -int LibsharedExcluded::libshared_excluded() const +int const libshared::ExcludedClass::data = 1; + +int const libshared::ExcludedClass::data_exported = 1; + +int const libshared::ExcludedClass::data_excluded = 1; + +int libshared::function() { return 0; } -int libshared() +int libshared::function_exported() { return 0; } -int libshared_exported() +int libshared::function_deprecated() { return 0; } -int libshared_deprecated() +int libshared::function_deprecated_exported() { return 0; } -int libshared_not_exported() +int libshared::function_excluded() { return 0; } -int libshared_excluded() +int const libshared::data = 1; + +int const libshared::data_exported = 1; + +int const libshared::data_excluded = 1; + +void use_int(int) { - return 0; } diff --git a/Tests/RunCMake/GenerateExportHeader/libshared/libshared.h b/Tests/RunCMake/GenerateExportHeader/libshared/libshared.h index bd9f2e3..6574bd5 100644 --- a/Tests/RunCMake/GenerateExportHeader/libshared/libshared.h +++ b/Tests/RunCMake/GenerateExportHeader/libshared/libshared.h @@ -1,57 +1,82 @@ - #ifndef LIBSHARED_H #define LIBSHARED_H #include "libshared_export.h" -class LIBSHARED_EXPORT Libshared +namespace libshared { + +class Class { public: - int libshared() const; + int method() const; + + int LIBSHARED_EXPORT method_exported() const; + + int LIBSHARED_DEPRECATED method_deprecated() const; - int libshared_exported() const; + int LIBSHARED_DEPRECATED_EXPORT method_deprecated_exported() const; - int LIBSHARED_DEPRECATED libshared_deprecated() const; + int LIBSHARED_NO_EXPORT method_excluded() const; - int libshared_not_exported() const; + static int const data; - int LIBSHARED_NO_EXPORT libshared_excluded() const; + static int const LIBSHARED_EXPORT data_exported; + + static int const LIBSHARED_NO_EXPORT data_excluded; }; -class LibsharedNotExported +class LIBSHARED_EXPORT ExportedClass { public: - int libshared() const; + int method() const; - int LIBSHARED_EXPORT libshared_exported() const; + int LIBSHARED_DEPRECATED method_deprecated() const; - int LIBSHARED_DEPRECATED_EXPORT libshared_deprecated() const; + int LIBSHARED_NO_EXPORT method_excluded() const; - int libshared_not_exported() const; + static int const data; - int LIBSHARED_NO_EXPORT libshared_excluded() const; + static int const LIBSHARED_NO_EXPORT data_excluded; }; -class LIBSHARED_NO_EXPORT LibsharedExcluded +class LIBSHARED_NO_EXPORT ExcludedClass { public: - int libshared() const; + int method() const; + + int LIBSHARED_EXPORT method_exported() const; + + int LIBSHARED_DEPRECATED method_deprecated() const; - int LIBSHARED_EXPORT libshared_exported() const; + int LIBSHARED_DEPRECATED_EXPORT method_deprecated_exported() const; - int LIBSHARED_DEPRECATED_EXPORT libshared_deprecated() const; + int LIBSHARED_NO_EXPORT method_excluded() const; - int libshared_not_exported() const; + static int const data; - int LIBSHARED_NO_EXPORT libshared_excluded() const; + static int const LIBSHARED_EXPORT data_exported; + + static int const LIBSHARED_NO_EXPORT data_excluded; }; -LIBSHARED_EXPORT int libshared_exported(); +int function(); + +int LIBSHARED_EXPORT function_exported(); + +int LIBSHARED_DEPRECATED function_deprecated(); + +int LIBSHARED_DEPRECATED_EXPORT function_deprecated_exported(); + +int LIBSHARED_NO_EXPORT function_excluded(); + +extern int const data; + +extern int const LIBSHARED_EXPORT data_exported; -LIBSHARED_DEPRECATED_EXPORT int libshared_deprecated(); +extern int const LIBSHARED_NO_EXPORT data_excluded; -int libshared_not_exported(); +} // namespace libshared -int LIBSHARED_NO_EXPORT libshared_excluded(); +LIBSHARED_EXPORT void use_int(int); #endif diff --git a/Tests/RunCMake/GenerateExportHeader/libstatic/libstatic.cpp b/Tests/RunCMake/GenerateExportHeader/libstatic/libstatic.cpp index 89381af..e1d1255 100644 --- a/Tests/RunCMake/GenerateExportHeader/libstatic/libstatic.cpp +++ b/Tests/RunCMake/GenerateExportHeader/libstatic/libstatic.cpp @@ -1,97 +1,125 @@ - #include "libstatic.h" -int Libstatic::libstatic() const +int libstatic::Class::method() const { return 0; } -int Libstatic::libstatic_exported() const +int libstatic::Class::method_exported() const { return 0; } -int Libstatic::libstatic_deprecated() const +int libstatic::Class::method_deprecated() const { return 0; } -int Libstatic::libstatic_not_exported() const +int libstatic::Class::method_deprecated_exported() const { return 0; } -int Libstatic::libstatic_excluded() const +int libstatic::Class::method_excluded() const { return 0; } -int LibstaticNotExported::libstatic() const +int const libstatic::Class::data = 1; + +int const libstatic::Class::data_exported = 1; + +int const libstatic::Class::data_excluded = 1; + +int libstatic::ExportedClass::method() const { return 0; } -int LibstaticNotExported::libstatic_exported() const +int libstatic::ExportedClass::method_exported() const { return 0; } -int LibstaticNotExported::libstatic_deprecated() const +int libstatic::ExportedClass::method_deprecated() const { return 0; } -int LibstaticNotExported::libstatic_not_exported() const +int libstatic::ExportedClass::method_deprecated_exported() const { return 0; } -int LibstaticNotExported::libstatic_excluded() const +int libstatic::ExportedClass::method_excluded() const { return 0; } -int LibstaticExcluded::libstatic() const +int const libstatic::ExportedClass::data = 1; + +int const libstatic::ExportedClass::data_exported = 1; + +int const libstatic::ExportedClass::data_excluded = 1; + +int libstatic::ExcludedClass::method() const { return 0; } -int LibstaticExcluded::libstatic_exported() const +int libstatic::ExcludedClass::method_exported() const { return 0; } -int LibstaticExcluded::libstatic_deprecated() const +int libstatic::ExcludedClass::method_deprecated() const { return 0; } -int LibstaticExcluded::libstatic_not_exported() const +int libstatic::ExcludedClass::method_deprecated_exported() const { return 0; } -int LibstaticExcluded::libstatic_excluded() const +int libstatic::ExcludedClass::method_excluded() const { return 0; } -int libstatic_exported() +int const libstatic::ExcludedClass::data = 1; + +int const libstatic::ExcludedClass::data_exported = 1; + +int const libstatic::ExcludedClass::data_excluded = 1; + +int libstatic::function() +{ + return 0; +} + +int libstatic::function_exported() { return 0; } -int libstatic_deprecated() +int libstatic::function_deprecated() { return 0; } -int libstatic_not_exported() +int libstatic::function_deprecated_exported() { return 0; } -int libstatic_excluded() +int libstatic::function_excluded() { return 0; } + +int const libstatic::data = 1; + +int const libstatic::data_exported = 1; + +int const libstatic::data_excluded = 1; diff --git a/Tests/RunCMake/GenerateExportHeader/libstatic/libstatic.h b/Tests/RunCMake/GenerateExportHeader/libstatic/libstatic.h index 6072d9b..1017e12 100644 --- a/Tests/RunCMake/GenerateExportHeader/libstatic/libstatic.h +++ b/Tests/RunCMake/GenerateExportHeader/libstatic/libstatic.h @@ -1,57 +1,86 @@ - #ifndef LIBSTATIC_H #define LIBSTATIC_H #include "libstatic_export.h" -class LIBSTATIC_EXPORT Libstatic +namespace libstatic { + +class Class { public: - int libstatic() const; + int method() const; + + int LIBSTATIC_EXPORT method_exported() const; + + int LIBSTATIC_DEPRECATED method_deprecated() const; - int libstatic_exported() const; + int LIBSTATIC_DEPRECATED_EXPORT method_deprecated_exported() const; - int LIBSTATIC_DEPRECATED libstatic_deprecated() const; + int LIBSTATIC_NO_EXPORT method_excluded() const; - int libstatic_not_exported() const; + static int const data; - int LIBSTATIC_NO_EXPORT libstatic_excluded() const; + static int const LIBSTATIC_EXPORT data_exported; + + static int const LIBSTATIC_NO_EXPORT data_excluded; }; -class LibstaticNotExported +class LIBSTATIC_EXPORT ExportedClass { public: - int libstatic() const; + int method() const; + + int LIBSTATIC_EXPORT method_exported() const; + + int LIBSTATIC_DEPRECATED method_deprecated() const; + + int LIBSTATIC_DEPRECATED_EXPORT method_deprecated_exported() const; - int LIBSTATIC_EXPORT libstatic_exported() const; + int LIBSTATIC_NO_EXPORT method_excluded() const; - int LIBSTATIC_DEPRECATED libstatic_deprecated() const; + static int const data; - int libstatic_not_exported() const; + static int const LIBSTATIC_EXPORT data_exported; - int LIBSTATIC_NO_EXPORT libstatic_excluded() const; + static int const LIBSTATIC_NO_EXPORT data_excluded; }; -class LIBSTATIC_NO_EXPORT LibstaticExcluded +class LIBSTATIC_NO_EXPORT ExcludedClass { public: - int libstatic() const; + int method() const; - int LIBSTATIC_EXPORT libstatic_exported() const; + int LIBSTATIC_EXPORT method_exported() const; - int LIBSTATIC_DEPRECATED libstatic_deprecated() const; + int LIBSTATIC_DEPRECATED method_deprecated() const; - int libstatic_not_exported() const; + int LIBSTATIC_DEPRECATED_EXPORT method_deprecated_exported() const; - int LIBSTATIC_NO_EXPORT libstatic_excluded() const; + int LIBSTATIC_NO_EXPORT method_excluded() const; + + static int const data; + + static int const LIBSTATIC_EXPORT data_exported; + + static int const LIBSTATIC_NO_EXPORT data_excluded; }; -LIBSTATIC_EXPORT int libstatic_exported(); +int function(); + +int LIBSTATIC_EXPORT function_exported(); + +int LIBSTATIC_DEPRECATED function_deprecated(); + +int LIBSTATIC_DEPRECATED_EXPORT function_deprecated_exported(); + +int LIBSTATIC_NO_EXPORT function_excluded(); + +extern int const data; -LIBSTATIC_DEPRECATED_EXPORT int libstatic_deprecated(); +extern int const LIBSTATIC_EXPORT data_exported; -int libstatic_not_exported(); +extern int const LIBSTATIC_NO_EXPORT data_excluded; -int LIBSTATIC_NO_EXPORT libstatic_excluded(); +} // namespace libstatic #endif diff --git a/Tests/RunCMake/file/DOWNLOAD-pass-not-set-result.txt b/Tests/RunCMake/file/DOWNLOAD-pass-not-set-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/DOWNLOAD-pass-not-set-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/DOWNLOAD-pass-not-set-stderr.txt b/Tests/RunCMake/file/DOWNLOAD-pass-not-set-stderr.txt new file mode 100644 index 0000000..2fa2731 --- /dev/null +++ b/Tests/RunCMake/file/DOWNLOAD-pass-not-set-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at DOWNLOAD-pass-not-set.cmake:[0-9]+ \(file\): + file DOWNLOAD missing string for USERPWD. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/file/DOWNLOAD-pass-not-set.cmake b/Tests/RunCMake/file/DOWNLOAD-pass-not-set.cmake new file mode 100644 index 0000000..61eff6d --- /dev/null +++ b/Tests/RunCMake/file/DOWNLOAD-pass-not-set.cmake @@ -0,0 +1 @@ +file(DOWNLOAD "" "" USERPWD) diff --git a/Utilities/Release/Cygwin/cygwin-patch.diff.in b/Tests/RunCMake/file/DOWNLOAD-unused-argument-result.txt index e69de29..e69de29 100644 --- a/Utilities/Release/Cygwin/cygwin-patch.diff.in +++ b/Tests/RunCMake/file/DOWNLOAD-unused-argument-result.txt diff --git a/Tests/RunCMake/file/DOWNLOAD-unused-argument-stderr.txt b/Tests/RunCMake/file/DOWNLOAD-unused-argument-stderr.txt new file mode 100644 index 0000000..82a78c9 --- /dev/null +++ b/Tests/RunCMake/file/DOWNLOAD-unused-argument-stderr.txt @@ -0,0 +1,5 @@ +^CMake Warning \(dev\) at DOWNLOAD-unused-argument.cmake:[0-9]+ \(file\): + Unexpected argument: JUNK +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/file/DOWNLOAD-unused-argument.cmake b/Tests/RunCMake/file/DOWNLOAD-unused-argument.cmake new file mode 100644 index 0000000..2e3fbe1 --- /dev/null +++ b/Tests/RunCMake/file/DOWNLOAD-unused-argument.cmake @@ -0,0 +1,5 @@ +file(DOWNLOAD + "file://${CMAKE_CURRENT_SOURCE_DIR}/DOWNLOAD-unused-argument.txt" + "${CMAKE_CURRENT_BINARY_DIR}/unused-argument.txt" + JUNK + ) diff --git a/Tests/RunCMake/file/DOWNLOAD-unused-argument.txt b/Tests/RunCMake/file/DOWNLOAD-unused-argument.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/file/DOWNLOAD-unused-argument.txt diff --git a/Tests/RunCMake/file/RunCMakeTest.cmake b/Tests/RunCMake/file/RunCMakeTest.cmake index 5f85bba..d8e9ce0 100644 --- a/Tests/RunCMake/file/RunCMakeTest.cmake +++ b/Tests/RunCMake/file/RunCMakeTest.cmake @@ -1,6 +1,10 @@ include(RunCMake) run_cmake(DOWNLOAD-hash-mismatch) +run_cmake(DOWNLOAD-unused-argument) +run_cmake(DOWNLOAD-pass-not-set) +run_cmake(UPLOAD-unused-argument) +run_cmake(UPLOAD-pass-not-set) run_cmake(INSTALL-DIRECTORY) run_cmake(INSTALL-MESSAGE-bad) run_cmake(FileOpenFailRead) diff --git a/Tests/RunCMake/file/UPLOAD-pass-not-set-result.txt b/Tests/RunCMake/file/UPLOAD-pass-not-set-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/file/UPLOAD-pass-not-set-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/file/UPLOAD-pass-not-set-stderr.txt b/Tests/RunCMake/file/UPLOAD-pass-not-set-stderr.txt new file mode 100644 index 0000000..089c0ad --- /dev/null +++ b/Tests/RunCMake/file/UPLOAD-pass-not-set-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at UPLOAD-pass-not-set.cmake:[0-9]+ \(file\): + file UPLOAD missing string for USERPWD. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/file/UPLOAD-pass-not-set.cmake b/Tests/RunCMake/file/UPLOAD-pass-not-set.cmake new file mode 100644 index 0000000..4f3d86c --- /dev/null +++ b/Tests/RunCMake/file/UPLOAD-pass-not-set.cmake @@ -0,0 +1 @@ +file(UPLOAD "" "" USERPWD) diff --git a/Tests/RunCMake/file/UPLOAD-unused-argument-result.txt b/Tests/RunCMake/file/UPLOAD-unused-argument-result.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/file/UPLOAD-unused-argument-result.txt diff --git a/Tests/RunCMake/file/UPLOAD-unused-argument-stderr.txt b/Tests/RunCMake/file/UPLOAD-unused-argument-stderr.txt new file mode 100644 index 0000000..3c1b744 --- /dev/null +++ b/Tests/RunCMake/file/UPLOAD-unused-argument-stderr.txt @@ -0,0 +1,5 @@ +^CMake Warning \(dev\) at UPLOAD-unused-argument.cmake:[0-9]+ \(file\): + Unexpected argument: JUNK +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) +This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/file/UPLOAD-unused-argument.cmake b/Tests/RunCMake/file/UPLOAD-unused-argument.cmake new file mode 100644 index 0000000..94ac9ac --- /dev/null +++ b/Tests/RunCMake/file/UPLOAD-unused-argument.cmake @@ -0,0 +1,5 @@ +file(UPLOAD + "${CMAKE_CURRENT_SOURCE_DIR}/UPLOAD-unused-argument.txt" + "file://${CMAKE_CURRENT_BINARY_DIR}/unused-argument.txt" + JUNK + ) diff --git a/Tests/RunCMake/file/UPLOAD-unused-argument.txt b/Tests/RunCMake/file/UPLOAD-unused-argument.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/file/UPLOAD-unused-argument.txt diff --git a/Utilities/Release/Cygwin/CMakeLists.txt b/Utilities/Release/Cygwin/CMakeLists.txt deleted file mode 100644 index 73a8220..0000000 --- a/Utilities/Release/Cygwin/CMakeLists.txt +++ /dev/null @@ -1,25 +0,0 @@ -file(GLOB INSTALLED_CURSES /usr/bin/cygncurses-*.dll) -set(MAX 0) -foreach(f ${INSTALLED_CURSES}) - if(NOT "${f}" MATCHES "\\+") - string(REGEX REPLACE ".*-([0-9]*).dll" "\\1" NUMBER "${f}") - if(NUMBER GREATER MAX) - set(MAX ${NUMBER}) - endif() - endif() -endforeach() -string(REGEX REPLACE "/usr/bin/" "\\1" NUMBER "${f}") -set(CMAKE_NCURSES_VERSION "libncurses${MAX}") -message(STATUS "Using curses version: libncurses${MAX}") -configure_file("${CMake_SOURCE_DIR}/Utilities/Release/Cygwin/cygwin-setup.hint.in" - "${CMake_BINARY_DIR}/setup.hint") -configure_file("${CMake_SOURCE_DIR}/Utilities/Release/Cygwin/README.cygwin.in" - "${CMake_BINARY_DIR}/Docs/${CPACK_PACKAGE_FILE_NAME}-${CPACK_CYGWIN_PATCH_NUMBER}.README") -install_files(/share/doc/Cygwin FILES - ${CMake_BINARY_DIR}/Docs/${CPACK_PACKAGE_FILE_NAME}-${CPACK_CYGWIN_PATCH_NUMBER}.README - ) -configure_file("${CMake_SOURCE_DIR}/Utilities/Release/Cygwin/cygwin-package.sh.in" - ${CPACK_CYGWIN_BUILD_SCRIPT}) -configure_file("${CMake_SOURCE_DIR}/Utilities/Release/Cygwin/cygwin-patch.diff.in" - ${CPACK_CYGWIN_PATCH_FILE}) - diff --git a/Utilities/Release/Cygwin/README.cygwin.in b/Utilities/Release/Cygwin/README.cygwin.in deleted file mode 100644 index 17cf2a1..0000000 --- a/Utilities/Release/Cygwin/README.cygwin.in +++ /dev/null @@ -1,42 +0,0 @@ -cmake --------------------------------------- -Runtime requirements: - cygwin-1.5.21(0.156/4/2) or newer - -Build requirements - cygwin-1.5.21(0.156/4/2) or newer - make - -Canonical homepage: - https://cmake.org - -Canonical download: - ftp://www.cmake.org/pub/cmake/ - ------------------------------------- - -Build instructions: - unpack @CPACK_PACKAGE_FILE_NAME@-@CPACK_CYGWIN_PATCH_NUMBER@-src.tar.bz2 - if you use setup to install this src package, it will be - unpacked under /usr/src automatically - cd /usr/src - ./@CPACK_PACKAGE_FILE_NAME@-@CPACK_CYGWIN_PATCH_NUMBER@.sh all - -This will create: - /usr/src/@CPACK_PACKAGE_FILE_NAME@.tar.bz2 - /usr/src/@CPACK_PACKAGE_FILE_NAME@-@CPACK_CYGWIN_PATCH_NUMBER@-src.tar.bz2 - -------------------------------------------- - -Port Notes: - -The directory /usr/share/@CPACK_PACKAGE_FILE_NAME@/include is purposely not -located at /usr/include/@CPACK_PACKAGE_FILE_NAME@ or /usr/include/cmake. The -files it contains are not meant for inclusion in any C or C++ program. -They are used for compiling dynamically loadable CMake commands inside -projects that provide them. CMake will automatically provide the -proper include path when the files are needed. - ------------------- - -Cygwin port maintained by: CMake Developers <cmake@www.cmake.org> diff --git a/Utilities/Release/Cygwin/cygwin-package.sh.in b/Utilities/Release/Cygwin/cygwin-package.sh.in deleted file mode 100755 index dff27f1..0000000 --- a/Utilities/Release/Cygwin/cygwin-package.sh.in +++ /dev/null @@ -1,90 +0,0 @@ -TOP_DIR=`cd \`echo "$0" | sed -n '/\//{s/\/[^\/]*$//;p;}'\`;pwd` - -# create build directory -mkdirs() -{ - ( - mkdir -p "$TOP_DIR/@CPACK_PACKAGE_FILE_NAME@/.build" - ) -} - -# cd into -# untar source tree and apply patch -prep() -{ - ( - cd "$TOP_DIR" && - tar xvfj @CPACK_PACKAGE_FILE_NAME@.tar.bz2 - patch -p0 < "@CPACK_PACKAGE_FILE_NAME@-@CPACK_CYGWIN_PATCH_NUMBER@.patch" && - mkdirs - ) -} - -conf() -{ - ( - cd "$TOP_DIR/@CPACK_PACKAGE_FILE_NAME@/.build" && - ../bootstrap --parallel=2 - ) -} - -build() -{ - ( - cd "$TOP_DIR/@CPACK_PACKAGE_FILE_NAME@/.build" && - make -j2 && - make test - ) -} - -clean() -{ - ( - cd "$TOP_DIR/@CPACK_PACKAGE_FILE_NAME@/.build" && - make clean - ) -} - -pkg() -{ - ( - cd "$TOP_DIR/@CPACK_PACKAGE_FILE_NAME@/.build" && - ./bin/cpack && - mv @CPACK_PACKAGE_FILE_NAME@-@CPACK_CYGWIN_PATCH_NUMBER@.tar.bz2 "$TOP_DIR" - ) -} - -spkg() -{ - ( - cd "$TOP_DIR/@CPACK_PACKAGE_FILE_NAME@/.build" && - ./bin/cpack --config CPackSourceConfig.cmake && - mv @CPACK_PACKAGE_FILE_NAME@-@CPACK_CYGWIN_PATCH_NUMBER@-src.tar.bz2 "$TOP_DIR" - ) -} - -finish() -{ - ( - rm -rf "@CPACK_PACKAGE_FILE_NAME@" - ) -} - -case $1 in - prep) prep ; STATUS=$? ;; - mkdirs) mkdirs ; STATUS=$? ;; - conf) conf ; STATUS=$? ;; - build) build ; STATUS=$? ;; - clean) clean ; STATUS=$? ;; - package) pkg ; STATUS=$? ;; - pkg) pkg ; STATUS=$? ;; - src-package) spkg ; STATUS=$? ;; - spkg) spkg ; STATUS=$? ;; - finish) finish ; STATUS=$? ;; - all) ( - prep && conf && build && pkg && spkg && finish ; - STATUS=$? - ) ;; - *) echo "Error: bad argument (all or one of these: prep mkdirs conf build clean package pkg src-package spkg finish)" ; exit 1 ;; -esac -exit ${STATUS} diff --git a/Utilities/Release/Cygwin/cygwin-setup.hint.in b/Utilities/Release/Cygwin/cygwin-setup.hint.in deleted file mode 100644 index a2532fc..0000000 --- a/Utilities/Release/Cygwin/cygwin-setup.hint.in +++ /dev/null @@ -1,5 +0,0 @@ -# CMake setup.hint file for cygwin setup.exe program -category: Devel -requires: libgcc1 libidn11 @CMAKE_NCURSES_VERSION@ libstdc++6 -sdesc: "A cross platform build manager" -ldesc: "CMake is a cross platform build manager. It allows you to specify build parameters for C and C++ programs in a cross platform manner. For cygwin Makefiles will be generated. CMake is also capable of generating microsoft project files, nmake, and borland makefiles. CMake can also perform system inspection operations like finding installed libraries and header files." diff --git a/Utilities/Release/README b/Utilities/Release/README index 12eafe1..ed1d52e 100644 --- a/Utilities/Release/README +++ b/Utilities/Release/README @@ -15,7 +15,4 @@ Then as kitware@hythloth, using an up-to-date CMake: create-cmake-release.cmake: script to run to create release sh scripts Add or remove machines in create-cmake-release.cmake. -Cygwin -> directory that contains cpack cygwin package files used in - CMakeCPack.cmake - machine_release.cmake : config files for each machine diff --git a/Utilities/Release/create-cmake-release.cmake b/Utilities/Release/create-cmake-release.cmake index 192549e..7b144f1 100644 --- a/Utilities/Release/create-cmake-release.cmake +++ b/Utilities/Release/create-cmake-release.cmake @@ -12,7 +12,6 @@ set(RELEASE_SCRIPTS_BATCH_1 ) set(RELEASE_SCRIPTS_BATCH_2 - cygwin_release.cmake # Cygwin x86 win64_release.cmake # Windows x64 ) diff --git a/Utilities/Release/cygwin_release.cmake b/Utilities/Release/cygwin_release.cmake deleted file mode 100644 index ca3e794..0000000 --- a/Utilities/Release/cygwin_release.cmake +++ /dev/null @@ -1,32 +0,0 @@ -set(CMAKE_RELEASE_DIRECTORY "c:/cygwin/home/dashboard/CMakeReleaseCygwin") -set(PROCESSORS 9) -set(BOOTSTRAP_ARGS "") -set(MAKE_PROGRAM "make") -set(MAKE "${MAKE_PROGRAM} -j8") -set(HOST dash2win64) -set(CPACK_BINARY_GENERATORS "CygwinBinary") -set(CPACK_SOURCE_GENERATORS "CygwinSource") -set(MAKE_PROGRAM "make") -set(INITIAL_CACHE "CMAKE_BUILD_TYPE:STRING=Release -CMAKE_Fortran_COMPILER_FULLPATH:FILEPATH=FALSE -CTEST_TEST_TIMEOUT:STRING=7200 -DART_TESTING_TIMEOUT:STRING=7200 -SPHINX_HTML:BOOL=ON -SPHINX_MAN:BOOL=ON -CMake_INSTALL_DEPENDENCIES:BOOL=ON -") -set(CXX g++) -set(CC gcc) -set(GIT_EXTRA "git config core.autocrlf false") -get_filename_component(path "${CMAKE_CURRENT_LIST_FILE}" PATH) - -# WARNING: Temporary fix!! This exclusion of the ExternalProject test -# is temporary until we can set up a new cygwin build machine. -# It only fails because of cygwin/non-cygwin "svn" mismatches in this -# particular environment. This is less than ideal, but at least it -# allows us to produce cygwin builds in the short term. -set(EXTRA_CTEST_ARGS "-E ExternalProject") - -set(LOCAL_DIR cygwin) - -include(${path}/release_cmake.cmake) diff --git a/Utilities/Release/release_cmake.cmake b/Utilities/Release/release_cmake.cmake index 0d9c784..0db89b5 100644 --- a/Utilities/Release/release_cmake.cmake +++ b/Utilities/Release/release_cmake.cmake @@ -108,10 +108,6 @@ foreach(gen ${generators}) if("${gen}" STREQUAL "TBZ2") set(SUFFIXES ${SUFFIXES} "*.tar.bz2") endif() - if("${gen}" MATCHES "Cygwin") - set(SUFFIXES ${SUFFIXES} "*.tar.bz2") - set(extra_files setup.hint) - endif() if("${gen}" STREQUAL "TZ") set(SUFFIXES ${SUFFIXES} "*.tar.Z") endif() diff --git a/Utilities/cmlibuv/CMakeLists.txt b/Utilities/cmlibuv/CMakeLists.txt index e25ac82..1b384b5 100644 --- a/Utilities/cmlibuv/CMakeLists.txt +++ b/Utilities/cmlibuv/CMakeLists.txt @@ -168,6 +168,9 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux") endif() if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") + list(APPEND uv_libraries + kvm + ) list(APPEND uv_headers include/uv-bsd.h ) @@ -178,6 +181,9 @@ if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") endif() if(CMAKE_SYSTEM_NAME STREQUAL "NetBSD") + list(APPEND uv_libraries + kvm + ) list(APPEND uv_headers include/uv-bsd.h ) @@ -188,6 +194,9 @@ if(CMAKE_SYSTEM_NAME STREQUAL "NetBSD") endif() if(CMAKE_SYSTEM_NAME STREQUAL "OpenBSD") + list(APPEND uv_libraries + kvm + ) list(APPEND uv_headers include/uv-bsd.h ) |