diff --git a/Modules/FindMFC.cmake b/Modules/FindMFC.cmake index 261ebdb..3547628 100644 --- a/Modules/FindMFC.cmake +++ b/Modules/FindMFC.cmake @@ -36,7 +36,7 @@ if(WIN32 AND NOT UNIX AND NOT BORLAND AND NOT MINGW) endif() if(MFC_ATTEMPT_TRY_COMPILE) - if("MFC_HAVE_MFC" MATCHES "^MFC_HAVE_MFC$") + if(NOT DEFINED MFC_HAVE_MFC) set(CHECK_INCLUDE_FILE_VAR "afxwin.h") configure_file(${CMAKE_ROOT}/Modules/CheckIncludeFile.cxx.in ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFile.cxx) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 8e7ccd1..27bebc8 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 2) -set(CMake_VERSION_PATCH 1) +set(CMake_VERSION_PATCH 2) #set(CMake_VERSION_RC 0) diff --git a/Source/cmFileLockUnix.cxx b/Source/cmFileLockUnix.cxx index fc18a64..36a2d72 100644 --- a/Source/cmFileLockUnix.cxx +++ b/Source/cmFileLockUnix.cxx @@ -15,6 +15,7 @@ #include // errno #include // SEEK_SET #include +#include #include "cmSystemTools.h" cmFileLock::cmFileLock(): File(-1) @@ -31,6 +32,9 @@ cmFileLockResult cmFileLock::Release() this->Filename = ""; + ::close(this->File); + this->File = -1; + if (lockResult == 0) { return cmFileLockResult::MakeOk(); diff --git a/Source/cmFileLockWin32.cxx b/Source/cmFileLockWin32.cxx index 4691689..dc65948 100644 --- a/Source/cmFileLockWin32.cxx +++ b/Source/cmFileLockWin32.cxx @@ -38,6 +38,9 @@ cmFileLockResult cmFileLock::Release() this->Filename = ""; + CloseHandle(this->File); + this->File = INVALID_HANDLE_VALUE; + if (unlockResult) { return cmFileLockResult::MakeOk(); diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 4ece016..ea11c79 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -767,7 +767,7 @@ cmMakefileTargetGenerator // Write the rule. this->WriteMakeRule(*this->BuildFileStream, 0, outputs, - depends, commands, false); + depends, commands); bool do_preprocess_rules = lang_has_preprocessor && this->LocalGenerator->GetCreatePreprocessedSourceRules(); @@ -989,18 +989,30 @@ void cmMakefileTargetGenerator::WriteTargetCleanRules() } //---------------------------------------------------------------------------- -void cmMakefileTargetGenerator::WriteMakeRule( +bool cmMakefileTargetGenerator::WriteMakeRule( std::ostream& os, const char* comment, const std::vector& outputs, const std::vector& depends, const std::vector& commands, - bool symbolic, bool in_help) { + bool symbolic = false; if (outputs.size() == 0) { - return; + return symbolic; + } + + // Check whether we need to bother checking for a symbolic output. + bool need_symbolic = this->GlobalGenerator->GetNeedSymbolicMark(); + + // Check whether the first output is marked as symbolic. + if(need_symbolic) + { + if(cmSourceFile* sf = this->Makefile->GetSource(outputs[0])) + { + symbolic = sf->GetPropertyAsBool("SYMBOLIC"); + } } // We always attach the actual commands to the first output. @@ -1010,7 +1022,7 @@ void cmMakefileTargetGenerator::WriteMakeRule( // For single outputs, we are done. if (outputs.size() == 1) { - return; + return symbolic; } // For multiple outputs, make the extra ones depend on the first one. @@ -1023,14 +1035,25 @@ void cmMakefileTargetGenerator::WriteMakeRule( std::string const out = this->Convert(*o, cmLocalGenerator::HOME_OUTPUT, cmLocalGenerator::SHELL); std::vector output_commands; - if (!symbolic) + + bool o_symbolic = false; + if(need_symbolic) + { + if(cmSourceFile* sf = this->Makefile->GetSource(*o)) + { + o_symbolic = sf->GetPropertyAsBool("SYMBOLIC"); + } + } + symbolic = symbolic && o_symbolic; + + if (!o_symbolic) { output_commands.push_back("@$(CMAKE_COMMAND) -E touch_nocreate " + out); } this->LocalGenerator->WriteMakeRule(os, 0, *o, output_depends, - output_commands, symbolic, in_help); + output_commands, o_symbolic, in_help); - if (!symbolic) + if (!o_symbolic) { // At build time, remove the first output if this one does not exist // so that "make" will rerun the real commands that create this one. @@ -1038,6 +1061,7 @@ void cmMakefileTargetGenerator::WriteMakeRule( this->MultipleOutputPairs.insert(p); } } + return symbolic; } //---------------------------------------------------------------------------- @@ -1289,30 +1313,16 @@ void cmMakefileTargetGenerator std::vector depends; this->LocalGenerator->AppendCustomDepend(depends, ccg); - // Check whether we need to bother checking for a symbolic output. - bool need_symbolic = this->GlobalGenerator->GetNeedSymbolicMark(); - // Write the rule. const std::vector& outputs = ccg.GetOutputs(); - std::vector::const_iterator o = outputs.begin(); - { - bool symbolic = false; - if(need_symbolic) - { - if(cmSourceFile* sf = this->Makefile->GetSource(*o)) - { - symbolic = sf->GetPropertyAsBool("SYMBOLIC"); - } - } - this->WriteMakeRule(*this->BuildFileStream, 0, outputs, - depends, commands, symbolic); + bool symbolic = this->WriteMakeRule(*this->BuildFileStream, 0, + outputs, depends, commands); // If the rule has changed make sure the output is rebuilt. if(!symbolic) { this->GlobalGenerator->AddRuleHash(ccg.GetOutputs(), content.str()); } - } // Setup implicit dependency scanning. for(cmCustomCommand::ImplicitDependsList::const_iterator diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index f62c51d..42c4f58 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -224,12 +224,11 @@ protected: typedef std::map MultipleOutputPairsType; MultipleOutputPairsType MultipleOutputPairs; - void WriteMakeRule(std::ostream& os, + bool WriteMakeRule(std::ostream& os, const char* comment, const std::vector& outputs, const std::vector& depends, const std::vector& commands, - bool symbolic, bool in_help = false); // Target name info. diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx index b03e7b0..b9b65a0 100644 --- a/Source/kwsys/SystemTools.cxx +++ b/Source/kwsys/SystemTools.cxx @@ -1215,15 +1215,22 @@ bool SystemTools::PathCygwinToWin32(const char *path, char *win32_path) bool SystemTools::Touch(const kwsys_stl::string& filename, bool create) { - if(create && !SystemTools::FileExists(filename)) + if (!SystemTools::FileExists(filename)) { - FILE* file = Fopen(filename, "a+b"); - if(file) + if(create) + { + FILE* file = Fopen(filename, "a+b"); + if(file) + { + fclose(file); + return true; + } + return false; + } + else { - fclose(file); return true; } - return false; } #if defined(_WIN32) && !defined(__CYGWIN__) HANDLE h = CreateFileW( diff --git a/Tests/BuildDepends/CMakeLists.txt b/Tests/BuildDepends/CMakeLists.txt index 78e9e17..2be59b6 100644 --- a/Tests/BuildDepends/CMakeLists.txt +++ b/Tests/BuildDepends/CMakeLists.txt @@ -42,6 +42,11 @@ list(APPEND _cmake_options "-DTEST_LINK_DEPENDS=${TEST_LINK_DEPENDS}") list(APPEND _cmake_options "-DCMAKE_FORCE_DEPFILES=1") +if(NOT CMAKE_GENERATOR MATCHES "Visual Studio ([^6789]|[6789][0-9])") + set(TEST_MULTI3 1) + list(APPEND _cmake_options "-DTEST_MULTI3=1") +endif() + file(MAKE_DIRECTORY ${BuildDepends_BINARY_DIR}/Project) message("Creating Project/foo.cxx") write_file(${BuildDepends_BINARY_DIR}/Project/foo.cxx @@ -66,6 +71,8 @@ set(link_depends_no_shared_check_txt ${BuildDepends_BINARY_DIR}/Project/link_dep file(WRITE ${BuildDepends_BINARY_DIR}/Project/external.in "external original\n") file(WRITE ${BuildDepends_BINARY_DIR}/Project/multi1-in.txt "multi1-in original\n") +file(WRITE ${BuildDepends_BINARY_DIR}/Project/multi2-stamp.txt "multi2-stamp original\n") +file(WRITE ${BuildDepends_BINARY_DIR}/Project/multi3-stamp.txt "multi3-stamp original\n") help_xcode_depends() @@ -191,6 +198,34 @@ else() "multi1-out2-copy.txt is missing") endif() +if(EXISTS ${BuildDepends_BINARY_DIR}/Project/multi2-real.txt) + if(${BuildDepends_BINARY_DIR}/Project/multi2-real.txt + IS_NEWER_THAN ${BuildDepends_BINARY_DIR}/Project/multi2-stamp.txt) + message(STATUS "multi2-real.txt is newer than multi2-stamp.txt") + else() + message(SEND_ERROR "Project did not initially build properly: " + "multi2-real.txt is not newer than multi2-stamp.txt") + endif() +else() + message(SEND_ERROR "Project did not initially build properly: " + "multi2-real.txt is missing") +endif() + +if(TEST_MULTI3) + if(EXISTS ${BuildDepends_BINARY_DIR}/Project/multi3-real.txt) + if(${BuildDepends_BINARY_DIR}/Project/multi3-real.txt + IS_NEWER_THAN ${BuildDepends_BINARY_DIR}/Project/multi3-stamp.txt) + message(STATUS "multi3-real.txt is newer than multi3-stamp.txt") + else() + message(SEND_ERROR "Project did not initially build properly: " + "multi3-real.txt is not newer than multi3-stamp.txt") + endif() + else() + message(SEND_ERROR "Project did not initially build properly: " + "multi3-real.txt is missing") + endif() +endif() + message("Waiting 3 seconds...") execute_process(COMMAND ${CMAKE_COMMAND} -E sleep 3) @@ -217,6 +252,8 @@ endif() file(WRITE ${BuildDepends_BINARY_DIR}/Project/external.in "external changed\n") file(WRITE ${BuildDepends_BINARY_DIR}/Project/multi1-in.txt "multi1-in changed\n") +file(WRITE ${BuildDepends_BINARY_DIR}/Project/multi2-stamp.txt "multi2-stamp changed\n") +file(WRITE ${BuildDepends_BINARY_DIR}/Project/multi3-stamp.txt "multi3-stamp changed\n") help_xcode_depends() @@ -347,3 +384,31 @@ else() message(SEND_ERROR "Project did not rebuild properly: " "multi1-out2-copy.txt is missing") endif() + +if(EXISTS ${BuildDepends_BINARY_DIR}/Project/multi2-real.txt) + if(${BuildDepends_BINARY_DIR}/Project/multi2-real.txt + IS_NEWER_THAN ${BuildDepends_BINARY_DIR}/Project/multi2-stamp.txt) + message(STATUS "multi2-real.txt is newer than multi2-stamp.txt") + else() + message(SEND_ERROR "Project did not rebuild properly: " + "multi2-real.txt is not newer than multi2-stamp.txt") + endif() +else() + message(SEND_ERROR "Project did not rebuild properly: " + "multi2-real.txt is missing") +endif() + +if(TEST_MULTI3) + if(EXISTS ${BuildDepends_BINARY_DIR}/Project/multi3-real.txt) + if(${BuildDepends_BINARY_DIR}/Project/multi3-real.txt + IS_NEWER_THAN ${BuildDepends_BINARY_DIR}/Project/multi3-stamp.txt) + message(STATUS "multi3-real.txt is newer than multi3-stamp.txt") + else() + message(SEND_ERROR "Project did not rebuild properly: " + "multi3-real.txt is not newer than multi3-stamp.txt") + endif() + else() + message(SEND_ERROR "Project did not rebuild properly: " + "multi3-real.txt is missing") + endif() +endif() diff --git a/Tests/BuildDepends/Project/CMakeLists.txt b/Tests/BuildDepends/Project/CMakeLists.txt index cb9fbf8..0db39c5 100644 --- a/Tests/BuildDepends/Project/CMakeLists.txt +++ b/Tests/BuildDepends/Project/CMakeLists.txt @@ -164,3 +164,21 @@ add_custom_command( DEPENDS multi1-out2.txt ) add_custom_target(multi1 ALL DEPENDS multi1-out2-copy.txt) + +# Test having the first output never created. +add_custom_command( + OUTPUT multi2-dummy.txt multi2-real.txt + COMMAND ${CMAKE_COMMAND} -E touch multi2-real.txt + ) +set_property(SOURCE multi2-real.txt multi2-dummy.txt PROPERTY SYMBOLIC 1) +add_custom_target(multi2 ALL DEPENDS multi2-real.txt) + +if(TEST_MULTI3) + # Test having the second output never created. Does not work with msbuild. + add_custom_command( + OUTPUT multi3-real.txt multi3-dummy.txt + COMMAND ${CMAKE_COMMAND} -E touch multi3-real.txt + ) + set_property(SOURCE multi3-real.txt multi3-dummy.txt PROPERTY SYMBOLIC 1) + add_custom_target(multi3 ALL DEPENDS multi3-real.txt) +endif() diff --git a/Utilities/cmcurl/CMakeLists.txt b/Utilities/cmcurl/CMakeLists.txt index 08bdff5..32e4561 100644 --- a/Utilities/cmcurl/CMakeLists.txt +++ b/Utilities/cmcurl/CMakeLists.txt @@ -524,12 +524,18 @@ check_include_file("features.h" HAVE_FEATURES_H) if(NOT UNIX) check_include_file_concat("ws2tcpip.h" HAVE_WS2TCPIP_H) check_include_file_concat("winsock2.h" HAVE_WINSOCK2_H) -endif(NOT UNIX) +else() + set(HAVE_WS2TCPIP_H 0) + set(HAVE_WINSOCK2_H 0) +endif() check_include_file_concat("stdio.h" HAVE_STDIO_H) if(NOT UNIX) check_include_file_concat("windows.h" HAVE_WINDOWS_H) check_include_file_concat("winsock.h" HAVE_WINSOCK_H) -endif(NOT UNIX) +else() + set(HAVE_WINDOWS_H 0) + set(HAVE_WINSOCK_H 0) +endif() check_include_file_concat("inttypes.h" HAVE_INTTYPES_H) check_include_file_concat("sys/filio.h" HAVE_SYS_FILIO_H) diff --git a/Utilities/cmlibarchive/libarchive/archive_util.c b/Utilities/cmlibarchive/libarchive/archive_util.c index 96b88d8..d136498 100644 --- a/Utilities/cmlibarchive/libarchive/archive_util.c +++ b/Utilities/cmlibarchive/libarchive/archive_util.c @@ -249,6 +249,8 @@ __archive_errx(int retvalue, const char *msg) int __archive_mktemp(const char *tmpdir) { + static const wchar_t *prefix = L"libarchive_"; + static const wchar_t *suffix = L"XXXXXXXXXX"; static const wchar_t num[] = { L'0', L'1', L'2', L'3', L'4', L'5', L'6', L'7', L'8', L'9', L'A', L'B', L'C', L'D', L'E', L'F', @@ -323,10 +325,10 @@ __archive_mktemp(const char *tmpdir) /* * Create a temporary file. */ - archive_wstrcat(&temp_name, L"libarchive_"); - xp = temp_name.s + archive_strlen(&temp_name); - archive_wstrcat(&temp_name, L"XXXXXXXXXX"); + archive_wstrcat(&temp_name, prefix); + archive_wstrcat(&temp_name, suffix); ep = temp_name.s + archive_strlen(&temp_name); + xp = ep - wcslen(suffix); if (!CryptAcquireContext(&hProv, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)) { diff --git a/Utilities/cmliblzma/CMakeLists.txt b/Utilities/cmliblzma/CMakeLists.txt index d991438..8920536 100644 --- a/Utilities/cmliblzma/CMakeLists.txt +++ b/Utilities/cmliblzma/CMakeLists.txt @@ -211,4 +211,14 @@ ENDIF() ADD_LIBRARY(cmliblzma ${LZMA_SRCS}) +IF(CMAKE_C_COMPILER_ID STREQUAL "XL") + # Disable the XL compiler optimizer because it causes crashes + # and other bad behavior in liblzma code. + SET_PROPERTY(TARGET cmliblzma PROPERTY COMPILE_FLAGS "-qnooptimize") +ELSEIF(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND + CMAKE_C_COMPILER_VERSION VERSION_LESS 3.4) + # Disable the old GNU compiler optimizer. + SET_PROPERTY(TARGET cmliblzma PROPERTY COMPILE_FLAGS "-O0") +ENDIF() + INSTALL(FILES COPYING DESTINATION ${CMAKE_DOC_DIR}/cmliblzma) diff --git a/Utilities/cmliblzma/config.h.in b/Utilities/cmliblzma/config.h.in index 017c435..9c53150 100644 --- a/Utilities/cmliblzma/config.h.in +++ b/Utilities/cmliblzma/config.h.in @@ -280,4 +280,10 @@ typedef uint64_t uintmax_t; /* Define to 1 if the system supports fast unaligned access to 16-bit and 32-bit integers. */ -#define TUKLIB_FAST_UNALIGNED_ACCESS 1 +#if defined(__i386) || defined(__i386__) || defined(_M_IX86) \ + || defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) \ + || defined(__amd64) || defined(__amd64__) \ + || defined(__powerpc) || defined(__powerpc__) \ + || defined(__ppc) || defined(__ppc__) || defined(__POWERPC__) +# define TUKLIB_FAST_UNALIGNED_ACCESS 1 +#endif