diff options
27 files changed, 103 insertions, 264 deletions
diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index 0adfff6..dd59a00 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -122,6 +122,7 @@ Properties on Targets /prop_tgt/ARCHIVE_OUTPUT_NAME /prop_tgt/AUTOGEN_BUILD_DIR /prop_tgt/AUTOGEN_TARGET_DEPENDS + /prop_tgt/AUTOMOC_COMPILER_PREDEFINES /prop_tgt/AUTOMOC_DEPEND_FILTERS /prop_tgt/AUTOMOC_MACRO_NAMES /prop_tgt/AUTOMOC_MOC_OPTIONS diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index cba81e5..66d3049 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -270,6 +270,7 @@ Variables that Control the Build /variable/CMAKE_ARCHIVE_OUTPUT_DIRECTORY /variable/CMAKE_ARCHIVE_OUTPUT_DIRECTORY_CONFIG /variable/CMAKE_AUTOMOC + /variable/CMAKE_AUTOMOC_COMPILER_PREDEFINES /variable/CMAKE_AUTOMOC_DEPEND_FILTERS /variable/CMAKE_AUTOMOC_MACRO_NAMES /variable/CMAKE_AUTOMOC_MOC_OPTIONS @@ -398,6 +399,7 @@ Variables for Languages /variable/CMAKE_LANG_COMPILER_LOADED /variable/CMAKE_LANG_COMPILER_TARGET /variable/CMAKE_LANG_COMPILER_VERSION + /variable/CMAKE_LANG_COMPILER_PREDEFINES_COMMAND /variable/CMAKE_LANG_COMPILE_OBJECT /variable/CMAKE_LANG_CREATE_SHARED_LIBRARY /variable/CMAKE_LANG_CREATE_SHARED_MODULE diff --git a/Help/prop_tgt/AUTOMOC.rst b/Help/prop_tgt/AUTOMOC.rst index 641ac09..9e5261f 100644 --- a/Help/prop_tgt/AUTOMOC.rst +++ b/Help/prop_tgt/AUTOMOC.rst @@ -76,6 +76,9 @@ Additional macro names to search for can be added to :prop_tgt:`AUTOMOC_MACRO_NA Additional ``moc`` dependency file names can be extracted from source code by using :prop_tgt:`AUTOMOC_DEPEND_FILTERS`. +Compiler pre definitions for ``moc`` are written to a ``moc_predefs.h`` file +which is controlled by :prop_tgt:`AUTOMOC_COMPILER_PREDEFINES`. + Source C++ files can be excluded from :prop_tgt:`AUTOMOC` processing by enabling :prop_sf:`SKIP_AUTOMOC` or the broader :prop_sf:`SKIP_AUTOGEN`. diff --git a/Help/prop_tgt/AUTOMOC_COMPILER_PREDEFINES.rst b/Help/prop_tgt/AUTOMOC_COMPILER_PREDEFINES.rst new file mode 100644 index 0000000..57a647f --- /dev/null +++ b/Help/prop_tgt/AUTOMOC_COMPILER_PREDEFINES.rst @@ -0,0 +1,24 @@ +AUTOMOC_COMPILER_PREDEFINES +--------------------------- + +Boolean value used by :prop_tgt:`AUTOMOC` to determine if the +compiler pre definitions file ``moc_predefs.h`` should be generated. + +CMake generates a ``moc_predefs.h`` file with compiler pre definitions +from the output of the command defined in +:variable:`CMAKE_CXX_COMPILER_PREDEFINES_COMMAND <CMAKE_<LANG>_COMPILER_PREDEFINES_COMMAND>` +when + +- :prop_tgt:`AUTOMOC` is enabled, +- :prop_tgt:`AUTOMOC_COMPILER_PREDEFINES` is enabled, +- :variable:`CMAKE_CXX_COMPILER_PREDEFINES_COMMAND <CMAKE_<LANG>_COMPILER_PREDEFINES_COMMAND>` isn't empty and +- the Qt version is greater or equal 5.8. + +The ``moc_predefs.h`` file, which is generated in :prop_tgt:`AUTOGEN_BUILD_DIR`, +is passed to ``moc`` as the argument to the ``--include`` option. + +By default :prop_tgt:`AUTOMOC_COMPILER_PREDEFINES` is initialized from +:variable:`CMAKE_AUTOMOC_COMPILER_PREDEFINES`, which is ON by default. + +See the :manual:`cmake-qt(7)` manual for more information on using CMake +with Qt. diff --git a/Help/release/dev/autogen-predefs.rst b/Help/release/dev/autogen-predefs.rst new file mode 100644 index 0000000..c390e2a --- /dev/null +++ b/Help/release/dev/autogen-predefs.rst @@ -0,0 +1,11 @@ +autogen-predefs +--------------- + +* When using :prop_tgt:`AUTOMOC`, the new variable + :variable:`CMAKE_AUTOMOC_COMPILER_PREDEFINES` allows to default + enable or disable the generation of the compiler pre definitions file + ``moc_predefs.h``. + +* When using :prop_tgt:`AUTOMOC`, the new boolean target property + :prop_tgt:`AUTOMOC_COMPILER_PREDEFINES` allows to enable or disable the + generation of the compiler pre definitions file ``moc_predefs.h``. diff --git a/Help/variable/CMAKE_AUTOMOC_COMPILER_PREDEFINES.rst b/Help/variable/CMAKE_AUTOMOC_COMPILER_PREDEFINES.rst new file mode 100644 index 0000000..7e1c53d --- /dev/null +++ b/Help/variable/CMAKE_AUTOMOC_COMPILER_PREDEFINES.rst @@ -0,0 +1,8 @@ +CMAKE_AUTOMOC_COMPILER_PREDEFINES +--------------------------------- + +This variable is used to initialize the :prop_tgt:`AUTOMOC_COMPILER_PREDEFINES` +property on all the targets. See that target property for additional +information. + +By default it is ON. diff --git a/Help/variable/CMAKE_LANG_COMPILER_PREDEFINES_COMMAND.rst b/Help/variable/CMAKE_LANG_COMPILER_PREDEFINES_COMMAND.rst new file mode 100644 index 0000000..e050f43 --- /dev/null +++ b/Help/variable/CMAKE_LANG_COMPILER_PREDEFINES_COMMAND.rst @@ -0,0 +1,8 @@ +CMAKE_<LANG>_COMPILER_PREDEFINES_COMMAND +---------------------------------------- + +Command that outputs the compiler pre definitions. + +See :prop_tgt:`AUTOMOC` which uses +:variable:`CMAKE_CXX_COMPILER_PREDEFINES_COMMAND <CMAKE_<LANG>_COMPILER_PREDEFINES_COMMAND>` +to generate the :prop_tgt:`AUTOMOC_COMPILER_PREDEFINES`. diff --git a/Modules/CMakeGenericSystem.cmake b/Modules/CMakeGenericSystem.cmake index 3951b2c..324a279 100644 --- a/Modules/CMakeGenericSystem.cmake +++ b/Modules/CMakeGenericSystem.cmake @@ -23,6 +23,7 @@ set(CMAKE_DL_LIBS "dl") set(CMAKE_FIND_LIBRARY_PREFIXES "lib") set(CMAKE_FIND_LIBRARY_SUFFIXES ".so" ".a") +set(CMAKE_AUTOMOC_COMPILER_PREDEFINES ON) set(CMAKE_AUTOMOC_MACRO_NAMES "Q_OBJECT" "Q_GADGET" "Q_NAMESPACE") # basically all general purpose OSs support shared libs diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 6d1514d..88d14ab 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -245,10 +245,9 @@ if (NOT Boost_NO_BOOST_CMAKE) # If we found boost-cmake, then we're done. Print out what we found. # Otherwise let the rest of the module try to find it. if (Boost_FOUND) - message("Boost ${Boost_FIND_VERSION} found.") + message(STATUS "Boost ${Boost_FIND_VERSION} found.") if (Boost_FIND_COMPONENTS) - message("Found Boost components:") - message(" ${Boost_FIND_COMPONENTS}") + message(STATUS "Found Boost components:\n ${Boost_FIND_COMPONENTS}") endif() # Restore project's policies cmake_policy(POP) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 2153ade..fa39e15 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 9) -set(CMake_VERSION_PATCH 20171001) +set(CMake_VERSION_PATCH 20171002) #set(CMake_VERSION_RC 1) diff --git a/Source/CPack/cmCPackDragNDropGenerator.cxx b/Source/CPack/cmCPackDragNDropGenerator.cxx index 45c7fc6..1e1543f 100644 --- a/Source/CPack/cmCPackDragNDropGenerator.cxx +++ b/Source/CPack/cmCPackDragNDropGenerator.cxx @@ -417,6 +417,7 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, temp_image_command << " -ov"; temp_image_command << " -srcfolder \"" << staging.str() << "\""; temp_image_command << " -volname \"" << cpack_dmg_volume_name << "\""; + temp_image_command << " -fs HFS+"; temp_image_command << " -format " << temp_image_format; temp_image_command << " \"" << temp_image << "\""; @@ -561,8 +562,9 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, cmCPackLogger(cmCPackLog::LOG_ERROR, languages[i] << " is not a recognized language" << std::endl); } - char* iso_language_cstr = static_cast<char*>(malloc(65)); - CFStringGetCString(iso_language, iso_language_cstr, 64, + char iso_language_cstr[65]; + CFStringGetCString(iso_language, iso_language_cstr, + sizeof(iso_language_cstr) - 1, kCFStringEncodingMacRoman); LangCode lang = 0; RegionCode region = 0; @@ -575,11 +577,9 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir, cmCPackLogger(cmCPackLog::LOG_ERROR, "No language/region code available for " << iso_language_cstr << std::endl); - free(iso_language_cstr); return 0; } #ifdef HAVE_CoreServices - free(iso_language_cstr); header_data.push_back(region); header_data.push_back(i); header_data.push_back(0); diff --git a/Source/CPack/cmCPackOSXX11Generator.cxx b/Source/CPack/cmCPackOSXX11Generator.cxx index e75061e..8d3c40c 100644 --- a/Source/CPack/cmCPackOSXX11Generator.cxx +++ b/Source/CPack/cmCPackOSXX11Generator.cxx @@ -144,8 +144,8 @@ int cmCPackOSXX11Generator::PackageFiles() tmpFile += "/hdiutilOutput.log"; std::ostringstream dmgCmd; dmgCmd << "\"" << this->GetOption("CPACK_INSTALLER_PROGRAM_DISK_IMAGE") - << "\" create -ov -format UDZO -srcfolder \"" << diskImageDirectory - << "\" \"" << packageFileNames[0] << "\""; + << "\" create -ov -fs HFS+ -format UDZO -srcfolder \"" + << diskImageDirectory << "\" \"" << packageFileNames[0] << "\""; cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Compress disk image using command: " << dmgCmd.str() << std::endl); // since we get random dashboard failures with this one diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx index c6f0a51..217865b 100644 --- a/Source/cmQtAutoGeneratorInitializer.cxx +++ b/Source/cmQtAutoGeneratorInitializer.cxx @@ -363,11 +363,14 @@ static void SetupAutoTargetMoc(cmQtAutoGenDigest const& digest, AddDefinitionEscaped(makefile, "_moc_depend_filters", GetSafeProperty(target, "AUTOMOC_DEPEND_FILTERS")); - if (QtVersionGreaterOrEqual(digest.QtVersionMajor, digest.QtVersionMinor, 5, - 8)) { - AddDefinitionEscaped( - makefile, "_moc_predefs_cmd", - makefile->GetSafeDefinition("CMAKE_CXX_COMPILER_PREDEFINES_COMMAND")); + // Compiler predefines + if (target->GetPropertyAsBool("AUTOMOC_COMPILER_PREDEFINES")) { + if (QtVersionGreaterOrEqual(digest.QtVersionMajor, digest.QtVersionMinor, + 5, 8)) { + AddDefinitionEscaped( + makefile, "_moc_predefs_cmd", + makefile->GetSafeDefinition("CMAKE_CXX_COMPILER_PREDEFINES_COMMAND")); + } } // Moc includes and compile definitions { diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 49b0664..7a3cc76 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -244,6 +244,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type, this->SetPropertyDefault("AUTOMOC", nullptr); this->SetPropertyDefault("AUTOUIC", nullptr); this->SetPropertyDefault("AUTORCC", nullptr); + this->SetPropertyDefault("AUTOMOC_COMPILER_PREDEFINES", nullptr); this->SetPropertyDefault("AUTOMOC_DEPEND_FILTERS", nullptr); this->SetPropertyDefault("AUTOMOC_MACRO_NAMES", nullptr); this->SetPropertyDefault("AUTOMOC_MOC_OPTIONS", nullptr); diff --git a/Source/kwsys/CMakeLists.txt b/Source/kwsys/CMakeLists.txt index 5b8ce00..21568bb 100644 --- a/Source/kwsys/CMakeLists.txt +++ b/Source/kwsys/CMakeLists.txt @@ -1028,7 +1028,6 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR) ) ENDIF() SET(KWSYS_CXX_TESTS ${KWSYS_CXX_TESTS} - testIOS testSystemTools testCommandLineArguments testCommandLineArguments1 diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx index 0a22d63..ecfa331 100644 --- a/Source/kwsys/SystemTools.cxx +++ b/Source/kwsys/SystemTools.cxx @@ -2371,104 +2371,6 @@ long int SystemTools::CreationTime(const std::string& filename) return ct; } -bool SystemTools::ConvertDateMacroString(const char* str, time_t* tmt) -{ - if (!str || !tmt || strlen(str) > 11) { - return false; - } - - struct tm tmt2; - - // __DATE__ - // The compilation date of the current source file. The date is a string - // literal of the form Mmm dd yyyy. The month name Mmm is the same as for - // dates generated by the library function asctime declared in TIME.H. - - // index: 012345678901 - // format: Mmm dd yyyy - // example: Dec 19 2003 - - static char month_names[] = "JanFebMarAprMayJunJulAugSepOctNovDec"; - - char buffer[12]; - strcpy(buffer, str); - - buffer[3] = 0; - char* ptr = strstr(month_names, buffer); - if (!ptr) { - return false; - } - - int month = static_cast<int>((ptr - month_names) / 3); - int day = atoi(buffer + 4); - int year = atoi(buffer + 7); - - tmt2.tm_isdst = -1; - tmt2.tm_hour = 0; - tmt2.tm_min = 0; - tmt2.tm_sec = 0; - tmt2.tm_wday = 0; - tmt2.tm_yday = 0; - tmt2.tm_mday = day; - tmt2.tm_mon = month; - tmt2.tm_year = year - 1900; - - *tmt = mktime(&tmt2); - return true; -} - -bool SystemTools::ConvertTimeStampMacroString(const char* str, time_t* tmt) -{ - if (!str || !tmt || strlen(str) > 26) { - return false; - } - - struct tm tmt2; - - // __TIMESTAMP__ - // The date and time of the last modification of the current source file, - // expressed as a string literal in the form Ddd Mmm Date hh:mm:ss yyyy, - /// where Ddd is the abbreviated day of the week and Date is an integer - // from 1 to 31. - - // index: 0123456789 - // 0123456789 - // 0123456789 - // format: Ddd Mmm Date hh:mm:ss yyyy - // example: Fri Dec 19 14:34:58 2003 - - static char month_names[] = "JanFebMarAprMayJunJulAugSepOctNovDec"; - - char buffer[27]; - strcpy(buffer, str); - - buffer[7] = 0; - char* ptr = strstr(month_names, buffer + 4); - if (!ptr) { - return false; - } - - int month = static_cast<int>((ptr - month_names) / 3); - int day = atoi(buffer + 8); - int hour = atoi(buffer + 11); - int min = atoi(buffer + 14); - int sec = atoi(buffer + 17); - int year = atoi(buffer + 20); - - tmt2.tm_isdst = -1; - tmt2.tm_hour = hour; - tmt2.tm_min = min; - tmt2.tm_sec = sec; - tmt2.tm_wday = 0; - tmt2.tm_yday = 0; - tmt2.tm_mday = day; - tmt2.tm_mon = month; - tmt2.tm_year = year - 1900; - - *tmt = mktime(&tmt2); - return true; -} - std::string SystemTools::GetLastSystemError() { int e = errno; diff --git a/Source/kwsys/SystemTools.hxx.in b/Source/kwsys/SystemTools.hxx.in index 41a60d3..35bc1b1 100644 --- a/Source/kwsys/SystemTools.hxx.in +++ b/Source/kwsys/SystemTools.hxx.in @@ -206,13 +206,6 @@ public: static int Strucmp(const char* s1, const char* s2); /** - * Convert a string in __DATE__ or __TIMESTAMP__ format into a time_t. - * Return false on error, true on success - */ - static bool ConvertDateMacroString(const char* str, time_t* tmt); - static bool ConvertTimeStampMacroString(const char* str, time_t* tmt); - - /** * Split a string on its newlines into multiple lines * Return false only if the last line stored had no newline */ diff --git a/Source/kwsys/testIOS.cxx b/Source/kwsys/testIOS.cxx deleted file mode 100644 index 3e4c325..0000000 --- a/Source/kwsys/testIOS.cxx +++ /dev/null @@ -1,139 +0,0 @@ -/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying - file Copyright.txt or https://cmake.org/licensing#kwsys for details. */ -#include "kwsysPrivate.h" -#include KWSYS_HEADER(Configure.hxx) - -#include <fstream> -#include <iostream> -#include <sstream> -#include <string.h> /* strlen */ -#include <vector> - -// Work-around CMake dependency scanning limitation. This must -// duplicate the above list of headers. -#if 0 -#include "Configure.hxx.in" -#endif - -int testIOS(int, char* []) -{ - std::ostringstream ostr; - const char hello[] = "hello"; - ostr << hello; - if (ostr.str() != hello) { - std::cerr << "failed to write hello to ostr" << std::endl; - return 1; - } - const char world[] = "world"; - std::ostringstream ostr2; - ostr2.write(hello, strlen(hello)); /* I could do sizeof */ - ostr2.put('\0'); - ostr2.write(world, strlen(world)); - if (ostr2.str().size() != strlen(hello) + 1 + strlen(world)) { - std::cerr << "failed to write hello to ostr2" << std::endl; - return 1; - } - static const unsigned char array[] = { - 0xff, 0x4f, 0xff, 0x51, 0x00, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, - 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x07, 0x01, 0x01, 0xff, 0x52, 0x00, - 0x0c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x05, 0x04, 0x04, 0x00, 0x01, 0xff, - 0x5c, 0x00, 0x13, 0x40, 0x40, 0x48, 0x48, 0x50, 0x48, 0x48, 0x50, 0x48, - 0x48, 0x50, 0x48, 0x48, 0x50, 0x48, 0x48, 0x50, 0xff, 0x64, 0x00, 0x2c, - 0x00, 0x00, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x62, 0x79, - 0x20, 0x49, 0x54, 0x4b, 0x2f, 0x47, 0x44, 0x43, 0x4d, 0x2f, 0x4f, 0x70, - 0x65, 0x6e, 0x4a, 0x50, 0x45, 0x47, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, - 0x6f, 0x6e, 0x20, 0x31, 0x2e, 0x30, 0xff, 0x90, 0x00, 0x0a, 0x00, 0x00, - 0x00, 0x00, 0x06, 0x2c, 0x00, 0x01, 0xff, 0x93, 0xcf, 0xb0, 0x18, 0x08, - 0x7f, 0xc6, 0x99, 0xbf, 0xff, 0xc0, 0xf8, 0xc1, 0xc1, 0xf3, 0x05, 0x81, - 0xf2, 0x83, 0x0a, 0xa5, 0xff, 0x10, 0x90, 0xbf, 0x2f, 0xff, 0x04, 0xa8, - 0x7f, 0xc0, 0xf8, 0xc4, 0xc1, 0xf3, 0x09, 0x81, 0xf3, 0x0c, 0x19, 0x34 - }; - const size_t narray = sizeof(array); // 180 - std::stringstream strstr; - strstr.write((char*)array, narray); - // strstr.seekp( narray / 2 ); // set position of put pointer in mid string - if (strstr.str().size() != narray) { - std::cerr << "failed to write array to strstr" << std::endl; - return 1; - } - - std::istringstream istr(" 10 20 str "); - std::string s; - int x; - if (istr >> x) { - if (x != 10) { - std::cerr << "x != 10" << std::endl; - return 1; - } - } else { - std::cerr << "Failed to read 10 from istr" << std::endl; - return 1; - } - if (istr >> x) { - if (x != 20) { - std::cerr << "x != 20" << std::endl; - return 1; - } - } else { - std::cerr << "Failed to read 20 from istr" << std::endl; - return 1; - } - if (istr >> s) { - if (s != "str") { - std::cerr << "s != \"str\"" << std::endl; - return 1; - } - } else { - std::cerr << "Failed to read str from istr" << std::endl; - return 1; - } - if (istr >> s) { - std::cerr << "Able to read past end of stream" << std::endl; - return 1; - } else { - // Clear the failure. - istr.clear(istr.rdstate() & ~std::ios::eofbit); - istr.clear(istr.rdstate() & ~std::ios::failbit); - } - istr.str("30"); - if (istr >> x) { - if (x != 30) { - std::cerr << "x != 30" << std::endl; - return 1; - } - } else { - std::cerr << "Failed to read 30 from istr" << std::endl; - return 1; - } - - std::stringstream sstr; - sstr << "40 str2"; - if (sstr >> x) { - if (x != 40) { - std::cerr << "x != 40" << std::endl; - return 1; - } - } else { - std::cerr << "Failed to read 40 from sstr" << std::endl; - return 1; - } - if (sstr >> s) { - if (s != "str2") { - std::cerr << "s != \"str2\"" << std::endl; - return 1; - } - } else { - std::cerr << "Failed to read str2 from sstr" << std::endl; - return 1; - } - - // Just try to compile this. - if (x == 12345) { - std::ifstream fin("/does_not_exist", std::ios::in | std::ios::binary); - } - - std::cout << "IOS tests passed" << std::endl; - return 0; -} diff --git a/Source/kwsys/testSystemTools.cxx b/Source/kwsys/testSystemTools.cxx index 1871f5d..768eb4d 100644 --- a/Source/kwsys/testSystemTools.cxx +++ b/Source/kwsys/testSystemTools.cxx @@ -22,6 +22,7 @@ #include <iostream> #include <sstream> +#include <stdlib.h> /* free */ #include <string.h> /* strcmp */ #if defined(_WIN32) && !defined(__CYGWIN__) #include <io.h> /* _umask (MSVC) / umask (Borland) */ @@ -535,15 +536,14 @@ static bool CheckStringOperations() } delete[] cres; - char* cres2 = new char[strlen("Mary Had A Little Lamb.") + 1]; - strcpy(cres2, "Mary Had A Little Lamb."); + char* cres2 = strdup("Mary Had A Little Lamb."); kwsys::SystemTools::ReplaceChars(cres2, "aeiou", 'X'); if (strcmp(cres2, "MXry HXd A LXttlX LXmb.")) { std::cerr << "Problem with ReplaceChars " << "\"Mary Had A Little Lamb.\"" << std::endl; res = false; } - delete[] cres2; + free(cres2); if (!kwsys::SystemTools::StringStartsWith("Mary Had A Little Lamb.", "Mary ")) { diff --git a/Tests/CudaOnly/WithDefs/CMakeLists.txt b/Tests/CudaOnly/WithDefs/CMakeLists.txt index 0bc4e5c..9b82366 100644 --- a/Tests/CudaOnly/WithDefs/CMakeLists.txt +++ b/Tests/CudaOnly/WithDefs/CMakeLists.txt @@ -4,7 +4,11 @@ project (CudaOnlyWithDefs CUDA) #verify that we can pass explicit cuda arch flags string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_30,code=compute_30") -set(debug_compile_flags --generate-code arch=compute_20,code=sm_20) +if(CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 9) + set(debug_compile_flags --generate-code arch=compute_32,code=sm_32) +else() + set(debug_compile_flags --generate-code arch=compute_20,code=sm_20) +endif() if(CMAKE_CUDA_SIMULATE_ID STREQUAL "MSVC") list(APPEND debug_compile_flags -Xcompiler=-WX) else() diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 5622f8e..57cc144 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -141,6 +141,7 @@ add_RunCMake_test(DisallowedCommands) add_RunCMake_test(ExternalData) add_RunCMake_test(FeatureSummary) add_RunCMake_test(FPHSA) +add_RunCMake_test(FindBoost) if(NOT CMAKE_C_COMPILER_ID MATCHES "Watcom") add_RunCMake_test(GenerateExportHeader) endif() diff --git a/Tests/RunCMake/FindBoost/CMakeLists.txt b/Tests/RunCMake/FindBoost/CMakeLists.txt new file mode 100644 index 0000000..d3137f6 --- /dev/null +++ b/Tests/RunCMake/FindBoost/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.9) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/FindBoost/CMakePackage-stdout.txt b/Tests/RunCMake/FindBoost/CMakePackage-stdout.txt new file mode 100644 index 0000000..664e4a5 --- /dev/null +++ b/Tests/RunCMake/FindBoost/CMakePackage-stdout.txt @@ -0,0 +1,3 @@ +-- Boost 1\.12345 found\. +-- Found Boost components: + date_time diff --git a/Tests/RunCMake/FindBoost/CMakePackage.cmake b/Tests/RunCMake/FindBoost/CMakePackage.cmake new file mode 100644 index 0000000..06aeccb --- /dev/null +++ b/Tests/RunCMake/FindBoost/CMakePackage.cmake @@ -0,0 +1,2 @@ +set(Boost_DIR ${CMAKE_CURRENT_SOURCE_DIR}/CMakePackage) +find_package(Boost 1.12345 COMPONENTS date_time) diff --git a/Tests/RunCMake/FindBoost/CMakePackage/BoostConfig.cmake b/Tests/RunCMake/FindBoost/CMakePackage/BoostConfig.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/FindBoost/CMakePackage/BoostConfig.cmake diff --git a/Tests/RunCMake/FindBoost/CMakePackage/BoostConfigVersion.cmake b/Tests/RunCMake/FindBoost/CMakePackage/BoostConfigVersion.cmake new file mode 100644 index 0000000..8176ced --- /dev/null +++ b/Tests/RunCMake/FindBoost/CMakePackage/BoostConfigVersion.cmake @@ -0,0 +1,7 @@ +set(PACKAGE_VERSION 1.12345) +if(PACKAGE_FIND_VERSION_MAJOR EQUAL 1) + set(PACKAGE_VERSION_COMPATIBLE 1) + if(PACKAGE_FIND_VERSION_MINOR EQUAL 12345) + set(PACKAGE_VERSION_EXACT 1) + endif() +endif() diff --git a/Tests/RunCMake/FindBoost/RunCMakeTest.cmake b/Tests/RunCMake/FindBoost/RunCMakeTest.cmake new file mode 100644 index 0000000..a153ae1 --- /dev/null +++ b/Tests/RunCMake/FindBoost/RunCMakeTest.cmake @@ -0,0 +1,3 @@ +include(RunCMake) + +run_cmake(CMakePackage) |