diff options
-rw-r--r-- | Modules/CheckCCompilerFlag.cmake | 8 | ||||
-rw-r--r-- | Modules/CheckCXXCompilerFlag.cmake | 8 | ||||
-rw-r--r-- | Modules/CheckFortranCompilerFlag.cmake | 8 | ||||
-rw-r--r-- | Modules/Compiler/AppleClang-CXX.cmake | 5 | ||||
-rw-r--r-- | Modules/FindXercesC.cmake | 2 | ||||
-rw-r--r-- | Source/CMakeVersion.cmake | 2 | ||||
-rw-r--r-- | Source/CPack/IFW/cmCPackIFWGenerator.cxx | 6 | ||||
-rw-r--r-- | Source/cmExtraEclipseCDT4Generator.cxx | 3 | ||||
-rw-r--r-- | Source/cmTarget.cxx | 18 | ||||
-rw-r--r-- | Source/kwsys/ProcessWin32.c | 151 | ||||
-rw-r--r-- | Tests/CMakeOnly/CheckCXXCompilerFlag/CMakeLists.txt | 7 | ||||
-rw-r--r-- | Tests/RunCMake/CMakeLists.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/set_property/CMakeLists.txt | 3 | ||||
-rw-r--r-- | Tests/RunCMake/set_property/LINK_LIBRARIES.cmake | 7 | ||||
-rw-r--r-- | Tests/RunCMake/set_property/RunCMakeTest.cmake | 3 |
15 files changed, 115 insertions, 117 deletions
diff --git a/Modules/CheckCCompilerFlag.cmake b/Modules/CheckCCompilerFlag.cmake index 750e4fb..53f3454 100644 --- a/Modules/CheckCCompilerFlag.cmake +++ b/Modules/CheckCCompilerFlag.cmake @@ -13,7 +13,7 @@ # Will be created as an internal cache variable. # # This internally calls the check_c_source_compiles macro and sets -# CMAKE_REQUIRED_FLAGS to <flag>. See help for +# CMAKE_REQUIRED_DEFINITIONS to <flag>. See help for # CheckCSourceCompiles for a listing of variables that can otherwise # modify the build. The result only tells that the compiler does not # give an error message when it encounters the flag. If the flag has @@ -38,8 +38,8 @@ include(CheckCSourceCompiles) include(CMakeCheckCompilerFlagCommonPatterns) macro (CHECK_C_COMPILER_FLAG _FLAG _RESULT) - set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") - set(CMAKE_REQUIRED_FLAGS "${_FLAG}") + set(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}") + set(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}") # Normalize locale during test compilation. set(_CheckCCompilerFlag_LOCALE_VARS LC_ALL LC_MESSAGES LANG) @@ -60,5 +60,5 @@ macro (CHECK_C_COMPILER_FLAG _FLAG _RESULT) unset(_CheckCCompilerFlag_LOCALE_VARS) unset(_CheckCCompilerFlag_COMMON_PATTERNS) - set (CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}") + set (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}") endmacro () diff --git a/Modules/CheckCXXCompilerFlag.cmake b/Modules/CheckCXXCompilerFlag.cmake index 71b3fd2..fab3a05 100644 --- a/Modules/CheckCXXCompilerFlag.cmake +++ b/Modules/CheckCXXCompilerFlag.cmake @@ -12,7 +12,7 @@ # <var> - variable to store the result # # This internally calls the check_cxx_source_compiles macro and sets -# CMAKE_REQUIRED_FLAGS to <flag>. See help for +# CMAKE_REQUIRED_DEFINITIONS to <flag>. See help for # CheckCXXSourceCompiles for a listing of variables that can otherwise # modify the build. The result only tells that the compiler does not # give an error message when it encounters the flag. If the flag has @@ -37,8 +37,8 @@ include(CheckCXXSourceCompiles) include(CMakeCheckCompilerFlagCommonPatterns) macro (CHECK_CXX_COMPILER_FLAG _FLAG _RESULT) - set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") - set(CMAKE_REQUIRED_FLAGS "${_FLAG}") + set(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}") + set(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}") # Normalize locale during test compilation. set(_CheckCXXCompilerFlag_LOCALE_VARS LC_ALL LC_MESSAGES LANG) @@ -59,6 +59,6 @@ macro (CHECK_CXX_COMPILER_FLAG _FLAG _RESULT) unset(_CheckCXXCompilerFlag_LOCALE_VARS) unset(_CheckCXXCompilerFlag_COMMON_PATTERNS) - set (CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}") + set (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}") endmacro () diff --git a/Modules/CheckFortranCompilerFlag.cmake b/Modules/CheckFortranCompilerFlag.cmake index c476661..53fd8d6 100644 --- a/Modules/CheckFortranCompilerFlag.cmake +++ b/Modules/CheckFortranCompilerFlag.cmake @@ -13,7 +13,7 @@ # Will be created as an internal cache variable. # # This internally calls the check_fortran_source_compiles macro and -# sets CMAKE_REQUIRED_FLAGS to <flag>. See help for +# sets CMAKE_REQUIRED_DEFINITIONS to <flag>. See help for # CheckFortranSourceCompiles for a listing of variables that can # otherwise modify the build. The result only tells that the compiler # does not give an error message when it encounters the flag. If the @@ -40,8 +40,8 @@ include(CheckFortranSourceCompiles) include(CMakeCheckCompilerFlagCommonPatterns) macro (CHECK_Fortran_COMPILER_FLAG _FLAG _RESULT) - set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") - set(CMAKE_REQUIRED_FLAGS "${_FLAG}") + set(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}") + set(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}") # Normalize locale during test compilation. set(_CheckFortranCompilerFlag_LOCALE_VARS LC_ALL LC_MESSAGES LANG) @@ -62,5 +62,5 @@ macro (CHECK_Fortran_COMPILER_FLAG _FLAG _RESULT) unset(_CheckFortranCompilerFlag_LOCALE_VARS) unset(_CheckFortranCompilerFlag_COMMON_PATTERNS) - set (CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}") + set (CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}") endmacro () diff --git a/Modules/Compiler/AppleClang-CXX.cmake b/Modules/Compiler/AppleClang-CXX.cmake index 5194da4..1ba8a77 100644 --- a/Modules/Compiler/AppleClang-CXX.cmake +++ b/Modules/Compiler/AppleClang-CXX.cmake @@ -13,7 +13,10 @@ if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.0) set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++11") endif() -if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.1) +if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.1) + 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 5.1) # AppleClang 5.0 knows this flag, but does not set a __cplusplus macro greater than 201103L set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++1y") set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++1y") diff --git a/Modules/FindXercesC.cmake b/Modules/FindXercesC.cmake index 5a8ea9d..984f1b9 100644 --- a/Modules/FindXercesC.cmake +++ b/Modules/FindXercesC.cmake @@ -62,7 +62,7 @@ find_path(XercesC_INCLUDE_DIR mark_as_advanced(XercesC_INCLUDE_DIR) # Find all XercesC libraries -find_library(XercesC_LIBRARY "xerces-c" +find_library(XercesC_LIBRARY NAMES "xerces-c" "xerces-c_3" DOC "Xerces-C++ libraries") mark_as_advanced(XercesC_LIBRARY) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index eadcb9e..c79f13a 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 3) -set(CMake_VERSION_PATCH 20150709) +set(CMake_VERSION_PATCH 20150710) #set(CMake_VERSION_RC 1) diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.cxx b/Source/CPack/IFW/cmCPackIFWGenerator.cxx index 80ba068..09e123c 100644 --- a/Source/CPack/IFW/cmCPackIFWGenerator.cxx +++ b/Source/CPack/IFW/cmCPackIFWGenerator.cxx @@ -254,9 +254,11 @@ int cmCPackIFWGenerator::InitializeInternal() const std::string BinCreatorOpt = "CPACK_IFW_BINARYCREATOR_EXECUTABLE"; const std::string RepoGenOpt = "CPACK_IFW_REPOGEN_EXECUTABLE"; + const std::string FrameworkVersionOpt = "CPACK_IFW_FRAMEWORK_VERSION"; if(!this->IsSet(BinCreatorOpt) || - !this->IsSet(RepoGenOpt)) + !this->IsSet(RepoGenOpt) || + !this->IsSet(FrameworkVersionOpt)) { this->ReadListFile("CPackIFW.cmake"); } @@ -296,7 +298,7 @@ int cmCPackIFWGenerator::InitializeInternal() // Framework version if(const char* FrameworkVersionSrt = - this->GetOption("CPACK_IFW_FRAMEWORK_VERSION")) + this->GetOption(FrameworkVersionOpt)) { FrameworkVersion = FrameworkVersionSrt; } diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index a81e53c..44bf586 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -598,7 +598,8 @@ void cmExtraEclipseCDT4Generator::CreateLinksForTargets( linkName4 += "/"; linkName4 += cmSystemTools::GetFilenameName(fullPath); this->AppendLinkedResource(fout, linkName4, - fullPath, LinkToFile); + this->GetEclipsePath(fullPath), + LinkToFile); } } } diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index d309927..3353fbd 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -1739,9 +1739,12 @@ void cmTarget::SetProperty(const std::string& prop, const char* value) else if (prop == "LINK_LIBRARIES") { this->Internal->LinkImplementationPropertyEntries.clear(); - cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); - cmValueWithOrigin entry(value, lfbt); - this->Internal->LinkImplementationPropertyEntries.push_back(entry); + if (value) + { + cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); + cmValueWithOrigin entry(value, lfbt); + this->Internal->LinkImplementationPropertyEntries.push_back(entry); + } } else if (prop == "SOURCES") { @@ -1825,9 +1828,12 @@ void cmTarget::AppendProperty(const std::string& prop, const char* value, } else if (prop == "LINK_LIBRARIES") { - cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); - cmValueWithOrigin entry(value, lfbt); - this->Internal->LinkImplementationPropertyEntries.push_back(entry); + if (value) + { + cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); + cmValueWithOrigin entry(value, lfbt); + this->Internal->LinkImplementationPropertyEntries.push_back(entry); + } } else if (prop == "SOURCES") { diff --git a/Source/kwsys/ProcessWin32.c b/Source/kwsys/ProcessWin32.c index f630171..a7dd2ca 100644 --- a/Source/kwsys/ProcessWin32.c +++ b/Source/kwsys/ProcessWin32.c @@ -11,14 +11,12 @@ ============================================================================*/ #include "kwsysPrivate.h" #include KWSYS_HEADER(Process.h) -#include KWSYS_HEADER(System.h) #include KWSYS_HEADER(Encoding.h) /* Work-around CMake dependency scanning limitation. This must duplicate the above list of headers. */ #if 0 # include "Process.h.in" -# include "System.h.in" # include "Encoding_c.h.in" #endif @@ -120,11 +118,6 @@ static void kwsysProcessSetupPipeNative(HANDLE native, PHANDLE handle); static void kwsysProcessCleanupHandle(PHANDLE h); static void kwsysProcessCleanup(kwsysProcess* cp, int error); static void kwsysProcessCleanErrorMessage(kwsysProcess* cp); -static int kwsysProcessComputeCommandLength(kwsysProcess* cp, - char const* const* command); -static void kwsysProcessComputeCommandLine(kwsysProcess* cp, - char const* const* command, - char* cmd); static int kwsysProcessGetTimeoutTime(kwsysProcess* cp, double* userTimeout, kwsysProcessTime* timeoutTime); static int kwsysProcessGetTimeoutLeft(kwsysProcessTime* timeoutTime, @@ -602,37 +595,69 @@ int kwsysProcess_AddCommand(kwsysProcess* cp, char const* const* command) } } - /* We need to construct a single string representing the command - and its arguments. We will surround each argument containing - spaces with double-quotes. Inside a double-quoted argument, we - need to escape double-quotes and all backslashes before them. - We also need to escape backslashes at the end of an argument - because they come before the closing double-quote for the - argument. */ - { - /* First determine the length of the final string. */ - int length = kwsysProcessComputeCommandLength(cp, command); - - /* Allocate enough space for the command. We do not need an extra - byte for the terminating null because we allocated a space for - the first argument that we will not use. */ - char* new_cmd = malloc(length); - if(!new_cmd) + if (cp->Verbatim) { - /* Out of memory. */ + /* Copy the verbatim command line into the buffer. */ + newCommands[cp->NumberOfCommands] = kwsysEncoding_DupToWide(*command); + } + else + { + /* Encode the arguments so CommandLineToArgvW can decode + them from the command line string in the child. */ + char buffer[32768]; /* CreateProcess max command-line length. */ + char* end = buffer + sizeof(buffer); + char* out = buffer; + char const* const* a; + for (a = command; *a; ++a) + { + int quote = !**a; /* Quote the empty string. */ + int slashes = 0; + char const* c; + if (a != command && out != end) { *out++ = ' '; } + for (c = *a; !quote && *c; ++c) + { quote = (*c == ' ' || *c == '\t'); } + if (quote && out != end) { *out++ = '"'; } + for (c = *a; *c; ++c) + { + if (*c == '\\') + { + ++slashes; + } + else + { + if (*c == '"') + { + // Add n+1 backslashes to total 2n+1 before internal '"'. + while(slashes-- >= 0 && out != end) { *out++ = '\\'; } + } + slashes = 0; + } + if (out != end) { *out++ = *c; } + } + if (quote) + { + // Add n backslashes to total 2n before ending '"'. + while (slashes-- > 0 && out != end) { *out++ = '\\'; } + if (out != end) { *out++ = '"'; } + } + } + if(out != end) + { + *out = '\0'; + newCommands[cp->NumberOfCommands] = kwsysEncoding_DupToWide(buffer); + } + else + { + newCommands[cp->NumberOfCommands] = 0; + } + } + if (!newCommands[cp->NumberOfCommands]) + { + /* Out of memory or command line too long. */ free(newCommands); return 0; } - /* Construct the command line in the allocated buffer. */ - kwsysProcessComputeCommandLine(cp, command, - new_cmd); - - newCommands[cp->NumberOfCommands] = kwsysEncoding_DupToWide(new_cmd); - free(new_cmd); - } - - /* Save the new array of commands. */ free(cp->Commands); cp->Commands = newCommands; @@ -1962,66 +1987,6 @@ void kwsysProcessCleanErrorMessage(kwsysProcess* cp) } /*--------------------------------------------------------------------------*/ -int kwsysProcessComputeCommandLength(kwsysProcess* cp, - char const* const* command) -{ - int length = 0; - if(cp->Verbatim) - { - /* Treat the first argument as a verbatim command line. Use its - length directly and add space for the null-terminator. */ - length = (int)strlen(*command)+1; - } - else - { - /* Compute the length of the command line when it is converted to - a single string. Space for the null-terminator is allocated by - the whitespace character allocated for the first argument that - will not be used. */ - char const* const* arg; - for(arg = command; *arg; ++arg) - { - /* Add the length of this argument. It already includes room - for a separating space or terminating null. */ - length += kwsysSystem_Shell_GetArgumentSizeForWindows(*arg, 0); - } - } - - return length; -} - -/*--------------------------------------------------------------------------*/ -void kwsysProcessComputeCommandLine(kwsysProcess* cp, - char const* const* command, - char* cmd) -{ - if(cp->Verbatim) - { - /* Copy the verbatim command line into the buffer. */ - strcpy(cmd, *command); - } - else - { - /* Construct the command line in the allocated buffer. */ - char const* const* arg; - for(arg = command; *arg; ++arg) - { - /* Add the separating space if this is not the first argument. */ - if(arg != command) - { - *cmd++ = ' '; - } - - /* Add the current argument. */ - cmd = kwsysSystem_Shell_GetArgumentForWindows(*arg, cmd, 0); - } - - /* Add the terminating null character to the command line. */ - *cmd = 0; - } -} - -/*--------------------------------------------------------------------------*/ /* Get the time at which either the process or user timeout will expire. Returns 1 if the user timeout is first, and 0 otherwise. */ int kwsysProcessGetTimeoutTime(kwsysProcess* cp, double* userTimeout, diff --git a/Tests/CMakeOnly/CheckCXXCompilerFlag/CMakeLists.txt b/Tests/CMakeOnly/CheckCXXCompilerFlag/CMakeLists.txt index e205330..9be69f1 100644 --- a/Tests/CMakeOnly/CheckCXXCompilerFlag/CMakeLists.txt +++ b/Tests/CMakeOnly/CheckCXXCompilerFlag/CMakeLists.txt @@ -56,3 +56,10 @@ if(CMAKE_COMPILER_IS_GNUCXX) else() message("Unhandled Platform") endif() + +if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") + check_cxx_compiler_flag("-x c++" HAVE_X_CXX) + if(NOT HAVE_X_CXX) + message(FATAL_ERROR "${CMAKE_CXX_COMPILER_ID} compiler flag '-x c++' check failed") + endif() +endif() diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index c0ac5c8..b90eff6 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -185,6 +185,7 @@ add_RunCMake_test(list) add_RunCMake_test(message) add_RunCMake_test(project) add_RunCMake_test(return) +add_RunCMake_test(set_property) add_RunCMake_test(string) add_RunCMake_test(try_compile) add_RunCMake_test(try_run) diff --git a/Tests/RunCMake/set_property/CMakeLists.txt b/Tests/RunCMake/set_property/CMakeLists.txt new file mode 100644 index 0000000..18dfd26 --- /dev/null +++ b/Tests/RunCMake/set_property/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.2) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/set_property/LINK_LIBRARIES.cmake b/Tests/RunCMake/set_property/LINK_LIBRARIES.cmake new file mode 100644 index 0000000..994e874 --- /dev/null +++ b/Tests/RunCMake/set_property/LINK_LIBRARIES.cmake @@ -0,0 +1,7 @@ +add_custom_target(CustomTarget) +set_property(TARGET CustomTarget PROPERTY LINK_LIBRARIES) +set_property(TARGET CustomTarget APPEND PROPERTY LINK_LIBRARIES) +get_property(val TARGET CustomTarget PROPERTY LINK_LIBRARIES) +if (NOT "${val}" STREQUAL "") + message(FATAL_ERROR "LINK_LIBRARIES value is '${val}' but should be ''") +endif() diff --git a/Tests/RunCMake/set_property/RunCMakeTest.cmake b/Tests/RunCMake/set_property/RunCMakeTest.cmake new file mode 100644 index 0000000..54e63f7 --- /dev/null +++ b/Tests/RunCMake/set_property/RunCMakeTest.cmake @@ -0,0 +1,3 @@ +include(RunCMake) + +run_cmake(LINK_LIBRARIES) |