diff options
27 files changed, 295 insertions, 79 deletions
diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index ca2a9c5..4a55588 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -13,6 +13,9 @@ # [version] [EXACT] # Minimum or EXACT version e.g. 1.36.0 # [REQUIRED] # Fail with error if Boost is not found # [COMPONENTS <libs>...] # Boost libraries by their canonical name +# # e.g. "date_time" for "libboost_date_time" +# [OPTIONAL_COMPONENTS <libs>...] +# # Optional Boost libraries by their canonical name) # ) # e.g. "date_time" for "libboost_date_time" # # This module finds headers and requested component libraries OR a CMake @@ -1777,10 +1780,9 @@ if(Boost_FOUND) set(_boost_CHECKED_COMPONENT FALSE) set(_Boost_MISSING_COMPONENTS "") foreach(COMPONENT ${Boost_FIND_COMPONENTS}) - string(TOUPPER ${COMPONENT} COMPONENT) + string(TOUPPER ${COMPONENT} UPPERCOMPONENT) set(_boost_CHECKED_COMPONENT TRUE) - if(NOT Boost_${COMPONENT}_FOUND) - string(TOLOWER ${COMPONENT} COMPONENT) + if(NOT Boost_${UPPERCOMPONENT}_FOUND AND Boost_FIND_REQUIRED_${COMPONENT}) list(APPEND _Boost_MISSING_COMPONENTS ${COMPONENT}) endif() endforeach() diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index b41f400..bab642b 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 10) -set(CMake_VERSION_PATCH 20180122) +set(CMake_VERSION_PATCH 20180124) #set(CMake_VERSION_RC 1) diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index fb13a58..18cca5a 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -913,11 +913,9 @@ std::string cmComputeLinkInformation::CreateExtensionRegex( // Finish the list. libext += ")"; - // Add an optional OpenBSD version component. - if (this->OpenBSD) { - libext += "(\\.[0-9]+\\.[0-9]+)?"; - } else if (type == LinkShared) { - libext += "(\\.[0-9]+)?"; + // Add an optional OpenBSD-style version or major.minor.version component. + if (this->OpenBSD || type == LinkShared) { + libext += "(\\.[0-9]+)*"; } libext += "$"; diff --git a/Source/cmExtraCodeLiteGenerator.cxx b/Source/cmExtraCodeLiteGenerator.cxx index 4958007..fad0723 100644 --- a/Source/cmExtraCodeLiteGenerator.cxx +++ b/Source/cmExtraCodeLiteGenerator.cxx @@ -198,8 +198,6 @@ std::string cmExtraCodeLiteGenerator::CollectSourceFiles( std::map<std::string, cmSourceFile*>& cFiles, std::set<std::string>& otherFiles) { - auto cm = this->GlobalGenerator->GetCMakeInstance(); - std::string projectType; switch (gt->GetType()) { case cmStateEnums::EXECUTABLE: { @@ -227,19 +225,18 @@ std::string cmExtraCodeLiteGenerator::CollectSourceFiles( gt->GetSourceFiles(sources, makefile->GetSafeDefinition("CMAKE_BUILD_TYPE")); for (cmSourceFile* s : sources) { - // check whether it is a C/C++/CUDA implementation file - bool isCFile = false; - std::string lang = s->GetLanguage(); - if (lang == "C" || lang == "CXX" || lang == "CUDA") { - std::string const& srcext = s->GetExtension(); - isCFile = cm->IsSourceExtension(srcext); - } - + // check whether it is a source or a include file // then put it accordingly into one of the two containers - if (isCFile) { - cFiles[s->GetFullPath()] = s; - } else { - otherFiles.insert(s->GetFullPath()); + switch (cmSystemTools::GetFileFormat(s->GetExtension().c_str())) { + case cmSystemTools::C_FILE_FORMAT: + case cmSystemTools::CXX_FILE_FORMAT: + case cmSystemTools::CUDA_FILE_FORMAT: + case cmSystemTools::FORTRAN_FILE_FORMAT: { + cFiles[s->GetFullPath()] = s; + } break; + default: { + otherFiles.insert(s->GetFullPath()); + } } } } @@ -679,7 +676,11 @@ std::string cmExtraCodeLiteGenerator::GetSingleFileBuildCommand( std::string generator = mf->GetSafeDefinition("CMAKE_GENERATOR"); if (generator == "Unix Makefiles" || generator == "MinGW Makefiles") { std::ostringstream ss; - ss << make << " -f$(ProjectPath)/Makefile $(CurrentFileName).cpp.o"; +#if defined(_WIN32) + ss << make << " -f$(ProjectPath)/Makefile -B $(CurrentFileFullName).obj"; +#else + ss << make << " -f$(ProjectPath)/Makefile -B $(CurrentFileFullName).o"; +#endif buildCommand = ss.str(); } return buildCommand; diff --git a/Source/cmQtAutoGeneratorMocUic.cxx b/Source/cmQtAutoGeneratorMocUic.cxx index 4b02e0b..037279a 100644 --- a/Source/cmQtAutoGeneratorMocUic.cxx +++ b/Source/cmQtAutoGeneratorMocUic.cxx @@ -221,7 +221,7 @@ bool cmQtAutoGeneratorMocUic::JobParseT::ParseMocSource(WorkerT& wrk, const char* contentChars = meta.Content.c_str(); cmsys::RegularExpressionMatch match; while (wrk.Moc().RegExpInclude.find(contentChars, match)) { - std::string incString = match.match(1); + std::string incString = match.match(2); std::string incDir(SubDirPrefix(incString)); std::string incBase = cmSystemTools::GetFilenameWithoutLastExtension(incString); @@ -500,7 +500,7 @@ bool cmQtAutoGeneratorMocUic::JobParseT::ParseUic(WorkerT& wrk, const char* contentChars = meta.Content.c_str(); cmsys::RegularExpressionMatch match; while (wrk.Uic().RegExpInclude.find(contentChars, match)) { - if (!ParseUicInclude(wrk, meta, match.match(1))) { + if (!ParseUicInclude(wrk, meta, match.match(2))) { success = false; break; } @@ -1124,9 +1124,9 @@ cmQtAutoGeneratorMocUic::cmQtAutoGeneratorMocUic() { // Precompile regular expressions Moc_.RegExpInclude.compile( - "[\n][ \t]*#[ \t]*include[ \t]+" + "(^|\n)[ \t]*#[ \t]*include[ \t]+" "[\"<](([^ \">]+/)?moc_[^ \">/]+\\.cpp|[^ \">]+\\.moc)[\">]"); - Uic_.RegExpInclude.compile("[\n][ \t]*#[ \t]*include[ \t]+" + Uic_.RegExpInclude.compile("(^|\n)[ \t]*#[ \t]*include[ \t]+" "[\"<](([^ \">]+/)?ui_[^ \">/]+\\.h)[\">]"); // Initialize libuv asynchronous iteration request diff --git a/Source/cmServerProtocol.cxx b/Source/cmServerProtocol.cxx index 6b7143b..4c0a354 100644 --- a/Source/cmServerProtocol.cxx +++ b/Source/cmServerProtocol.cxx @@ -1034,8 +1034,8 @@ static Json::Value DumpProjectList(const cmake* cm, std::string const& config) // Project structure information: const cmMakefile* mf = lg->GetMakefile(); - pObj[kMINIMUM_CMAKE_VERSION] = - mf->GetDefinition("CMAKE_MINIMUM_REQUIRED_VERSION"); + auto minVersion = mf->GetDefinition("CMAKE_MINIMUM_REQUIRED_VERSION"); + pObj[kMINIMUM_CMAKE_VERSION] = minVersion ? minVersion : ""; pObj[kSOURCE_DIRECTORY_KEY] = mf->GetCurrentSourceDirectory(); pObj[kBUILD_DIRECTORY_KEY] = mf->GetCurrentBinaryDirectory(); pObj[kTARGETS_KEY] = DumpTargetsList(projectIt.second, config); diff --git a/Tests/FindBoost/CMakeLists.txt b/Tests/FindBoost/CMakeLists.txt index 0e9527d..17a8ec7 100644 --- a/Tests/FindBoost/CMakeLists.txt +++ b/Tests/FindBoost/CMakeLists.txt @@ -9,6 +9,20 @@ add_test(NAME FindBoost.Test COMMAND --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> ) +add_test(NAME FindBoost.TestFail COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindBoost/TestFail" + "${CMake_BINARY_DIR}/Tests/FindBoost/TestFail" + ${build_generator_args} + --build-project TestFailFindBoost + --build-options ${build_options} + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) + +set_tests_properties(FindBoost.TestFail PROPERTIES + PASS_REGULAR_EXPRESSION "Could not find the following Boost libraries:[ \t\n]+boost_foobar") + add_test(NAME FindBoost.TestHeaders COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> --build-and-test diff --git a/Tests/FindBoost/Test/CMakeLists.txt b/Tests/FindBoost/Test/CMakeLists.txt index ce50fc7..663f414 100644 --- a/Tests/FindBoost/Test/CMakeLists.txt +++ b/Tests/FindBoost/Test/CMakeLists.txt @@ -2,7 +2,16 @@ cmake_minimum_required(VERSION 3.1) project(TestFindBoost CXX) include(CTest) -find_package(Boost REQUIRED COMPONENTS filesystem thread) +find_package(Boost REQUIRED COMPONENTS filesystem thread + OPTIONAL_COMPONENTS program_options foobar) + +if(Boost_FOOBAR_FOUND) + message(FATAL_ERROR "Optional inexistent Boost component \"foobar\" found which is unexpected") +endif(Boost_FOOBAR_FOUND) + +if(NOT Boost_PROGRAM_OPTIONS_FOUND) + message(FATAL_ERROR "Optional Boost component \"program_options\" not found which is unexpected") +endif(NOT Boost_PROGRAM_OPTIONS_FOUND) add_executable(test_boost_tgt main.cxx) target_link_libraries(test_boost_tgt diff --git a/Tests/FindBoost/TestFail/CMakeLists.txt b/Tests/FindBoost/TestFail/CMakeLists.txt new file mode 100644 index 0000000..7c14a59 --- /dev/null +++ b/Tests/FindBoost/TestFail/CMakeLists.txt @@ -0,0 +1,18 @@ +cmake_minimum_required(VERSION 3.1) +project(TestFindBoost CXX) +include(CTest) + +find_package(Boost REQUIRED COMPONENTS foobar filesystem thread) + +add_executable(test_boost_tgt main.cxx) +target_link_libraries(test_boost_tgt + Boost::dynamic_linking + Boost::disable_autolinking + Boost::filesystem + Boost::thread) +add_test(NAME test_boost_tgt COMMAND test_boost_tgt) + +add_executable(test_boost_var main.cxx) +target_include_directories(test_boost_var PRIVATE ${Boost_INCLUDE_DIRS}) +target_link_libraries(test_boost_var PRIVATE ${Boost_FILESYSTEM_LIBRARIES} ${Boost_SYSTEM_LIBRARIES} ${Boost_THREAD_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) +add_test(NAME test_boost_var COMMAND test_boost_var) diff --git a/Tests/FindBoost/TestFail/main.cxx b/Tests/FindBoost/TestFail/main.cxx new file mode 100644 index 0000000..6e8b5da --- /dev/null +++ b/Tests/FindBoost/TestFail/main.cxx @@ -0,0 +1,24 @@ +#include <boost/filesystem.hpp> +#include <boost/thread.hpp> + +namespace { + +boost::mutex m1; +boost::recursive_mutex m2; + +void threadmain() +{ + boost::lock_guard<boost::mutex> lock1(m1); + boost::lock_guard<boost::recursive_mutex> lock2(m2); + + boost::filesystem::path p(boost::filesystem::current_path()); +} +} + +int main() +{ + boost::thread foo(threadmain); + foo.join(); + + return 0; +} diff --git a/Tests/QtAutogen/CommonTests.cmake b/Tests/QtAutogen/CommonTests.cmake index 2c2e6d6..094a755 100644 --- a/Tests/QtAutogen/CommonTests.cmake +++ b/Tests/QtAutogen/CommonTests.cmake @@ -1,9 +1,7 @@ # Autogen tests common for Qt4 and Qt5 ADD_AUTOGEN_TEST(MocOnly mocOnly) ADD_AUTOGEN_TEST(MocOptions mocOptions) -if(QT_TEST_ALLOW_QT_MACROS) - ADD_AUTOGEN_TEST(UicOnly uicOnly) -endif() +ADD_AUTOGEN_TEST(UicOnly uicOnly) ADD_AUTOGEN_TEST(RccOnly rccOnly) ADD_AUTOGEN_TEST(RccEmpty rccEmpty) ADD_AUTOGEN_TEST(RccOffMocLibrary) diff --git a/Tests/QtAutogen/MocOnly/CMakeLists.txt b/Tests/QtAutogen/MocOnly/CMakeLists.txt index 33feadf..a37a2ae 100644 --- a/Tests/QtAutogen/MocOnly/CMakeLists.txt +++ b/Tests/QtAutogen/MocOnly/CMakeLists.txt @@ -2,7 +2,14 @@ cmake_minimum_required(VERSION 3.10) project(MocOnly) include("../AutogenTest.cmake") -# Test different Q_OBJECT position styles -add_executable(mocOnly StyleA.cpp StyleB.cpp main.cpp) +add_executable(mocOnly + main.cpp + # Test different Q_OBJECT position styles + StyleA.cpp + StyleB.cpp + # Test different moc_/.moc include positions + IncA.cpp + IncB.cpp +) set_property(TARGET mocOnly PROPERTY AUTOMOC ON) target_link_libraries(mocOnly ${QT_LIBRARIES}) diff --git a/Tests/QtAutogen/MocOnly/IncA.cpp b/Tests/QtAutogen/MocOnly/IncA.cpp new file mode 100644 index 0000000..94610cd --- /dev/null +++ b/Tests/QtAutogen/MocOnly/IncA.cpp @@ -0,0 +1,19 @@ +#include "moc_IncA.cpp" +/// AUTOMOC moc_ include on the first line of the file! +#include "IncA.hpp" + +/// @brief Source local QObject +/// +class IncAPrivate : public QObject +{ + Q_OBJECT +public: + IncAPrivate(){}; +}; + +IncA::IncA() +{ + IncAPrivate priv; +} + +#include "IncA.moc" diff --git a/Tests/QtAutogen/MocOnly/IncA.hpp b/Tests/QtAutogen/MocOnly/IncA.hpp new file mode 100644 index 0000000..ecc889f --- /dev/null +++ b/Tests/QtAutogen/MocOnly/IncA.hpp @@ -0,0 +1,15 @@ +#ifndef INCA_HPP +#define INCA_HPP + +#include <QObject> + +/// @brief Test moc include pattern in the source file +/// +class IncA : public QObject +{ + Q_OBJECT +public: + IncA(); +}; + +#endif diff --git a/Tests/QtAutogen/MocOnly/IncB.cpp b/Tests/QtAutogen/MocOnly/IncB.cpp new file mode 100644 index 0000000..bd441a9 --- /dev/null +++ b/Tests/QtAutogen/MocOnly/IncB.cpp @@ -0,0 +1,19 @@ +#include "IncB.hpp" + +/// @brief Source local QObject +/// +class IncBPrivate : public QObject +{ + Q_OBJECT +public: + IncBPrivate(){}; +}; + +IncB::IncB() +{ + IncBPrivate priv; +} + +/// AUTOMOC moc_ include on the last line of the file! +#include "IncB.moc" +#include "moc_IncB.cpp" diff --git a/Tests/QtAutogen/MocOnly/IncB.hpp b/Tests/QtAutogen/MocOnly/IncB.hpp new file mode 100644 index 0000000..8331ea2 --- /dev/null +++ b/Tests/QtAutogen/MocOnly/IncB.hpp @@ -0,0 +1,15 @@ +#ifndef INCB_HPP +#define INCB_HPP + +#include <QObject> + +/// @brief Test moc include pattern in the source file +/// +class IncB : public QObject +{ + Q_OBJECT +public: + IncB(); +}; + +#endif diff --git a/Tests/QtAutogen/MocOnly/main.cpp b/Tests/QtAutogen/MocOnly/main.cpp index 06f8d81..1611f97 100644 --- a/Tests/QtAutogen/MocOnly/main.cpp +++ b/Tests/QtAutogen/MocOnly/main.cpp @@ -1,3 +1,5 @@ +#include "IncA.hpp" +#include "IncB.hpp" #include "StyleA.hpp" #include "StyleB.hpp" @@ -5,5 +7,8 @@ int main(int argv, char** args) { StyleA styleA; StyleB styleB; + IncA incA; + IncB incB; + return 0; } diff --git a/Tests/QtAutogen/UicOnly/CMakeLists.txt b/Tests/QtAutogen/UicOnly/CMakeLists.txt index 89a9a1b..f927f72 100644 --- a/Tests/QtAutogen/UicOnly/CMakeLists.txt +++ b/Tests/QtAutogen/UicOnly/CMakeLists.txt @@ -3,8 +3,6 @@ project(UicOnly) include("../AutogenTest.cmake") # Test AUTOUIC being enabled only -# The moc is provided by the Qt macro -qtx_wrap_cpp(uicOnlyMoc uiconly.h) -add_executable(uicOnly uiconly.cpp ${uicOnlyMoc}) +add_executable(uicOnly main.cpp UicOnly.cpp) set_property(TARGET uicOnly PROPERTY AUTOUIC ON) target_link_libraries(uicOnly ${QT_LIBRARIES}) diff --git a/Tests/QtAutogen/UicOnly/UicOnly.cpp b/Tests/QtAutogen/UicOnly/UicOnly.cpp new file mode 100644 index 0000000..8eee6d2 --- /dev/null +++ b/Tests/QtAutogen/UicOnly/UicOnly.cpp @@ -0,0 +1,18 @@ +#include "ui_uiC.h" +#include "ui_uiD.h" +// AUTOUIC includes on the first two lines of a source file +#include "UicOnly.hpp" + +UicOnly::UicOnly() + : uiA(new Ui::UiA) + , uiB(new Ui::UiB) +{ + Ui::UiC uiC; + Ui::UiD uiD; +} + +UicOnly::~UicOnly() +{ + delete uiB; + delete uiA; +} diff --git a/Tests/QtAutogen/UicOnly/UicOnly.hpp b/Tests/QtAutogen/UicOnly/UicOnly.hpp new file mode 100644 index 0000000..24e1e0b --- /dev/null +++ b/Tests/QtAutogen/UicOnly/UicOnly.hpp @@ -0,0 +1,15 @@ +#include "ui_uiA.h" +#include "ui_uiB.h" +// AUTOUIC includes on the first two lines of a header file +#include <QObject> + +class UicOnly : public QObject +{ +public: + UicOnly(); + ~UicOnly(); + +private: + Ui::UiA* uiA; + Ui::UiB* uiB; +}; diff --git a/Tests/QtAutogen/UicOnly/main.cpp b/Tests/QtAutogen/UicOnly/main.cpp new file mode 100644 index 0000000..bdd242e --- /dev/null +++ b/Tests/QtAutogen/UicOnly/main.cpp @@ -0,0 +1,7 @@ +#include "UicOnly.hpp" + +int main(int argc, char* argv[]) +{ + UicOnly uicOnly; + return 0; +} diff --git a/Tests/QtAutogen/UicOnly/uiconly.ui b/Tests/QtAutogen/UicOnly/uiA.ui index 13fb832..4c5762e 100644 --- a/Tests/QtAutogen/UicOnly/uiconly.ui +++ b/Tests/QtAutogen/UicOnly/uiA.ui @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> - <class>UicOnly</class> - <widget class="QWidget" name="UicOnly"> + <class>UiA</class> + <widget class="QWidget" name="UiA"> <property name="geometry"> <rect> <x>0</x> diff --git a/Tests/QtAutogen/UicOnly/uiB.ui b/Tests/QtAutogen/UicOnly/uiB.ui new file mode 100644 index 0000000..6ca77de --- /dev/null +++ b/Tests/QtAutogen/UicOnly/uiB.ui @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>UiB</class> + <widget class="QWidget" name="UiB"> + <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> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QTreeView" name="treeView"/> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> diff --git a/Tests/QtAutogen/UicOnly/uiC.ui b/Tests/QtAutogen/UicOnly/uiC.ui new file mode 100644 index 0000000..6802550 --- /dev/null +++ b/Tests/QtAutogen/UicOnly/uiC.ui @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>UiC</class> + <widget class="QWidget" name="UiC"> + <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> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QTreeView" name="treeView"/> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> diff --git a/Tests/QtAutogen/UicOnly/uiD.ui b/Tests/QtAutogen/UicOnly/uiD.ui new file mode 100644 index 0000000..aad79cf --- /dev/null +++ b/Tests/QtAutogen/UicOnly/uiD.ui @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>UiD</class> + <widget class="QWidget" name="UiD"> + <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> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QTreeView" name="treeView"/> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> diff --git a/Tests/QtAutogen/UicOnly/uiconly.cpp b/Tests/QtAutogen/UicOnly/uiconly.cpp deleted file mode 100644 index 7b91b25..0000000 --- a/Tests/QtAutogen/UicOnly/uiconly.cpp +++ /dev/null @@ -1,18 +0,0 @@ - -#include "uiconly.h" - -UicOnly::UicOnly(QWidget* parent) - : QWidget(parent) - , ui(new Ui::UicOnly) -{ -} - -UicOnly::~UicOnly() -{ - delete ui; -} - -int main() -{ - return 0; -} diff --git a/Tests/QtAutogen/UicOnly/uiconly.h b/Tests/QtAutogen/UicOnly/uiconly.h deleted file mode 100644 index 8f4eebe..0000000 --- a/Tests/QtAutogen/UicOnly/uiconly.h +++ /dev/null @@ -1,20 +0,0 @@ - -#ifndef UIC_ONLY_H -#define UIC_ONLY_H - -#include <QWidget> - -#include "ui_uiconly.h" - -class UicOnly : public QWidget -{ - Q_OBJECT -public: - explicit UicOnly(QWidget* parent = 0); - ~UicOnly(); - -private: - Ui::UicOnly* ui; -}; - -#endif |