diff options
-rw-r--r-- | Modules/CMakeDetermineCompilerId.cmake | 2 | ||||
-rw-r--r-- | Modules/FindFreetype.cmake | 16 | ||||
-rw-r--r-- | Modules/FindSubversion.cmake | 2 | ||||
-rw-r--r-- | Source/CMakeVersion.cmake | 2 | ||||
-rw-r--r-- | Source/cmExtraKateGenerator.cxx | 75 | ||||
-rw-r--r-- | Source/cmExtraKateGenerator.h | 6 | ||||
-rw-r--r-- | Source/cmTarget.cxx | 12 | ||||
-rw-r--r-- | Tests/Contracts/VTK/Dashboard.cmake.in | 9 | ||||
-rw-r--r-- | Tests/RunCMake/interface_library/RunCMakeTest.cmake | 1 | ||||
-rw-r--r-- | Tests/RunCMake/interface_library/genex_link-result.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/interface_library/genex_link-stderr.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/interface_library/genex_link.cmake | 22 | ||||
-rw-r--r-- | Utilities/cmlibarchive/libarchive/archive_read_support_format_tar.c | 68 |
13 files changed, 133 insertions, 84 deletions
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 518b8c6..2bcf3d1 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -232,7 +232,7 @@ Id flags: ${testflags} # ... # /path/to/cc ...CompilerId${lang}/... # to extract the compiler front-end for the language. - if("${CMAKE_${lang}_COMPILER_ID_OUTPUT}" MATCHES "\nLd[^\n]*(\n[ \t]+[^\n]*)*\n[ \t]+([^ \t\r\n]+)[^\r\n]*-o[^\r\n]*CompilerId${lang}/\\./CompilerId${lang}[ \t\n\\\"]") + if("${CMAKE_${lang}_COMPILER_ID_OUTPUT}" MATCHES "\nLd[^\n]*(\n[ \t]+[^\n]*)*\n[ \t]+([^ \t\r\n]+)[^\r\n]*-o[^\r\n]*CompilerId${lang}/(\\./)?CompilerId${lang}[ \t\n\\\"]") set(_comp "${CMAKE_MATCH_2}") if(EXISTS "${_comp}") set(CMAKE_${lang}_COMPILER_ID_TOOL "${_comp}" PARENT_SCOPE) diff --git a/Modules/FindFreetype.cmake b/Modules/FindFreetype.cmake index 179dc00..6f03c86 100644 --- a/Modules/FindFreetype.cmake +++ b/Modules/FindFreetype.cmake @@ -65,7 +65,10 @@ find_path(FREETYPE_INCLUDE_DIR_ft2build ft2build.h PATH_SUFFIXES include/freetype2 include ) -find_path(FREETYPE_INCLUDE_DIR_freetype2 freetype/config/ftheader.h +find_path(FREETYPE_INCLUDE_DIR_freetype2 + NAMES + freetype/config/ftheader.h + config/ftheader.h HINTS ENV FREETYPE_DIR PATHS @@ -97,11 +100,18 @@ find_library(FREETYPE_LIBRARY # set the user variables if(FREETYPE_INCLUDE_DIR_ft2build AND FREETYPE_INCLUDE_DIR_freetype2) set(FREETYPE_INCLUDE_DIRS "${FREETYPE_INCLUDE_DIR_ft2build};${FREETYPE_INCLUDE_DIR_freetype2}") + list(REMOVE_DUPLICATES FREETYPE_INCLUDE_DIRS) endif() set(FREETYPE_LIBRARIES "${FREETYPE_LIBRARY}") -if(FREETYPE_INCLUDE_DIR_freetype2 AND EXISTS "${FREETYPE_INCLUDE_DIR_freetype2}/freetype/freetype.h") - file(STRINGS "${FREETYPE_INCLUDE_DIR_freetype2}/freetype/freetype.h" freetype_version_str +if(EXISTS "${FREETYPE_INCLUDE_DIR_freetype2}/freetype/freetype.h") + set(FREETYPE_H "${FREETYPE_INCLUDE_DIR_freetype2}/freetype/freetype.h") +elseif(EXISTS "${FREETYPE_INCLUDE_DIR_freetype2}/freetype.h") + set(FREETYPE_H "${FREETYPE_INCLUDE_DIR_freetype2}/freetype.h") +endif() + +if(FREETYPE_INCLUDE_DIR_freetype2 AND FREETYPE_H) + file(STRINGS "${FREETYPE_H}" freetype_version_str REGEX "^#[\t ]*define[\t ]+FREETYPE_(MAJOR|MINOR|PATCH)[\t ]+[0-9]+$") unset(FREETYPE_VERSION_STRING) diff --git a/Modules/FindSubversion.cmake b/Modules/FindSubversion.cmake index 2338721..0d13318 100644 --- a/Modules/FindSubversion.cmake +++ b/Modules/FindSubversion.cmake @@ -73,6 +73,8 @@ # License text for the above reference.) find_program(Subversion_SVN_EXECUTABLE svn + PATHS + [HKEY_LOCAL_MACHINE\\Software\\TortoiseSVN;Directory]/bin DOC "subversion command line client") mark_as_advanced(Subversion_SVN_EXECUTABLE) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 8cd4750..711b99a 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -2,5 +2,5 @@ set(CMake_VERSION_MAJOR 2) set(CMake_VERSION_MINOR 8) set(CMake_VERSION_PATCH 12) -set(CMake_VERSION_TWEAK 20131209) +set(CMake_VERSION_TWEAK 20131219) #set(CMake_VERSION_RC 1) diff --git a/Source/cmExtraKateGenerator.cxx b/Source/cmExtraKateGenerator.cxx index f020ddb..177ef8d 100644 --- a/Source/cmExtraKateGenerator.cxx +++ b/Source/cmExtraKateGenerator.cxx @@ -52,6 +52,8 @@ void cmExtraKateGenerator::Generate() this->ProjectName = this->GenerateProjectName(mf->GetProjectName(), mf->GetSafeDefinition("CMAKE_BUILD_TYPE"), this->GetPathBasename(mf->GetHomeOutputDirectory())); + this->UseNinja = (strcmp(this->GlobalGenerator->GetName(), "Ninja")==0); + this->CreateKateProjectFile(mf); this->CreateDummyKateProjectFile(mf); } @@ -95,11 +97,12 @@ cmExtraKateGenerator::WriteTargets(const cmMakefile* mf, const std::string make = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM"); const std::string makeArgs = mf->GetSafeDefinition( "CMAKE_KATE_MAKE_ARGUMENTS"); + const char* homeOutputDir = mf->GetHomeOutputDirectory(); this->AppendTarget(fout, "all", make, makeArgs, - mf->GetHomeOutputDirectory()); + homeOutputDir, homeOutputDir); this->AppendTarget(fout, "clean", make, makeArgs, - mf->GetHomeOutputDirectory()); + homeOutputDir, homeOutputDir); // add all executable and library targets and some of the GLOBAL // and UTILITY targets @@ -143,7 +146,8 @@ cmExtraKateGenerator::WriteTargets(const cmMakefile* mf, } if (insertTarget) { - this->AppendTarget(fout, ti->first, make, makeArgs, currentDir); + this->AppendTarget(fout, ti->first, make, makeArgs, + currentDir, homeOutputDir); } } break; @@ -158,7 +162,8 @@ cmExtraKateGenerator::WriteTargets(const cmMakefile* mf, break; } - this->AppendTarget(fout, ti->first, make, makeArgs, currentDir); + this->AppendTarget(fout, ti->first, make, makeArgs, + currentDir, homeOutputDir); break; case cmTarget::EXECUTABLE: case cmTarget::STATIC_LIBRARY: @@ -166,10 +171,12 @@ cmExtraKateGenerator::WriteTargets(const cmMakefile* mf, case cmTarget::MODULE_LIBRARY: case cmTarget::OBJECT_LIBRARY: { - this->AppendTarget(fout, ti->first, make, makeArgs, currentDir); + this->AppendTarget(fout, ti->first, make, makeArgs, + currentDir, homeOutputDir); std::string fastTarget = ti->first; fastTarget += "/fast"; - this->AppendTarget(fout, fastTarget, make, makeArgs, currentDir); + this->AppendTarget(fout, fastTarget, make, makeArgs, + currentDir, homeOutputDir); } break; @@ -185,7 +192,7 @@ cmExtraKateGenerator::WriteTargets(const cmMakefile* mf, fit != objectFileTargets.end(); ++fit) { - this->AppendTarget(fout, *fit, make, makeArgs, currentDir); + this->AppendTarget(fout, *fit, make, makeArgs, currentDir,homeOutputDir); } } @@ -199,14 +206,18 @@ cmExtraKateGenerator::AppendTarget(cmGeneratedFileStream& fout, const std::string& target, const std::string& make, const std::string& makeArgs, - const std::string& path) const + const std::string& path, + const char* homeOutputDir + ) const { static char JsonSep = ' '; fout << "\t\t\t" << JsonSep << "{\"name\":\"" << target << "\", " - "\"build_cmd\":\"" << make << " -C " << path << " " << makeArgs << " " - << target << "\"}\n"; + "\"build_cmd\":\"" << make + << " -C " << (this->UseNinja ? homeOutputDir : path.c_str()) + << " " << makeArgs << " " + << target << "\"}\n"; JsonSep = ','; } @@ -326,47 +337,3 @@ std::string cmExtraKateGenerator::GetPathBasename(const std::string& path)const return outputBasename; } - - -// Create the command line for building the given target using the selected -// make -std::string cmExtraKateGenerator::BuildMakeCommand(const std::string& make, - const char* makefile, const char* target) const -{ - std::string command = make; - if (strcmp(this->GlobalGenerator->GetName(), "NMake Makefiles")==0) - { - std::string makefileName = cmSystemTools::ConvertToOutputPath(makefile); - command += " /NOLOGO /f ""; - command += makefileName; - command += "" "; - command += " VERBOSE=1 "; - command += target; - } - else if (strcmp(this->GlobalGenerator->GetName(), "MinGW Makefiles")==0) - { - // no escaping of spaces in this case, see - // http://public.kitware.com/Bug/view.php?id=10014 - std::string makefileName = makefile; - command += " -f ""; - command += makefileName; - command += "" "; - command += " VERBOSE=1 "; - command += target; - } - else if (strcmp(this->GlobalGenerator->GetName(), "Ninja")==0) - { - command += " -v "; - command += target; - } - else - { - std::string makefileName = cmSystemTools::ConvertToOutputPath(makefile); - command += " -f ""; - command += makefileName; - command += "" "; - command += " VERBOSE=1 "; - command += target; - } - return command; -} diff --git a/Source/cmExtraKateGenerator.h b/Source/cmExtraKateGenerator.h index 4979eff..6ced5fe 100644 --- a/Source/cmExtraKateGenerator.h +++ b/Source/cmExtraKateGenerator.h @@ -46,17 +46,17 @@ private: const std::string& target, const std::string& make, const std::string& makeArgs, - const std::string& path) const; + const std::string& path, + const char* homeOutputDir) const; std::string GenerateFilesString(const cmMakefile* mf) const; std::string GetPathBasename(const std::string& path) const; std::string GenerateProjectName(const std::string& name, const std::string& type, const std::string& path) const; - std::string BuildMakeCommand(const std::string& make, - const char* makefile, const char* target) const; std::string ProjectName; + bool UseNinja; }; #endif diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 8628fd8..a44cda1 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -4861,6 +4861,15 @@ bool cmTarget::GetMappedConfig(std::string const& desired_config, const char** imp, std::string& suffix) const { + if (this->GetType() == INTERFACE_LIBRARY) + { + // This method attempts to find a config-specific LOCATION for the + // IMPORTED library. In the case of INTERFACE_LIBRARY, there is no + // LOCATION at all, so leaving *loc and *imp unchanged is the appropriate + // and valid response. + return true; + } + // Track the configuration-specific property suffix. suffix = "_"; suffix += desired_config; @@ -4993,8 +5002,7 @@ void cmTarget::ComputeImportInfo(std::string const& desired_config, const char* loc = 0; const char* imp = 0; std::string suffix; - if (this->GetType() != INTERFACE_LIBRARY && - !this->GetMappedConfig(desired_config, &loc, &imp, suffix)) + if (!this->GetMappedConfig(desired_config, &loc, &imp, suffix)) { return; } diff --git a/Tests/Contracts/VTK/Dashboard.cmake.in b/Tests/Contracts/VTK/Dashboard.cmake.in index e33a2de..c3d10f4 100644 --- a/Tests/Contracts/VTK/Dashboard.cmake.in +++ b/Tests/Contracts/VTK/Dashboard.cmake.in @@ -1,3 +1,11 @@ +# This submission's role is to test leading edge of cmake development +# against VTK release +# +# Maintainer: Zack Galbreath <zack.galbreath@kitware.com> +# +# This file was generated as part of the CMake/VTK Contracts test. +# See <CMake-src>/Tests/Contracts/VTK/ for more information + set(CTEST_SITE "@SITE@") set(CTEST_BUILD_NAME "Contracts.VTK") set(CTEST_DASHBOARD_ROOT "@base_dir@") @@ -6,6 +14,7 @@ set(CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}/VTK-build") set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") set(CTEST_CONFIGURATION_TYPE Debug) +set(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") # Assume a Linux build, with a make that supports -j9. Modify this script if # assumption is ever invalid. diff --git a/Tests/RunCMake/interface_library/RunCMakeTest.cmake b/Tests/RunCMake/interface_library/RunCMakeTest.cmake index e257fb3..0d00b71 100644 --- a/Tests/RunCMake/interface_library/RunCMakeTest.cmake +++ b/Tests/RunCMake/interface_library/RunCMakeTest.cmake @@ -4,3 +4,4 @@ run_cmake(invalid_name) run_cmake(target_commands) run_cmake(no_shared_libs) run_cmake(whitelist) +run_cmake(genex_link) diff --git a/Tests/RunCMake/interface_library/genex_link-result.txt b/Tests/RunCMake/interface_library/genex_link-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/interface_library/genex_link-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/interface_library/genex_link-stderr.txt b/Tests/RunCMake/interface_library/genex_link-stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/Tests/RunCMake/interface_library/genex_link-stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/Tests/RunCMake/interface_library/genex_link.cmake b/Tests/RunCMake/interface_library/genex_link.cmake new file mode 100644 index 0000000..0dbf029 --- /dev/null +++ b/Tests/RunCMake/interface_library/genex_link.cmake @@ -0,0 +1,22 @@ + +cmake_minimum_required(VERSION 2.8.12.20131125 FATAL_ERROR) + +project(genex_link) + +set(_main_cpp ${CMAKE_CURRENT_BINARY_DIR}/main.cpp) +file(WRITE ${_main_cpp} + "int main(int argc, char** argv) { return 0; }\n" +) + +add_library(foo::bar INTERFACE IMPORTED) +set_target_properties(foo::bar + PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}" + # When not using a generator expression here, no error is generated + INTERFACE_LINK_LIBRARIES "$<$<NOT:$<CONFIG:DEBUG>>:foo_bar.lib>" +) + +add_executable(main ${_main_cpp}) +target_include_directories(main PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}") + +target_link_libraries(main foo::bar) diff --git a/Utilities/cmlibarchive/libarchive/archive_read_support_format_tar.c b/Utilities/cmlibarchive/libarchive/archive_read_support_format_tar.c index a4dc710..c7c808f 100644 --- a/Utilities/cmlibarchive/libarchive/archive_read_support_format_tar.c +++ b/Utilities/cmlibarchive/libarchive/archive_read_support_format_tar.c @@ -2412,9 +2412,10 @@ tar_atol(const char *p, size_t char_cnt) static int64_t tar_atol_base_n(const char *p, size_t char_cnt, int base) { - int64_t l, limit, last_digit_limit; + int64_t l, maxval, limit, last_digit_limit; int digit, sign; + maxval = INT64_MAX; limit = INT64_MAX / base; last_digit_limit = INT64_MAX % base; @@ -2431,6 +2432,10 @@ tar_atol_base_n(const char *p, size_t char_cnt, int base) sign = -1; p++; char_cnt--; + + maxval = INT64_MIN; + limit = -(INT64_MIN / base); + last_digit_limit = INT64_MIN % base; } l = 0; @@ -2438,8 +2443,7 @@ tar_atol_base_n(const char *p, size_t char_cnt, int base) digit = *p - '0'; while (digit >= 0 && digit < base && char_cnt != 0) { if (l>limit || (l == limit && digit > last_digit_limit)) { - l = INT64_MAX; /* Truncate on overflow. */ - break; + return maxval; /* Truncate on overflow. */ } l = (l * base) + digit; digit = *++p - '0'; @@ -2462,32 +2466,56 @@ tar_atol10(const char *p, size_t char_cnt) } /* - * Parse a base-256 integer. This is just a straight signed binary - * value in big-endian order, except that the high-order bit is - * ignored. + * Parse a base-256 integer. This is just a variable-length + * twos-complement signed binary value in big-endian order, except + * that the high-order bit is ignored. The values here can be up to + * 12 bytes, so we need to be careful about overflowing 64-bit + * (8-byte) integers. + * + * This code unashamedly assumes that the local machine uses 8-bit + * bytes and twos-complement arithmetic. */ static int64_t tar_atol256(const char *_p, size_t char_cnt) { - int64_t l, upper_limit, lower_limit; + uint64_t l; const unsigned char *p = (const unsigned char *)_p; + unsigned char c, neg; + + /* Extend 7-bit 2s-comp to 8-bit 2s-comp, decide sign. */ + c = *p; + if (c & 0x40) { + neg = 0xff; + c |= 0x80; + l = ~ARCHIVE_LITERAL_ULL(0); + } else { + neg = 0; + c &= 0x7f; + l = 0; + } - upper_limit = INT64_MAX / 256; - lower_limit = INT64_MIN / 256; + /* If more than 8 bytes, check that we can ignore + * high-order bits without overflow. */ + while (char_cnt > sizeof(int64_t)) { + --char_cnt; + if (c != neg) + return neg ? INT64_MIN : INT64_MAX; + c = *++p; + } - /* Sign-extend the 7-bit value to 64 bits. */ - if ((0x40 & *p) == 0x40) - l = ~((int64_t)0x3f) | *p++; - else - l = 0x3f & *p++; + /* c is first byte that fits; if sign mismatch, return overflow */ + if ((c ^ neg) & 0x80) { + return neg ? INT64_MIN : INT64_MAX; + } + + /* Accumulate remaining bytes. */ while (--char_cnt > 0) { - if (l > upper_limit) - return (INT64_MAX); /* Truncate on overflow */ - else if (l < lower_limit) - return (INT64_MIN); - l = (l << 8) | (0xff & (int64_t)*p++); + l = (l << 8) | c; + c = *++p; } - return (l); + l = (l << 8) | c; + /* Return signed twos-complement value. */ + return (int64_t)(l); } /* |