diff options
27 files changed, 285 insertions, 84 deletions
diff --git a/Help/manual/cmake-toolchains.7.rst b/Help/manual/cmake-toolchains.7.rst index f36a43c..1621b5f 100644 --- a/Help/manual/cmake-toolchains.7.rst +++ b/Help/manual/cmake-toolchains.7.rst @@ -97,12 +97,20 @@ Cross Compiling If :manual:`cmake(1)` is invoked with the command line parameter ``-DCMAKE_TOOLCHAIN_FILE=path/to/file``, the file will be loaded early to set -values for the compilers. A typical cross-compiling toolchain has content such +values for the compilers. +The :variable:`CMAKE_CROSSCOMPILING` variable is set to true when CMake is +cross-compiling. + +Cross Compiling for Linux +------------------------- + +A typical cross-compiling toolchain for Linux has content such as: .. code-block:: cmake set(CMAKE_SYSTEM_NAME Linux) + set(CMAKE_SYSTEM_PROCESSOR arm) set(CMAKE_SYSROOT /home/devel/rasp-pi-rootfs) set(CMAKE_STAGING_PREFIX /home/devel/stage) @@ -118,6 +126,9 @@ as: The :variable:`CMAKE_SYSTEM_NAME` is the CMake-identifier of the target platform to build for. +The :variable:`CMAKE_SYSTEM_PROCESSOR` is the CMake-identifier of the target architecture +to build for. + The :variable:`CMAKE_SYSROOT` is optional, and may be specified if a sysroot is available. @@ -139,13 +150,17 @@ target system prefixes, whereas executables which must be run as part of the bui should be found only on the host and not on the target. This is the purpose of the ``CMAKE_FIND_ROOT_PATH_MODE_*`` variables. -Some compilers are inherently cross compilers, such as Clang and the QNX QCC -compiler. The :variable:`CMAKE_<LANG>_COMPILER_TARGET` can be set to pass a +Cross Compiling using Clang +--------------------------- + +Some compilers such as Clang are inherently cross compilers. +The :variable:`CMAKE_<LANG>_COMPILER_TARGET` can be set to pass a value to those supported compilers when compiling: .. code-block:: cmake set(CMAKE_SYSTEM_NAME Linux) + set(CMAKE_SYSTEM_PROCESSOR arm) set(triple arm-linux-gnueabihf) @@ -154,7 +169,18 @@ value to those supported compilers when compiling: set(CMAKE_CXX_COMPILER clang++) set(CMAKE_CXX_COMPILER_TARGET ${triple}) -Or, for QCC: +Similarly, some compilers do not ship their own supplementary utilities +such as linkers, but provide a way to specify the location of the external +toolchain which will be used by the compiler driver. The +:variable:`CMAKE_<LANG>_COMPILER_EXTERNAL_TOOLCHAIN` variable can be set in a +toolchain file to pass the path to the compiler driver. + +Cross Compiling for QNX +----------------------- + +As the Clang compiler the QNX QCC compile is inherently a cross compiler. +And the :variable:`CMAKE_<LANG>_COMPILER_TARGET` can be set to pass a +value to those supported compilers when compiling: .. code-block:: cmake @@ -167,12 +193,50 @@ Or, for QCC: set(CMAKE_CXX_COMPILER QCC) set(CMAKE_CXX_COMPILER_TARGET ${arch}) +Cross Compiling for Windows CE +------------------------------ -Similarly, some compilers do not ship their own supplementary utilities -such as linkers, but provide a way to specify the location of the external -toolchain which will be used by the compiler driver. The -:variable:`CMAKE_<LANG>_COMPILER_EXTERNAL_TOOLCHAIN` variable can be set in a -toolchain file to pass the path to the compiler driver. +Cross compiling for Windows CE requires the corresponding SDK being +installed on your system. These SDKs are usually installed under +``C:/Program Files (x86)/Windows CE Tools/SDKs``. -The :variable:`CMAKE_CROSSCOMPILING` variable is set to true when CMake is -cross-compiling. +A toolchain file to configure a Visual Studio generator for +Windows CE may look like this: + +.. code-block:: cmake + + set(CMAKE_SYSTEM_NAME WindowsCE) + + set(CMAKE_SYSTEM_VERSION 8.0) + set(CMAKE_SYSTEM_PROCESSOR arm) + + set(CMAKE_GENERATOR_TOOLSET CE800) # Can be omitted for 8.0 + set(CMAKE_GENERATOR_PLATFORM SDK_AM335X_SK_WEC2013_V310) + +The :variable:`CMAKE_GENERATOR_PLATFORM` tells the generator which SDK to use. +Further :variable:`CMAKE_SYSTEM_VERSION` tells the generator what version of +Windows CE to use. Currently version 8.0 (Windows Embedded Compact 2013) is +supported out of the box. Other versions may require one to set +:variable:`CMAKE_GENERATOR_TOOLSET` to the correct value. + +Cross Compiling for Windows Phone +--------------------------------- + +A toolchain file to configure a Visual Studio generator for +Windows Phone may look like this: + +.. code-block:: cmake + + set(CMAKE_SYSTEM_NAME WindowsPhone) + set(CMAKE_SYSTEM_VERSION 8.1) + +Cross Compiling for Windows Store +--------------------------------- + +A toolchain file to configure a Visual Studio generator for +Windows Store may look like this: + +.. code-block:: cmake + + set(CMAKE_SYSTEM_NAME WindowsStore) + set(CMAKE_SYSTEM_VERSION 8.1) diff --git a/Modules/CheckPrototypeDefinition.cmake b/Modules/CheckPrototypeDefinition.cmake index dfa54d8..e203d4c 100644 --- a/Modules/CheckPrototypeDefinition.cmake +++ b/Modules/CheckPrototypeDefinition.cmake @@ -57,7 +57,7 @@ get_filename_component(__check_proto_def_dir "${CMAKE_CURRENT_LIST_FILE}" PATH) function(CHECK_PROTOTYPE_DEFINITION _FUNCTION _PROTOTYPE _RETURN _HEADER _VARIABLE) - if ("${_VARIABLE}" MATCHES "^${_VARIABLE}$") + if (NOT DEFINED ${_VARIABLE}) set(CHECK_PROTOTYPE_DEFINITION_CONTENT "/* */\n") set(CHECK_PROTOTYPE_DEFINITION_FLAGS ${CMAKE_REQUIRED_FLAGS}) diff --git a/Modules/Compiler/Clang-CXX.cmake b/Modules/Compiler/Clang-CXX.cmake index bdb6d69..5dd7b4a 100644 --- a/Modules/Compiler/Clang-CXX.cmake +++ b/Modules/Compiler/Clang-CXX.cmake @@ -23,9 +23,12 @@ elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 2.1) set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++0x") endif() -if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4) - set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++1y") - set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++1y") +if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.5) + set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++14") + set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++14") +elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4) + set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++1y") + set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++1y") endif() set(CMAKE_CXX_STANDARD_DEFAULT 98) diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index f8c996e..d6a6b72 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -240,7 +240,7 @@ function(_ep_parse_arguments f name ns args) set(is_value 1) if(arg MATCHES "^[A-Z][A-Z0-9_][A-Z0-9_]+$" AND - NOT ((arg STREQUAL "${key}") AND (key STREQUAL "COMMAND")) AND + NOT (("x${arg}x" STREQUAL "x${key}x") AND ("x${key}x" STREQUAL "xCOMMANDx")) AND NOT arg MATCHES "^(TRUE|FALSE)$") if(_ep_keywords_${f} AND arg MATCHES "${_ep_keywords_${f}}") set(is_value 0) @@ -628,11 +628,6 @@ function(_ep_write_downloadfile_script script_filename remote local timeout no_p set(show_progress "SHOW_PROGRESS") endif() - if("${hash}" MATCHES "${_ep_hash_regex}") - set(hash_args EXPECTED_HASH ${CMAKE_MATCH_1}=${CMAKE_MATCH_2}) - else() - set(hash_args "# no EXPECTED_HASH") - endif() # check for curl globals in the project if(DEFINED CMAKE_TLS_VERIFY) set(tls_verify "set(CMAKE_TLS_VERIFY ${CMAKE_TLS_VERIFY})") @@ -668,7 +663,6 @@ file(DOWNLOAD \"${remote}\" \"${local}\" ${show_progress} - ${hash_args} ${timeout_args} STATUS status LOG log) diff --git a/Modules/FindGettext.cmake b/Modules/FindGettext.cmake index 7ab867b..16478cb 100644 --- a/Modules/FindGettext.cmake +++ b/Modules/FindGettext.cmake @@ -26,7 +26,7 @@ # ALL option is used, the translations will also be created when # building the default target. # -# GETTEXT_PROCESS_POT( <potfile> [ALL] [INSTALL_DESTINATION <destdir>] +# GETTEXT_PROCESS_POT_FILE( <potfile> [ALL] [INSTALL_DESTINATION <destdir>] # LANGUAGES <lang1> <lang2> ... ) # # :: diff --git a/Modules/FindOpenSceneGraph.cmake b/Modules/FindOpenSceneGraph.cmake index 7bbd753..68adff7 100644 --- a/Modules/FindOpenSceneGraph.cmake +++ b/Modules/FindOpenSceneGraph.cmake @@ -203,8 +203,11 @@ foreach(_osg_module ${_osg_modules_to_process}) find_package(${_osg_module} ${_osg_quiet}) string(TOUPPER ${_osg_module} _osg_module_UC) - list(APPEND OPENSCENEGRAPH_INCLUDE_DIR ${${_osg_module_UC}_INCLUDE_DIR}) - list(APPEND OPENSCENEGRAPH_LIBRARIES ${${_osg_module_UC}_LIBRARIES}) + # append to list if module was found OR is required + if( ${_osg_module_UC}_FOUND OR OpenSceneGraph_FIND_REQUIRED ) + list(APPEND OPENSCENEGRAPH_INCLUDE_DIR ${${_osg_module_UC}_INCLUDE_DIR}) + list(APPEND OPENSCENEGRAPH_LIBRARIES ${${_osg_module_UC}_LIBRARIES}) + endif() if(OpenSceneGraph_MARK_AS_ADVANCED) OSG_MARK_AS_ADVANCED(${_osg_module}) diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake index 9b120a6..72ca6ed 100644 --- a/Modules/FindProtobuf.cmake +++ b/Modules/FindProtobuf.cmake @@ -183,7 +183,7 @@ function(PROTOBUF_GENERATE_CPP SRCS HDRS) "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.h" COMMAND ${PROTOBUF_PROTOC_EXECUTABLE} ARGS --cpp_out ${CMAKE_CURRENT_BINARY_DIR} ${_protobuf_include_path} ${ABS_FIL} - DEPENDS ${ABS_FIL} + DEPENDS ${ABS_FIL} ${PROTOBUF_PROTOC_EXECUTABLE} COMMENT "Running C++ protocol buffer compiler on ${FIL}" VERBATIM ) endforeach() diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index dcda8a4..e701d32 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 0) -set(CMake_VERSION_PATCH 20140919) +set(CMake_VERSION_PATCH 20140922) #set(CMake_VERSION_RC 1) diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 9a42ca2..14b5a92 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -519,9 +519,7 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(const std::string& dir, iter = this->SystemIncludesCache.insert(entry).first; } - std::string dirString = dir; - return std::binary_search(iter->second.begin(), iter->second.end(), - dirString); + return std::binary_search(iter->second.begin(), iter->second.end(), dir); } //---------------------------------------------------------------------------- diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 4375114..6a4adc0 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -506,8 +506,8 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages, fpath = mf->GetModulesFile("CMakeSystemSpecificInitialize.cmake"); if(!mf->ReadListFile(0,fpath.c_str())) { - cmSystemTools::Error("Could not find cmake module file: ", - fpath.c_str()); + cmSystemTools::Error("Could not find cmake module file: " + "CMakeSystemSpecificInitialize.cmake"); } } @@ -575,7 +575,7 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages, if(!mf->ReadListFile(0,determineFile.c_str())) { cmSystemTools::Error("Could not find cmake module file: ", - determineFile.c_str()); + determineCompiler.c_str()); } needTestLanguage[lang] = true; // Some generators like visual studio should not use the env variables @@ -627,8 +627,8 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages, fpath = mf->GetModulesFile("CMakeSystemSpecificInformation.cmake"); if(!mf->ReadListFile(0,fpath.c_str())) { - cmSystemTools::Error("Could not find cmake module file: ", - fpath.c_str()); + cmSystemTools::Error("Could not find cmake module file: " + "CMakeSystemSpecificInformation.cmake"); } } // loop over languages again loading CMake(LANG)Information.cmake @@ -744,7 +744,7 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages, if(!mf->ReadListFile(0,ifpath.c_str())) { cmSystemTools::Error("Could not find cmake module file: ", - ifpath.c_str()); + testLang.c_str()); } std::string compilerWorks = "CMAKE_"; compilerWorks += lang; diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index d4d565c..cb070cc 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -392,7 +392,8 @@ void cmQtAutoGenerators::SetupAutoGenerateTarget(cmTarget const* target) std::map<std::string, std::string> configUicOptions; if (target->GetPropertyAsBool("AUTOMOC") - || target->GetPropertyAsBool("AUTOUIC")) + || target->GetPropertyAsBool("AUTOUIC") + || target->GetPropertyAsBool("AUTORCC")) { this->SetupSourceFiles(target); } @@ -1304,8 +1305,8 @@ bool cmQtAutoGenerators::RunAutogen(cmMakefile* makefile) const std::vector<std::string>& headerExtensions = makefile->GetHeaderExtensions(); - std::map<std::string, std::string> includedUis; - std::map<std::string, std::string> skippedUis; + std::map<std::string, std::vector<std::string> > includedUis; + std::map<std::string, std::vector<std::string> > skippedUis; std::vector<std::string> uicSkipped; cmSystemTools::ExpandListArgument(this->SkipUic, uicSkipped); @@ -1315,7 +1316,7 @@ bool cmQtAutoGenerators::RunAutogen(cmMakefile* makefile) { const bool skipUic = std::find(uicSkipped.begin(), uicSkipped.end(), *it) != uicSkipped.end(); - std::map<std::string, std::string>& uiFiles + std::map<std::string, std::vector<std::string> >& uiFiles = skipUic ? skippedUis : includedUis; const std::string &absFilename = *it; if (this->Verbose) @@ -1376,12 +1377,17 @@ bool cmQtAutoGenerators::RunAutogen(cmMakefile* makefile) { this->GenerateMoc(it->first, it->second); } - for(std::map<std::string, std::string>::const_iterator + for(std::map<std::string, std::vector<std::string> >::const_iterator it = includedUis.begin(); it != includedUis.end(); ++it) { - this->GenerateUi(it->first, it->second); + for (std::vector<std::string>::const_iterator nit = it->second.begin(); + nit != it->second.end(); + ++nit) + { + this->GenerateUi(it->first, *nit); + } } if(!this->RccExecutable.empty()) @@ -1456,9 +1462,9 @@ bool cmQtAutoGenerators::RunAutogen(cmMakefile* makefile) void cmQtAutoGenerators::ParseCppFile(const std::string& absFilename, - const std::vector<std::string>& headerExtensions, - std::map<std::string, std::string>& includedMocs, - std::map<std::string, std::string> &includedUis) + const std::vector<std::string>& headerExtensions, + std::map<std::string, std::string>& includedMocs, + std::map<std::string, std::vector<std::string> > &includedUis) { cmsys::RegularExpression mocIncludeRegExp( "[\n][ \t]*#[ \t]*include[ \t]+" @@ -1644,9 +1650,9 @@ void cmQtAutoGenerators::ParseCppFile(const std::string& absFilename, void cmQtAutoGenerators::StrictParseCppFile(const std::string& absFilename, - const std::vector<std::string>& headerExtensions, - std::map<std::string, std::string>& includedMocs, - std::map<std::string, std::string>& includedUis) + const std::vector<std::string>& headerExtensions, + std::map<std::string, std::string>& includedMocs, + std::map<std::string, std::vector<std::string> >& includedUis) { cmsys::RegularExpression mocIncludeRegExp( "[\n][ \t]*#[ \t]*include[ \t]+" @@ -1764,7 +1770,7 @@ void cmQtAutoGenerators::StrictParseCppFile(const std::string& absFilename, void cmQtAutoGenerators::ParseForUic(const std::string& absFilename, - std::map<std::string, std::string>& includedUis) + std::map<std::string, std::vector<std::string> >& includedUis) { if (this->UicExecutable.empty()) { @@ -1782,8 +1788,8 @@ void cmQtAutoGenerators::ParseForUic(const std::string& absFilename, void cmQtAutoGenerators::ParseForUic(const std::string& absFilename, - const std::string& contentsString, - std::map<std::string, std::string>& includedUis) + const std::string& contentsString, + std::map<std::string, std::vector<std::string> >& includedUis) { if (this->UicExecutable.empty()) { @@ -1813,7 +1819,7 @@ void cmQtAutoGenerators::ParseForUic(const std::string& absFilename, // finding the correct header, so we need to remove the ui_ part basename = basename.substr(3); - includedUis[realName] = basename; + includedUis[realName].push_back(basename); matchOffset += uiIncludeRegExp.end(); } while(uiIncludeRegExp.find(contentsString.c_str() + matchOffset)); @@ -1859,9 +1865,9 @@ cmQtAutoGenerators::SearchHeadersForCppFile(const std::string& absFilename, void cmQtAutoGenerators::ParseHeaders(const std::set<std::string>& absHeaders, - const std::map<std::string, std::string>& includedMocs, - std::map<std::string, std::string>& notIncludedMocs, - std::map<std::string, std::string>& includedUis) + const std::map<std::string, std::string>& includedMocs, + std::map<std::string, std::string>& notIncludedMocs, + std::map<std::string, std::vector<std::string> >& includedUis) { for(std::set<std::string>::const_iterator hIt=absHeaders.begin(); hIt!=absHeaders.end(); diff --git a/Source/cmQtAutoGenerators.h b/Source/cmQtAutoGenerators.h index 501e13a..c298f5d 100644 --- a/Source/cmQtAutoGenerators.h +++ b/Source/cmQtAutoGenerators.h @@ -51,28 +51,28 @@ private: bool GenerateUi(const std::string& realName, const std::string& uiFileName); bool GenerateQrc(); void ParseCppFile(const std::string& absFilename, - const std::vector<std::string>& headerExtensions, - std::map<std::string, std::string>& includedMocs, - std::map<std::string, std::string>& includedUis); + const std::vector<std::string>& headerExtensions, + std::map<std::string, std::string>& includedMocs, + std::map<std::string, std::vector<std::string> >& includedUis); void StrictParseCppFile(const std::string& absFilename, - const std::vector<std::string>& headerExtensions, - std::map<std::string, std::string>& includedMocs, - std::map<std::string, std::string>& includedUis); + const std::vector<std::string>& headerExtensions, + std::map<std::string, std::string>& includedMocs, + std::map<std::string, std::vector<std::string> >& includedUis); void SearchHeadersForCppFile(const std::string& absFilename, const std::vector<std::string>& headerExtensions, std::set<std::string>& absHeaders); void ParseHeaders(const std::set<std::string>& absHeaders, - const std::map<std::string, std::string>& includedMocs, - std::map<std::string, std::string>& notIncludedMocs, - std::map<std::string, std::string>& includedUis); + const std::map<std::string, std::string>& includedMocs, + std::map<std::string, std::string>& notIncludedMocs, + std::map<std::string, std::vector<std::string> >& includedUis); void ParseForUic(const std::string& fileName, - const std::string& contentsString, - std::map<std::string, std::string>& includedUis); + const std::string& contentsString, + std::map<std::string, std::vector<std::string> >& includedUis); void ParseForUic(const std::string& fileName, - std::map<std::string, std::string>& includedUis); + std::map<std::string, std::vector<std::string> >& includedUis); void Init(); diff --git a/Source/cmStandardIncludes.h b/Source/cmStandardIncludes.h index 3731502..8baf7b3 100644 --- a/Source/cmStandardIncludes.h +++ b/Source/cmStandardIncludes.h @@ -462,12 +462,6 @@ struct cmStrCmp { return strcmp(input, m_test.c_str()) == 0; } - // For use with binary_search - bool operator()(const char *str1, const char *str2) const - { - return strcmp(str1, str2) < 0; - } - private: const std::string m_test; }; diff --git a/Tests/CMakeOnly/MajorVersionSelection/CMakeLists.txt b/Tests/CMakeOnly/MajorVersionSelection/CMakeLists.txt index 74f5451..2511064 100644 --- a/Tests/CMakeOnly/MajorVersionSelection/CMakeLists.txt +++ b/Tests/CMakeOnly/MajorVersionSelection/CMakeLists.txt @@ -20,13 +20,13 @@ endif () string(TOUPPER "${MAJOR_TEST_MODULE}" MODULE_UPPER) -if ( ( ${MAJOR_TEST_MODULE}_FOUND OR ${MODULE_UPPER}_FOUND ) AND "${VERSION_VAR}") +if ( ( ${MAJOR_TEST_MODULE}_FOUND OR ${MODULE_UPPER}_FOUND ) AND ${VERSION_VAR}) message(STATUS "${VERSION_VAR} is '${${VERSION_VAR}}'") - if ("${VERSION_VAR}" VERSION_LESS MAJOR_TEST_VERSION) + if (${VERSION_VAR} VERSION_LESS MAJOR_TEST_VERSION) message(SEND_ERROR "Found version ${${VERSION_VAR}} is less than requested major version ${MAJOR_TEST_VERSION}") endif () math(EXPR V_PLUS_ONE "${MAJOR_TEST_VERSION} + 1") - if ("${VERSION_VAR}" VERSION_GREATER V_PLUS_ONE) + if (${VERSION_VAR} VERSION_GREATER V_PLUS_ONE) message(SEND_ERROR "Found version ${${VERSION_VAR}} is greater than requested major version ${MAJOR_TEST_VERSION}") endif () endif () diff --git a/Tests/FunctionTest/CMakeLists.txt b/Tests/FunctionTest/CMakeLists.txt index d1fada4..68da972 100644 --- a/Tests/FunctionTest/CMakeLists.txt +++ b/Tests/FunctionTest/CMakeLists.txt @@ -92,7 +92,7 @@ endfunction() STRANGE_FUNCTION(var) set(second_var "second_var") -if("${var}" STREQUAL "strange_function" AND "${second_var}" STREQUAL "second_var") +if("x${var}" STREQUAL "xstrange_function" AND "x${second_var}" STREQUAL "xsecond_var") PASS("Case Test" "(${var} ${second_var})") else() FAILED("Case test" "(${var} ${second_var})") diff --git a/Tests/MacroTest/CMakeLists.txt b/Tests/MacroTest/CMakeLists.txt index 02bb31f..6c6dfb6 100644 --- a/Tests/MacroTest/CMakeLists.txt +++ b/Tests/MacroTest/CMakeLists.txt @@ -36,7 +36,7 @@ macro(strange_macro m) endmacro() STRANGE_MACRO(var) set(second_var "second_var") -if("${var}" STREQUAL "strange_macro" AND "${second_var}" STREQUAL "second_var") +if("x${var}" STREQUAL "xstrange_macro" AND "x${second_var}" STREQUAL "xsecond_var") PASS("Case Test" "(${var} ${second_var})") else() FAILED("Case test" "(${var} ${second_var})") diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt index 3973653..3fd00b8 100644 --- a/Tests/QtAutogen/CMakeLists.txt +++ b/Tests/QtAutogen/CMakeLists.txt @@ -37,6 +37,9 @@ else() endif() +add_executable(rcconly rcconly.cpp second_resource.qrc) +set_property(TARGET rcconly PROPERTY AUTORCC ON) +target_link_libraries(rcconly ${QT_QTCORE_TARGET}) include_directories(${CMAKE_CURRENT_BINARY_DIR}) @@ -71,6 +74,7 @@ if (CMAKE_BUILD_TYPE MATCHES "[Dd][Ee][Bb][Uu][Gg]" AND NOT CMAKE_CONFIGURATION_ endif() add_executable(QtAutogen main.cpp calwidget.cpp second_widget.cpp foo.cpp blub.cpp bar.cpp abc.cpp + multiplewidgets.cpp xyz.cpp yaf.cpp gadget.cpp $<TARGET_OBJECTS:privateSlot> test.qrc second_resource.qrc resourcetester.cpp generated.cpp ${debug_srcs} ) diff --git a/Tests/QtAutogen/multiplewidgets.cpp b/Tests/QtAutogen/multiplewidgets.cpp new file mode 100644 index 0000000..f143875 --- /dev/null +++ b/Tests/QtAutogen/multiplewidgets.cpp @@ -0,0 +1,19 @@ + +#include "multiplewidgets.h" + +#include "ui_widget1.h" +#include "ui_widget2.h" + +Widget1::Widget1(QWidget *parent) + : QWidget(parent), + ui(new Ui::Widget1) +{ + ui->setupUi(this); +} + +Widget2::Widget2(QWidget *parent) + : QWidget(parent), + ui(new Ui::Widget2) +{ + ui->setupUi(this); +} diff --git a/Tests/QtAutogen/multiplewidgets.h b/Tests/QtAutogen/multiplewidgets.h new file mode 100644 index 0000000..6ae6ad1 --- /dev/null +++ b/Tests/QtAutogen/multiplewidgets.h @@ -0,0 +1,33 @@ + +#ifndef MULTIPLEWIDGETS_H +#define MULTIPLEWIDGETS_H + +#include <QWidget> + +namespace Ui { +class Widget1; +} + +class Widget1 : public QWidget +{ + Q_OBJECT +public: + Widget1(QWidget *parent = 0); +private: + Ui::Widget1 *ui; +}; + +namespace Ui { +class Widget2; +} + +class Widget2 : public QWidget +{ + Q_OBJECT +public: + Widget2(QWidget *parent = 0); +private: + Ui::Widget2 *ui; +}; + +#endif diff --git a/Tests/QtAutogen/rcconly.cpp b/Tests/QtAutogen/rcconly.cpp new file mode 100644 index 0000000..854c4c1 --- /dev/null +++ b/Tests/QtAutogen/rcconly.cpp @@ -0,0 +1,9 @@ + +extern int qInitResources_second_resource(); + +int main(int, char**) +{ + // Fails to link if the symbol is not present. + qInitResources_second_resource(); + return 0; +} diff --git a/Tests/QtAutogen/widget1.ui b/Tests/QtAutogen/widget1.ui new file mode 100644 index 0000000..8fce81a --- /dev/null +++ b/Tests/QtAutogen/widget1.ui @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>Widget1</class> + <widget class="QWidget" name="Widget1"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>400</width> + <height>300</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <widget class="QPushButton" name="pushButton"> + <property name="geometry"> + <rect> + <x>140</x> + <y>80</y> + <width>80</width> + <height>23</height> + </rect> + </property> + <property name="text"> + <string>PushButton</string> + </property> + </widget> + <widget class="QPushButton" name="pushButton_2"> + <property name="geometry"> + <rect> + <x>190</x> + <y>170</y> + <width>80</width> + <height>23</height> + </rect> + </property> + <property name="text"> + <string>PushButton</string> + </property> + </widget> + </widget> + <resources/> + <connections/> +</ui> diff --git a/Tests/QtAutogen/widget2.ui b/Tests/QtAutogen/widget2.ui new file mode 100644 index 0000000..1f411b9 --- /dev/null +++ b/Tests/QtAutogen/widget2.ui @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>Widget2</class> + <widget class="QWidget" name="Widget1"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>400</width> + <height>300</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <widget class="QListWidget" name="listWidget"> + <property name="geometry"> + <rect> + <x>20</x> + <y>20</y> + <width>256</width> + <height>192</height> + </rect> + </property> + </widget> + </widget> + <resources/> + <connections/> +</ui> diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_NO_PKGCONFIG_PATH.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_NO_PKGCONFIG_PATH.cmake index 924976e..89ce4c6 100644 --- a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_NO_PKGCONFIG_PATH.cmake +++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_NO_PKGCONFIG_PATH.cmake @@ -26,7 +26,7 @@ endif() pkg_check_modules(FOO "${expected_path}") -if(NOT "FOO_FOUND") +if(NOT FOO_FOUND) message(FATAL_ERROR "Expected PKG_CONFIG_PATH: \"${expected_path}\".") endif() @@ -36,6 +36,6 @@ set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH TRUE) pkg_check_modules(BAR "${expected_path}" NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH) -if(NOT "BAR_FOUND") +if(NOT BAR_FOUND) message(FATAL_ERROR "Expected PKG_CONFIG_PATH: \"${expected_path}\".") endif() diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH.cmake index 4a66e85..c903279 100644 --- a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH.cmake +++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH.cmake @@ -46,6 +46,6 @@ endif() pkg_check_modules(FOO "${expected_path}") -if(NOT "FOO_FOUND") +if(NOT FOO_FOUND) message(FATAL_ERROR "Expected PKG_CONFIG_PATH: \"${expected_path}\".") endif() diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_ENVIRONMENT_PATH.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_ENVIRONMENT_PATH.cmake index 0b057b8..a52bcbf 100644 --- a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_ENVIRONMENT_PATH.cmake +++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_ENVIRONMENT_PATH.cmake @@ -46,6 +46,6 @@ endif() pkg_check_modules(FOO "${expected_path}" NO_CMAKE_ENVIRONMENT_PATH) -if(NOT "FOO_FOUND") +if(NOT FOO_FOUND) message(FATAL_ERROR "Expected PKG_CONFIG_PATH: \"${expected_path}\".") endif() diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_PATH.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_PATH.cmake index a3154f1..2fabe5b 100644 --- a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_PATH.cmake +++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_PATH.cmake @@ -46,6 +46,6 @@ endif() pkg_check_modules(FOO "${expected_path}" NO_CMAKE_PATH) -if(NOT "FOO_FOUND") +if(NOT FOO_FOUND) message(FATAL_ERROR "Expected PKG_CONFIG_PATH: \"${expected_path}\".") endif() diff --git a/Tests/StringFileTest/CMakeLists.txt b/Tests/StringFileTest/CMakeLists.txt index 683f969..e6c6152 100644 --- a/Tests/StringFileTest/CMakeLists.txt +++ b/Tests/StringFileTest/CMakeLists.txt @@ -123,7 +123,7 @@ string(STRIP "ST2 " ST2) string(STRIP " ST3" ST3) foreach(var ST1 ST2 ST3) - if("${var}" STREQUAL "${${var}}") + if("x${var}" STREQUAL "x${${var}}") message("[${var}] == [${${var}}]") else() message(SEND_ERROR "Problem with the STRIP command for ${var}: [${${var}}]") |