diff options
88 files changed, 601 insertions, 226 deletions
diff --git a/Auxiliary/vim/syntax/cmake.vim b/Auxiliary/vim/syntax/cmake.vim index 1f19cb7..aca7c41 100644 --- a/Auxiliary/vim/syntax/cmake.vim +++ b/Auxiliary/vim/syntax/cmake.vim @@ -320,7 +320,7 @@ syn keyword cmakeKWremove \ contained syn keyword cmakeKWseparate_arguments - \ MSDN UNIX_COMMAND VARIABLE WINDOWS WINDOWS_COMMAND _COMMAND + \ MSDN NATIVE_COMMAND UNIX_COMMAND VARIABLE WINDOWS WINDOWS_COMMAND _COMMAND \ contained syn keyword cmakeKWset diff --git a/Help/command/separate_arguments.rst b/Help/command/separate_arguments.rst index 1fd3cd1..47982a5 100644 --- a/Help/command/separate_arguments.rst +++ b/Help/command/separate_arguments.rst @@ -5,9 +5,9 @@ Parse space-separated arguments into a semicolon-separated list. :: - separate_arguments(<var> <UNIX|WINDOWS>_COMMAND "<args>") + separate_arguments(<var> <NATIVE|UNIX|WINDOWS>_COMMAND "<args>") -Parses a unix- or windows-style command-line string "<args>" and +Parses a UNIX- or Windows-style command-line string "<args>" and stores a semicolon-separated list of the arguments in ``<var>``. The entire command line must be given in one "<args>" argument. @@ -16,12 +16,15 @@ recognizes both single-quote and double-quote pairs. A backslash escapes the next literal character (``\"`` is ``"``); there are no special escapes (``\n`` is just ``n``). -The ``WINDOWS_COMMAND`` mode parses a windows command-line using the same +The ``WINDOWS_COMMAND`` mode parses a Windows command-line using the same syntax the runtime library uses to construct argv at startup. It separates arguments by whitespace that is not double-quoted. Backslashes are literal unless they precede double-quotes. See the MSDN article `Parsing C Command-Line Arguments`_ for details. +The ``NATIVE_COMMAND`` mode parses a Windows command-line if the host +system is Windows, and a UNIX command-line otherwise. + .. _`Parsing C Command-Line Arguments`: https://msdn.microsoft.com/library/a1y7w461.aspx :: diff --git a/Help/release/dev/separgs-native.rst b/Help/release/dev/separgs-native.rst new file mode 100644 index 0000000..943f08e --- /dev/null +++ b/Help/release/dev/separgs-native.rst @@ -0,0 +1,5 @@ +separgs-native +------------------- + +* A ``NATIVE_COMMAND`` mode was added to :command:`separate_arguments` + performing argument separation depening on the host operating system. diff --git a/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake b/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake index 1b5178d..e60ffe0 100644 --- a/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake +++ b/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake @@ -22,6 +22,7 @@ macro (CHECK_COMPILER_FLAG_COMMON_PATTERNS _VAR) FAIL_REGEX "[Ww]arning: [Oo]ption" # SunPro FAIL_REGEX "command option .* is not recognized" # XL FAIL_REGEX "command option .* contains an incorrect subargument" # XL + FAIL_REGEX "Option .* is not recognized. Option will be ignored." # XL FAIL_REGEX "not supported in this configuration. ignored" # AIX FAIL_REGEX "File with unknown suffix passed to linker" # PGI FAIL_REGEX "[Uu]nknown switch" # PGI diff --git a/Modules/CMakeParseImplicitLinkInfo.cmake b/Modules/CMakeParseImplicitLinkInfo.cmake index 3273443..ad3c00f 100644 --- a/Modules/CMakeParseImplicitLinkInfo.cmake +++ b/Modules/CMakeParseImplicitLinkInfo.cmake @@ -38,11 +38,7 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj set(line "${xline}") endif() endif() - if(UNIX) - separate_arguments(args UNIX_COMMAND "${line}") - else() - separate_arguments(args WINDOWS_COMMAND "${line}") - endif() + separate_arguments(args NATIVE_COMMAND "${line}") list(GET args 0 cmd) endif() set(is_msvc 0) diff --git a/Modules/Compiler/Clang-FindBinUtils.cmake b/Modules/Compiler/Clang-FindBinUtils.cmake new file mode 100644 index 0000000..c81e77a --- /dev/null +++ b/Modules/Compiler/Clang-FindBinUtils.cmake @@ -0,0 +1,25 @@ +if(NOT DEFINED _CMAKE_PROCESSING_LANGUAGE OR _CMAKE_PROCESSING_LANGUAGE STREQUAL "") + message(FATAL_ERROR "Internal error: _CMAKE_PROCESSING_LANGUAGE is not set") +endif() + +# Try to find tools in the same directory as Clang itself +get_filename_component(__clang_hint_1 "${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER}" REALPATH) +get_filename_component(__clang_hint_1 "${__clang_hint_1}" DIRECTORY) + +get_filename_component(__clang_hint_2 "${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER}" DIRECTORY) + +set(__clang_hints ${__clang_hint_1} ${__clang_hint_2}) + +# http://manpages.ubuntu.com/manpages/precise/en/man1/llvm-ar.1.html +find_program(CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_AR NAMES + "${_CMAKE_TOOLCHAIN_PREFIX}llvm-ar" + HINTS ${__clang_hints} + DOC "LLVM archiver" +) + +# http://manpages.ubuntu.com/manpages/precise/en/man1/llvm-ranlib.1.html +find_program(CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_RANLIB NAMES + "${_CMAKE_TOOLCHAIN_PREFIX}llvm-ranlib" + HINTS ${__clang_hints} + DOC "Generate index for LLVM archive" +) diff --git a/Modules/Compiler/Clang.cmake b/Modules/Compiler/Clang.cmake index 6b99a08..8c2f87d 100644 --- a/Modules/Compiler/Clang.cmake +++ b/Modules/Compiler/Clang.cmake @@ -28,12 +28,54 @@ else() set(CMAKE_${lang}_COMPILE_OPTIONS_EXTERNAL_TOOLCHAIN "--gcc-toolchain=") endif() - set(_CMAKE_IPO_SUPPORTED_BY_CMAKE NO) - set(_CMAKE_IPO_MAY_BE_SUPPORTED_BY_COMPILER NO) + set(_CMAKE_IPO_SUPPORTED_BY_CMAKE YES) + set(_CMAKE_IPO_MAY_BE_SUPPORTED_BY_COMPILER YES) - unset(CMAKE_${lang}_COMPILE_OPTIONS_IPO) - unset(CMAKE_${lang}_ARCHIVE_CREATE_IPO) - unset(CMAKE_${lang}_ARCHIVE_APPEND_IPO) - unset(CMAKE_${lang}_ARCHIVE_FINISH_IPO) + string(COMPARE EQUAL "${CMAKE_${lang}_COMPILER_ID}" "AppleClang" __is_apple_clang) + + # '-flto=thin' available since Clang 3.9 and Xcode 8 + # * http://clang.llvm.org/docs/ThinLTO.html#clang-llvm + # * https://trac.macports.org/wiki/XcodeVersionInfo + set(_CMAKE_LTO_THIN TRUE) + if(__is_apple_clang) + if(CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 8.0) + set(_CMAKE_LTO_THIN FALSE) + endif() + else() + if(CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 3.9) + set(_CMAKE_LTO_THIN FALSE) + endif() + endif() + + if(_CMAKE_LTO_THIN) + set(CMAKE_${lang}_COMPILE_OPTIONS_IPO "-flto=thin") + else() + set(CMAKE_${lang}_COMPILE_OPTIONS_IPO "-flto") + endif() + + if(ANDROID) + # https://github.com/android-ndk/ndk/issues/242 + set(CMAKE_${lang}_LINK_OPTIONS_IPO "-fuse-ld=gold") + endif() + + if(ANDROID OR __is_apple_clang) + set(__ar "${CMAKE_AR}") + set(__ranlib "${CMAKE_RANLIB}") + else() + set(__ar "${CMAKE_${lang}_COMPILER_AR}") + set(__ranlib "${CMAKE_${lang}_COMPILER_RANLIB}") + endif() + + set(CMAKE_${lang}_ARCHIVE_CREATE_IPO + "${__ar} cr <TARGET> <LINK_FLAGS> <OBJECTS>" + ) + + set(CMAKE_${lang}_ARCHIVE_APPEND_IPO + "${__ar} r <TARGET> <LINK_FLAGS> <OBJECTS>" + ) + + set(CMAKE_${lang}_ARCHIVE_FINISH_IPO + "${__ranlib} <TARGET>" + ) endmacro() endif() diff --git a/Modules/Compiler/SunPro-CXX.cmake b/Modules/Compiler/SunPro-CXX.cmake index f4345b8..b4183db 100644 --- a/Modules/Compiler/SunPro-CXX.cmake +++ b/Modules/Compiler/SunPro-CXX.cmake @@ -36,6 +36,7 @@ if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.13) set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "") set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11") set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=c++11") + set(CMAKE_CXX_LINK_WITH_STANDARD_COMPILE_OPTION 1) endif() if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.13) diff --git a/Modules/Compiler/XL-C.cmake b/Modules/Compiler/XL-C.cmake index f976c99..ac84da2 100644 --- a/Modules/Compiler/XL-C.cmake +++ b/Modules/Compiler/XL-C.cmake @@ -3,6 +3,50 @@ __compiler_xl(C) string(APPEND CMAKE_C_FLAGS_RELEASE_INIT " -DNDEBUG") string(APPEND CMAKE_C_FLAGS_MINSIZEREL_INIT " -DNDEBUG") -# -qthreaded = Ensures that all optimizations will be thread-safe -# -qhalt=e = Halt on error messages (rather than just severe errors) -string(APPEND CMAKE_C_FLAGS_INIT " -qthreaded -qhalt=e") +# -qthreaded = Ensures that all optimizations will be thread-safe +string(APPEND CMAKE_C_FLAGS_INIT " -qthreaded") + +# XL v13.1.1 for Linux ppc64 little-endian switched to using a clang based +# front end and accepts the -std= option while only reserving -qlanglevel= for +# compatibility. All other versions (previous versions on Linux ppc64 +# little-endian, all versions on Linux ppc64 big-endian, all versions on AIX +# and BGQ, etc) are derived from the UNIX compiler and only accept the +# -qlanglvl option. +if (CMAKE_SYSTEM MATCHES "Linux.*ppc64le" AND + CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.1) + set(CMAKE_C90_STANDARD_COMPILE_OPTION "-std=c89") + set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-std=gnu89") + set(CMAKE_C99_STANDARD_COMPILE_OPTION "-std=c99") + set(CMAKE_C99_EXTENSION_COMPILE_OPTION "-std=gnu99") + if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.2) + set(CMAKE_C11_STANDARD_COMPILE_OPTION "-std=c11") + set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-std=gnu11") + else () + set(CMAKE_C11_STANDARD_COMPILE_OPTION "-qlanglvl=extc1x") + set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-qlanglvl=extc1x") + endif () +else () + if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 10.1) + set(CMAKE_C90_STANDARD_COMPILE_OPTION "-qlanglvl=stdc89") + set(CMAKE_C90_EXTENSION_COMPILE_OPTION "-qlanglvl=extc89") + set(CMAKE_C99_STANDARD_COMPILE_OPTION "-qlanglvl=stdc99") + set(CMAKE_C99_EXTENSION_COMPILE_OPTION "-qlanglvl=extc99") + if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 12.1) + set(CMAKE_C11_STANDARD_COMPILE_OPTION "-qlanglvl=extc1x") + set(CMAKE_C11_EXTENSION_COMPILE_OPTION "-qlanglvl=extc1x") + endif () + endif () +endif() + +if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 10.1) + if (NOT CMAKE_C_COMPILER_FORCED) + if (NOT CMAKE_C_STANDARD_COMPUTED_DEFAULT) + message(FATAL_ERROR "CMAKE_C_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_C_COMPILER_ID} (${CMAKE_C_COMPILER}) version ${CMAKE_C_COMPILER_VERSION}") + else () + set(CMAKE_C_STANDARD_DEFAULT ${CMAKE_C_STANDARD_COMPUTED_DEFAULT}) + endif () + elseif (NOT CMAKE_C_STANDARD_COMPUTED_DEFAULT) + # Compiler id was forced so just guess the default standard level. + set(CMAKE_C_STANDARD_DEFAULT 90) + endif () +endif () diff --git a/Modules/Compiler/XL-CXX.cmake b/Modules/Compiler/XL-CXX.cmake index 545d657..98ccb29 100644 --- a/Modules/Compiler/XL-CXX.cmake +++ b/Modules/Compiler/XL-CXX.cmake @@ -3,9 +3,60 @@ __compiler_xl(CXX) string(APPEND CMAKE_CXX_FLAGS_RELEASE_INIT " -DNDEBUG") string(APPEND CMAKE_CXX_FLAGS_MINSIZEREL_INIT " -DNDEBUG") -# -qthreaded = Ensures that all optimizations will be thread-safe -# -qhalt=e = Halt on error messages (rather than just severe errors) -string(APPEND CMAKE_CXX_FLAGS_INIT " -qthreaded -qhalt=e") +# -qthreaded = Ensures that all optimizations will be thread-safe +string(APPEND CMAKE_CXX_FLAGS_INIT " -qthreaded") + +# XL v13.1.1 for Linux ppc64 little-endian switched to using a clang based +# front end and accepts the -std= option while only reserving -qlanglevel= for +# compatibility. All other versions (previous versions on Linux ppc64 +# little-endian, all versions on Linux ppc64 big-endian, all versions on AIX +# and BGQ, etc) are derived from the UNIX compiler and only accept the +# -qlanglvl option. +if (CMAKE_SYSTEM MATCHES "Linux.*ppc64") + if (CMAKE_SYSTEM MATCHES "Linux.*ppc64le" AND + CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.1) + set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "-std=c++98") + set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "-std=gnu++98") + if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13.1.2) + set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11") + set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++11") + set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++1y") + set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-qlanglvl=extended1y") + else () + set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-qlanglvl=extended0x") + set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-qlanglvl=extended0x") + endif () + else () + # The non-clang based Linux ppc64 compiler, both big-endian and + # little-endian lacks, the non-extension language level flags + if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 10.1) + set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "-qlanglvl=extended") + set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "-qlanglvl=extended") + set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-qlanglvl=extended0x") + set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-qlanglvl=extended0x") + endif () + endif () +else () + if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 10.1) + set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "-qlanglvl=strict98") + set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "-qlanglvl=extended") + set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-qlanglvl=extended0x") + set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-qlanglvl=extended0x") + endif () +endif () set(CMAKE_CXX_COMPILE_OBJECT "<CMAKE_CXX_COMPILER> -+ <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>") + +if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 10.1) + if (NOT CMAKE_CXX_COMPILER_FORCED) + if (NOT CMAKE_CXX_STANDARD_COMPUTED_DEFAULT) + message(FATAL_ERROR "CMAKE_CXX_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_CXX_COMPILER_ID} (${CMAKE_CXX_COMPILER}) version ${CMAKE_CXX_COMPILER_VERSION}") + else () + set(CMAKE_CXX_STANDARD_DEFAULT ${CMAKE_CXX_STANDARD_COMPUTED_DEFAULT}) + endif () + elseif (NOT CMAKE_CXX_STANDARD_COMPUTED_DEFAULT) + # Compiler id was forced so just guess the default standard level. + set(CMAKE_CXX_STANDARD_DEFAULT 98) + endif () +endif () diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 093d8c9..b2fb4b7 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -889,6 +889,33 @@ function(_Boost_MISSING_DEPENDENCIES componentvar extravar) endfunction() # +# Some boost libraries may require particular set of compler features. +# The very first one was `boost::fiber` introduced in Boost 1.62. +# One can check required compiler features of it in +# `${Boost_ROOT}/libs/fiber/build/Jamfile.v2`. +# +function(_Boost_COMPILER_FEATURES component _ret) + # Boost >= 1.62 and < 1.65 + if(NOT Boost_VERSION VERSION_LESS 106200 AND Boost_VERSION VERSION_LESS 106500) + set(_Boost_FIBER_COMPILER_FEATURES + cxx_alias_templates + cxx_auto_type + cxx_constexpr + cxx_defaulted_functions + cxx_final + cxx_lambdas + cxx_noexcept + cxx_nullptr + cxx_rvalue_references + cxx_thread_local + cxx_variadic_templates + ) + endif() + string(TOUPPER ${component} uppercomponent) + set(${_ret} ${_Boost_${uppercomponent}_COMPILER_FEATURES} PARENT_SCOPE) +endfunction() + +# # Update library search directory hint variable with paths used by prebuilt boost binaries. # # Prebuilt windows binaries (https://sourceforge.net/projects/boost/files/boost-binaries/) @@ -1640,6 +1667,9 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS}) _Boost_ADJUST_LIB_VARS(${UPPERCOMPONENT}) + # Check if component requires some compiler features + _Boost_COMPILER_FEATURES(${COMPONENT} _Boost_${UPPERCOMPONENT}_COMPILER_FEATURES) + endforeach() # Restore the original find library ordering @@ -1811,6 +1841,10 @@ if(Boost_FOUND) set_target_properties(Boost::${COMPONENT} PROPERTIES INTERFACE_LINK_LIBRARIES "${_Boost_${UPPERCOMPONENT}_TARGET_DEPENDENCIES}") endif() + if(_Boost_${UPPERCOMPONENT}_COMPILER_FEATURES) + set_target_properties(Boost::${COMPONENT} PROPERTIES + INTERFACE_COMPILE_FEATURES "${_Boost_${UPPERCOMPONENT}_COMPILER_FEATURES}") + endif() endif() endif() endforeach() diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake index 1e2ea69..5962c5b 100644 --- a/Modules/FindHDF5.cmake +++ b/Modules/FindHDF5.cmake @@ -354,11 +354,7 @@ macro( _HDF5_parse_compile_line libraries libraries_hl) - if(UNIX) - separate_arguments(_HDF5_COMPILE_ARGS UNIX_COMMAND "${${compile_line_var}}") - else() - separate_arguments(_HDF5_COMPILE_ARGS WINDOWS_COMMAND "${${compile_line_var}}") - endif() + separate_arguments(_HDF5_COMPILE_ARGS NATIVE_COMMAND "${${compile_line_var}}") foreach(arg IN LISTS _HDF5_COMPILE_ARGS) if("${arg}" MATCHES "^-I(.*)$") diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake index fab53cb..37f3255 100644 --- a/Modules/FindMPI.cmake +++ b/Modules/FindMPI.cmake @@ -645,8 +645,7 @@ foreach (lang C CXX Fortran) add_library(MPI::MPI_${lang} INTERFACE IMPORTED) endif() if(MPI_${lang}_COMPILE_FLAGS) - set(_MPI_${lang}_COMPILE_OPTIONS "${MPI_${lang}_COMPILE_FLAGS}") - separate_arguments(_MPI_${lang}_COMPILE_OPTIONS) + separate_arguments(_MPI_${lang}_COMPILE_OPTIONS NATIVE_COMMAND "${MPI_${lang}_COMPILE_FLAGS}") set_property(TARGET MPI::MPI_${lang} PROPERTY INTERFACE_COMPILE_OPTIONS "${_MPI_${lang}_COMPILE_OPTIONS}") endif() diff --git a/Modules/FindMatlab.cmake b/Modules/FindMatlab.cmake index eae1585..80bcda3 100644 --- a/Modules/FindMatlab.cmake +++ b/Modules/FindMatlab.cmake @@ -225,6 +225,7 @@ if(NOT MATLAB_ADDITIONAL_VERSIONS) endif() set(MATLAB_VERSIONS_MAPPING + "R2017a=9.2" "R2016b=9.1" "R2016a=9.0" "R2015b=8.6" diff --git a/Modules/FindOpenMP.cmake b/Modules/FindOpenMP.cmake index 8c1b018..e7d9d5f 100644 --- a/Modules/FindOpenMP.cmake +++ b/Modules/FindOpenMP.cmake @@ -411,11 +411,7 @@ foreach(LANG IN ITEMS C CXX Fortran) add_library(OpenMP::OpenMP_${LANG} INTERFACE IMPORTED) endif() if(OpenMP_${LANG}_FLAGS) - if(CMAKE_HOST_WIN32) - separate_arguments(_OpenMP_${LANG}_OPTIONS WINDOWS_COMMAND "${OpenMP_${LANG}_FLAGS}") - else() - separate_arguments(_OpenMP_${LANG}_OPTIONS UNIX_COMMAND "${OpenMP_${LANG}_FLAGS}") - endif() + separate_arguments(_OpenMP_${LANG}_OPTIONS NATIVE_COMMAND "${OpenMP_${LANG}_FLAGS}") set_property(TARGET OpenMP::OpenMP_${LANG} PROPERTY INTERFACE_COMPILE_OPTIONS "${_OpenMP_${LANG}_OPTIONS}") unset(_OpenMP_${LANG}_OPTIONS) diff --git a/Modules/Platform/AIX-XL-C.cmake b/Modules/Platform/AIX-XL-C.cmake index 5e437fa..cbfd58b 100644 --- a/Modules/Platform/AIX-XL-C.cmake +++ b/Modules/Platform/AIX-XL-C.cmake @@ -1,2 +1,5 @@ include(Platform/AIX-XL) __aix_compiler_xl(C) + +# -qhalt=e = Halt on error messages (rather than just severe errors) +string(APPEND CMAKE_C_FLAGS_INIT " -qhalt=e") diff --git a/Modules/Platform/AIX-XL-CXX.cmake b/Modules/Platform/AIX-XL-CXX.cmake index ef38a5f..78baef5 100644 --- a/Modules/Platform/AIX-XL-CXX.cmake +++ b/Modules/Platform/AIX-XL-CXX.cmake @@ -1,2 +1,5 @@ include(Platform/AIX-XL) __aix_compiler_xl(CXX) + +# -qhalt=s = Halt on severe error messages +string(APPEND CMAKE_CXX_FLAGS_INIT " -qhalt=s") diff --git a/Modules/Platform/BlueGeneP-dynamic-XL-C.cmake b/Modules/Platform/BlueGeneP-dynamic-XL-C.cmake index f13b517..918ee70 100644 --- a/Modules/Platform/BlueGeneP-dynamic-XL-C.cmake +++ b/Modules/Platform/BlueGeneP-dynamic-XL-C.cmake @@ -3,3 +3,6 @@ __BlueGeneP_set_dynamic_flags(XL C) + +# -qhalt=e = Halt on error messages (rather than just severe errors) +string(APPEND CMAKE_C_FLAGS_INIT " -qhalt=e") diff --git a/Modules/Platform/BlueGeneP-dynamic-XL-CXX.cmake b/Modules/Platform/BlueGeneP-dynamic-XL-CXX.cmake index 80c05a1..cfefb0b 100644 --- a/Modules/Platform/BlueGeneP-dynamic-XL-CXX.cmake +++ b/Modules/Platform/BlueGeneP-dynamic-XL-CXX.cmake @@ -3,3 +3,6 @@ __BlueGeneP_set_dynamic_flags(XL CXX) + +# -qhalt=s = Halt on severe error messages +string(APPEND CMAKE_CXX_FLAGS_INIT " -qhalt=s") diff --git a/Modules/Platform/BlueGeneP-static-XL-C.cmake b/Modules/Platform/BlueGeneP-static-XL-C.cmake index a990b5c..7d4fc13 100644 --- a/Modules/Platform/BlueGeneP-static-XL-C.cmake +++ b/Modules/Platform/BlueGeneP-static-XL-C.cmake @@ -3,3 +3,6 @@ __BlueGeneP_set_static_flags(XL C) + +# -qhalt=e = Halt on error messages (rather than just severe errors) +string(APPEND CMAKE_C_FLAGS_INIT " -qhalt=e") diff --git a/Modules/Platform/BlueGeneP-static-XL-CXX.cmake b/Modules/Platform/BlueGeneP-static-XL-CXX.cmake index 116c0bb..1df276e 100644 --- a/Modules/Platform/BlueGeneP-static-XL-CXX.cmake +++ b/Modules/Platform/BlueGeneP-static-XL-CXX.cmake @@ -3,3 +3,6 @@ __BlueGeneP_set_static_flags(XL CXX) + +# -qhalt=s = Halt on severe error messages +string(APPEND CMAKE_CXX_FLAGS_INIT " -qhalt=s") diff --git a/Modules/Platform/BlueGeneQ-dynamic-XL-C.cmake b/Modules/Platform/BlueGeneQ-dynamic-XL-C.cmake index f46fa95..c51dacb 100644 --- a/Modules/Platform/BlueGeneQ-dynamic-XL-C.cmake +++ b/Modules/Platform/BlueGeneQ-dynamic-XL-C.cmake @@ -3,3 +3,6 @@ __BlueGeneQ_setup_dynamic(XL C) + +# -qhalt=e = Halt on error messages (rather than just severe errors) +string(APPEND CMAKE_C_FLAGS_INIT " -qhalt=e") diff --git a/Modules/Platform/BlueGeneQ-dynamic-XL-CXX.cmake b/Modules/Platform/BlueGeneQ-dynamic-XL-CXX.cmake index c463379..5dbc836 100644 --- a/Modules/Platform/BlueGeneQ-dynamic-XL-CXX.cmake +++ b/Modules/Platform/BlueGeneQ-dynamic-XL-CXX.cmake @@ -3,3 +3,6 @@ __BlueGeneQ_setup_dynamic(XL CXX) + +# -qhalt=s = Halt on severe error messages +string(APPEND CMAKE_CXX_FLAGS_INIT " -qhalt=s") diff --git a/Modules/Platform/BlueGeneQ-static-XL-C.cmake b/Modules/Platform/BlueGeneQ-static-XL-C.cmake index 465128f..67cd57d 100644 --- a/Modules/Platform/BlueGeneQ-static-XL-C.cmake +++ b/Modules/Platform/BlueGeneQ-static-XL-C.cmake @@ -3,3 +3,6 @@ __BlueGeneQ_setup_static(XL C) + +# -qhalt=e = Halt on error messages (rather than just severe errors) +string(APPEND CMAKE_C_FLAGS_INIT " -qhalt=e") diff --git a/Modules/Platform/BlueGeneQ-static-XL-CXX.cmake b/Modules/Platform/BlueGeneQ-static-XL-CXX.cmake index abd4ebf..a171e7f 100644 --- a/Modules/Platform/BlueGeneQ-static-XL-CXX.cmake +++ b/Modules/Platform/BlueGeneQ-static-XL-CXX.cmake @@ -3,3 +3,6 @@ __BlueGeneQ_setup_static(XL CXX) + +# -qhalt=s = Halt on severe error messages +string(APPEND CMAKE_CXX_FLAGS_INIT " -qhalt=s") diff --git a/Modules/Platform/Darwin-XL-C.cmake b/Modules/Platform/Darwin-XL-C.cmake index 42e94a9..2aeb132 100644 --- a/Modules/Platform/Darwin-XL-C.cmake +++ b/Modules/Platform/Darwin-XL-C.cmake @@ -3,3 +3,6 @@ set(CMAKE_SHARED_MODULE_CREATE_C_FLAGS "-bundle") # Enable shared library versioning. set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-install_name") + +# -qhalt=e = Halt on error messages (rather than just severe errors) +string(APPEND CMAKE_C_FLAGS_INIT " -qhalt=e") diff --git a/Modules/Platform/Darwin-XL-CXX.cmake b/Modules/Platform/Darwin-XL-CXX.cmake index 65c76f8..f8e1906 100644 --- a/Modules/Platform/Darwin-XL-CXX.cmake +++ b/Modules/Platform/Darwin-XL-CXX.cmake @@ -3,3 +3,6 @@ set(CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS "-bundle") # Enable shared library versioning. set(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-Wl,-install_name") + +# -qhalt=e = Halt on error messages (rather than just severe errors) +string(APPEND CMAKE_C_FLAGS_INIT " -qhalt=e") diff --git a/Source/.gitattributes b/Source/.gitattributes index f69ad9d..0f829a3 100644 --- a/Source/.gitattributes +++ b/Source/.gitattributes @@ -1,20 +1,2 @@ -/cmCommandArgumentLexer.cxx generated -/cmCommandArgumentLexer.h generated -/cmCommandArgumentParser.cxx generated -/cmCommandArgumentParserTokens.h generated -/cmDependsJavaLexer.cxx generated -/cmDependsJavaLexer.h generated -/cmDependsJavaParser.cxx generated -/cmDependsJavaParserTokens.h generated -/cmExprLexer.cxx generated -/cmExprLexer.h generated -/cmExprParser.cxx generated -/cmExprParserTokens.h generated -/cmFortranLexer.cxx generated -/cmFortranLexer.h generated -/cmFortranParser.cxx generated -/cmFortranParserTokens.h generated -/cmListFileLexer.c generated - # Do not format third-party sources. /kwsys/** -format.clang-format diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 8d683cb3f..1ea75bf 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -78,6 +78,7 @@ configure_file( include_directories( "${CMake_BINARY_DIR}/Source" "${CMake_SOURCE_DIR}/Source" + "${CMake_SOURCE_DIR}/Source/LexerParser" ${CMAKE_ZLIB_INCLUDES} ${CMAKE_EXPAT_INCLUDES} ${CMAKE_TAR_INCLUDES} @@ -88,61 +89,6 @@ include_directories( # let cmake know it is supposed to use it add_definitions(-DCMAKE_BUILD_WITH_CMAKE) -option(CMAKE_REGENERATE_YACCLEX - "Regenerate YACC and LEXX files" OFF) -mark_as_advanced(CMAKE_REGENERATE_YACCLEX) -if(CMAKE_REGENERATE_YACCLEX) - set(parsersLexers cmFortran cmCommandArgument cmExpr) - find_program(YACC_EXECUTABLE - NAMES yacc bison - PATHS /usr/bin - DOC "Yacc or Bison executable") - find_program(FLEX_EXECUTABLE - NAMES flex - PATHS /usr/bin - DOC "Flex executable") - mark_as_advanced(YACC_EXECUTABLE FLEX_EXECUTABLE) - if(YACC_EXECUTABLE) - set(BISON_FLAGS) - if(YACC_EXECUTABLE MATCHES "bison") - set(BISON_FLAGS "--yacc") - endif() - set(yacc_files) - foreach(name ${parsersLexers}) - set(src "${CMAKE_CURRENT_SOURCE_DIR}/${name}Parser.y") - set(dst "${CMAKE_CURRENT_BINARY_DIR}/${name}Parser.cxx") - set(hdr "${CMAKE_CURRENT_BINARY_DIR}/${name}ParserTokens.h") - add_custom_command( - OUTPUT "${dst}" - DEPENDS "${src}" - COMMAND - ${YACC_EXECUTABLE} - --name-prefix=${name}_yy --defines=${hdr} -o${dst} ${src} - ) - set(yacc_files ${yacc_files} "${dst}") - endforeach() - add_custom_target(RerunYacc DEPENDS ${yacc_files}) - endif() - if(FLEX_EXECUTABLE) - set(lex_files) - foreach(name ${parsersLexers}) - set(src "${CMAKE_CURRENT_SOURCE_DIR}/${name}Lexer.in.l") - set(dst "${CMAKE_CURRENT_BINARY_DIR}/${name}Lexer.cxx") - set(hdr "${CMAKE_CURRENT_BINARY_DIR}/${name}Lexer.h") - add_custom_command( - OUTPUT "${dst}" - DEPENDS "${src}" - COMMAND - ${FLEX_EXECUTABLE} - --prefix=${name}_yy --header-file=${hdr} -o${dst} ${src} - ) - set(lex_files ${lex_files} "${dst}") - endforeach() - add_custom_target(RerunLex DEPENDS ${lex_files}) - endif() - -endif() - # Check if we can build the ELF parser. if(CMAKE_USE_ELF_PARSER) set(ELF_SRCS cmELF.h cmELF.cxx) @@ -157,14 +103,40 @@ endif() # Sources for CMakeLib # set(SRCS + # Lexers/Parsers + LexerParser/cmCommandArgumentLexer.cxx + LexerParser/cmCommandArgumentLexer.h + LexerParser/cmCommandArgumentLexer.in.l + LexerParser/cmCommandArgumentParser.cxx + LexerParser/cmCommandArgumentParserTokens.h + LexerParser/cmCommandArgumentParser.y + LexerParser/cmDependsJavaLexer.cxx + LexerParser/cmDependsJavaLexer.h + LexerParser/cmDependsJavaLexer.in.l + LexerParser/cmDependsJavaParser.cxx + LexerParser/cmDependsJavaParserTokens.h + LexerParser/cmDependsJavaParser.y + LexerParser/cmExprLexer.cxx + LexerParser/cmExprLexer.h + LexerParser/cmExprLexer.in.l + LexerParser/cmExprParser.cxx + LexerParser/cmExprParserTokens.h + LexerParser/cmExprParser.y + LexerParser/cmFortranLexer.cxx + LexerParser/cmFortranLexer.h + LexerParser/cmFortranLexer.in.l + LexerParser/cmFortranParser.cxx + LexerParser/cmFortranParserTokens.h + LexerParser/cmFortranParser.y + LexerParser/cmListFileLexer.c + LexerParser/cmListFileLexer.in.l + cmArchiveWrite.cxx cmBase32.cxx cmCacheManager.cxx cmCacheManager.h cmCLocaleEnvironmentScope.h cmCLocaleEnvironmentScope.cxx - cmCommandArgumentLexer.cxx - cmCommandArgumentParser.cxx cmCommandArgumentParserHelper.cxx cmCommonTargetGenerator.cxx cmCommonTargetGenerator.h @@ -196,8 +168,6 @@ set(SRCS cmDependsFortran.h cmDependsJava.cxx cmDependsJava.h - cmDependsJavaLexer.cxx - cmDependsJavaParser.cxx cmDependsJavaParserHelper.cxx cmDependsJavaParserHelper.h cmDocumentation.cxx @@ -206,8 +176,6 @@ set(SRCS cmDynamicLoader.cxx cmDynamicLoader.h ${ELF_SRCS} - cmExprLexer.cxx - cmExprParser.cxx cmExprParserHelper.cxx cmExportBuildAndroidMKGenerator.h cmExportBuildAndroidMKGenerator.cxx @@ -247,10 +215,6 @@ set(SRCS cmFilePathChecksum.h cmFileTimeComparison.cxx cmFileTimeComparison.h - cmFortranLexer.cxx - cmFortranLexer.h - cmFortranParser.cxx - cmFortranParser.h cmFortranParserImpl.cxx cmGeneratedFileStream.cxx cmGeneratorExpressionContext.cxx @@ -302,7 +266,6 @@ set(SRCS cmLinkLineDeviceComputer.h cmListFileCache.cxx cmListFileCache.h - cmListFileLexer.c cmLocalCommonGenerator.cxx cmLocalCommonGenerator.h cmLocalGenerator.cxx diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index d18bf2c..c36776a 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 8) -set(CMake_VERSION_PATCH 20170428) +set(CMake_VERSION_PATCH 20170502) #set(CMake_VERSION_RC 1) diff --git a/Source/LexerParser/.clang-tidy b/Source/LexerParser/.clang-tidy new file mode 100644 index 0000000..52b11bf --- /dev/null +++ b/Source/LexerParser/.clang-tidy @@ -0,0 +1,6 @@ +--- +# We want to disable all checks for generated code. However, clang-tidy will +# assume we did not configure it correctly. Just add one check that will never +# be found. +Checks: '-*,llvm-twine-local' +... diff --git a/Source/LexerParser/.gitattributes b/Source/LexerParser/.gitattributes new file mode 100644 index 0000000..47eedfb --- /dev/null +++ b/Source/LexerParser/.gitattributes @@ -0,0 +1,17 @@ +/cmCommandArgumentLexer.cxx generated +/cmCommandArgumentLexer.h generated +/cmCommandArgumentParser.cxx generated +/cmCommandArgumentParserTokens.h generated +/cmDependsJavaLexer.cxx generated +/cmDependsJavaLexer.h generated +/cmDependsJavaParser.cxx generated +/cmDependsJavaParserTokens.h generated +/cmExprLexer.cxx generated +/cmExprLexer.h generated +/cmExprParser.cxx generated +/cmExprParserTokens.h generated +/cmFortranLexer.cxx generated +/cmFortranLexer.h generated +/cmFortranParser.cxx generated +/cmFortranParserTokens.h generated +/cmListFileLexer.c generated diff --git a/Source/cmCommandArgumentLexer.cxx b/Source/LexerParser/cmCommandArgumentLexer.cxx index 12dce37..12dce37 100644 --- a/Source/cmCommandArgumentLexer.cxx +++ b/Source/LexerParser/cmCommandArgumentLexer.cxx diff --git a/Source/cmCommandArgumentLexer.h b/Source/LexerParser/cmCommandArgumentLexer.h index 82e87b5..82e87b5 100644 --- a/Source/cmCommandArgumentLexer.h +++ b/Source/LexerParser/cmCommandArgumentLexer.h diff --git a/Source/cmCommandArgumentLexer.in.l b/Source/LexerParser/cmCommandArgumentLexer.in.l index e3a8094..e3a8094 100644 --- a/Source/cmCommandArgumentLexer.in.l +++ b/Source/LexerParser/cmCommandArgumentLexer.in.l diff --git a/Source/cmCommandArgumentParser.cxx b/Source/LexerParser/cmCommandArgumentParser.cxx index aed0826..aed0826 100644 --- a/Source/cmCommandArgumentParser.cxx +++ b/Source/LexerParser/cmCommandArgumentParser.cxx diff --git a/Source/cmCommandArgumentParser.y b/Source/LexerParser/cmCommandArgumentParser.y index d6c8312..55a88df 100644 --- a/Source/cmCommandArgumentParser.y +++ b/Source/LexerParser/cmCommandArgumentParser.y @@ -189,4 +189,3 @@ void cmCommandArgument_yyerror(yyscan_t yyscanner, const char* message) { yyGetParser->Error(message); } - diff --git a/Source/cmCommandArgumentParserTokens.h b/Source/LexerParser/cmCommandArgumentParserTokens.h index 3172182..3172182 100644 --- a/Source/cmCommandArgumentParserTokens.h +++ b/Source/LexerParser/cmCommandArgumentParserTokens.h diff --git a/Source/cmDependsJavaLexer.cxx b/Source/LexerParser/cmDependsJavaLexer.cxx index 8159f47..8159f47 100644 --- a/Source/cmDependsJavaLexer.cxx +++ b/Source/LexerParser/cmDependsJavaLexer.cxx diff --git a/Source/cmDependsJavaLexer.h b/Source/LexerParser/cmDependsJavaLexer.h index ccadd70..ccadd70 100644 --- a/Source/cmDependsJavaLexer.h +++ b/Source/LexerParser/cmDependsJavaLexer.h diff --git a/Source/cmDependsJavaLexer.in.l b/Source/LexerParser/cmDependsJavaLexer.in.l index 8cb42b1..8cb42b1 100644 --- a/Source/cmDependsJavaLexer.in.l +++ b/Source/LexerParser/cmDependsJavaLexer.in.l diff --git a/Source/cmDependsJavaParser.cxx b/Source/LexerParser/cmDependsJavaParser.cxx index bc45d45..bc45d45 100644 --- a/Source/cmDependsJavaParser.cxx +++ b/Source/LexerParser/cmDependsJavaParser.cxx diff --git a/Source/cmDependsJavaParser.y b/Source/LexerParser/cmDependsJavaParser.y index 1137f39..f7eb228 100644 --- a/Source/cmDependsJavaParser.y +++ b/Source/LexerParser/cmDependsJavaParser.y @@ -242,7 +242,7 @@ jp_DECIMALINTEGERLITERAL yyGetParser->SetCurrentCombine(""); } | -jp_HEXINTEGERLITERAL +jp_HEXINTEGERLITERAL { jpElementStart(1); jpCheckEmpty(1); @@ -3212,4 +3212,3 @@ void cmDependsJava_yyerror(yyscan_t yyscanner, const char* message) { yyGetParser->Error(message); } - diff --git a/Source/cmDependsJavaParserTokens.h b/Source/LexerParser/cmDependsJavaParserTokens.h index 7f18f1d..7f18f1d 100644 --- a/Source/cmDependsJavaParserTokens.h +++ b/Source/LexerParser/cmDependsJavaParserTokens.h diff --git a/Source/cmExprLexer.cxx b/Source/LexerParser/cmExprLexer.cxx index fb6f0db..fb6f0db 100644 --- a/Source/cmExprLexer.cxx +++ b/Source/LexerParser/cmExprLexer.cxx diff --git a/Source/cmExprLexer.h b/Source/LexerParser/cmExprLexer.h index 835a7a3..835a7a3 100644 --- a/Source/cmExprLexer.h +++ b/Source/LexerParser/cmExprLexer.h diff --git a/Source/cmExprLexer.in.l b/Source/LexerParser/cmExprLexer.in.l index 25ddba4..25ddba4 100644 --- a/Source/cmExprLexer.in.l +++ b/Source/LexerParser/cmExprLexer.in.l diff --git a/Source/cmExprParser.cxx b/Source/LexerParser/cmExprParser.cxx index 19efca1..67664a5 100644 --- a/Source/cmExprParser.cxx +++ b/Source/LexerParser/cmExprParser.cxx @@ -1696,4 +1696,3 @@ void cmExpr_yyerror(yyscan_t yyscanner, const char* message) { cmExpr_yyget_extra(yyscanner)->Error(message); } - diff --git a/Source/cmExprParser.y b/Source/LexerParser/cmExprParser.y index 220f7c8..d1c3a97 100644 --- a/Source/cmExprParser.y +++ b/Source/LexerParser/cmExprParser.y @@ -162,4 +162,3 @@ void cmExpr_yyerror(yyscan_t yyscanner, const char* message) { cmExpr_yyget_extra(yyscanner)->Error(message); } - diff --git a/Source/cmExprParserTokens.h b/Source/LexerParser/cmExprParserTokens.h index 84b2bbd..84b2bbd 100644 --- a/Source/cmExprParserTokens.h +++ b/Source/LexerParser/cmExprParserTokens.h diff --git a/Source/cmFortranLexer.cxx b/Source/LexerParser/cmFortranLexer.cxx index 01c09ac..01c09ac 100644 --- a/Source/cmFortranLexer.cxx +++ b/Source/LexerParser/cmFortranLexer.cxx diff --git a/Source/cmFortranLexer.h b/Source/LexerParser/cmFortranLexer.h index ddda919..ddda919 100644 --- a/Source/cmFortranLexer.h +++ b/Source/LexerParser/cmFortranLexer.h diff --git a/Source/cmFortranLexer.in.l b/Source/LexerParser/cmFortranLexer.in.l index 1121210..1121210 100644 --- a/Source/cmFortranLexer.in.l +++ b/Source/LexerParser/cmFortranLexer.in.l diff --git a/Source/cmFortranParser.cxx b/Source/LexerParser/cmFortranParser.cxx index 2b3452f..2b3452f 100644 --- a/Source/cmFortranParser.cxx +++ b/Source/LexerParser/cmFortranParser.cxx diff --git a/Source/cmFortranParser.y b/Source/LexerParser/cmFortranParser.y index acfb40a..acfb40a 100644 --- a/Source/cmFortranParser.y +++ b/Source/LexerParser/cmFortranParser.y diff --git a/Source/cmFortranParserTokens.h b/Source/LexerParser/cmFortranParserTokens.h index 8d6a5fe..8d6a5fe 100644 --- a/Source/cmFortranParserTokens.h +++ b/Source/LexerParser/cmFortranParserTokens.h diff --git a/Source/cmListFileLexer.c b/Source/LexerParser/cmListFileLexer.c index 3dd3b85..3dd3b85 100644 --- a/Source/cmListFileLexer.c +++ b/Source/LexerParser/cmListFileLexer.c diff --git a/Source/cmListFileLexer.in.l b/Source/LexerParser/cmListFileLexer.in.l index 5152dbf..5152dbf 100644 --- a/Source/cmListFileLexer.in.l +++ b/Source/LexerParser/cmListFileLexer.in.l diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt index 2e11a8a..8619fe9 100644 --- a/Source/QtDialog/CMakeLists.txt +++ b/Source/QtDialog/CMakeLists.txt @@ -160,6 +160,19 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) add_executable(cmake-gui WIN32 MACOSX_BUNDLE ${SRCS} ${MANIFEST_FILE}) target_link_libraries(cmake-gui CMakeLib ${QT_QTMAIN_LIBRARY} ${CMake_QT_LIBRARIES}) +# Files generated by MOC, RCC, and UIC may produce clang-tidy warnings. +# We generate a dummy .clang-tidy file in the binary directory that disables +# all clang-tidy checks except one that will never match. This one check is +# necessary; clang-tidy reports an error when no checks are enabled. +# Since the Qt code generators will generate source files in the binary tree, +# clang-tidy will load the configuration from this dummy file when the sources +# are built. +file(WRITE "${QtDialog_BINARY_DIR}/.clang-tidy" " +--- +Checks: '-*,llvm-twine-local' +... +") + if(APPLE) file(STRINGS "${CMake_SOURCE_DIR}/Copyright.txt" copyright_line LIMIT_COUNT 1 REGEX "^Copyright 2000-20[0-9][0-9] Kitware") diff --git a/Source/bindexplib.cxx b/Source/bindexplib.cxx index 6026a57..691e3ae 100644 --- a/Source/bindexplib.cxx +++ b/Source/bindexplib.cxx @@ -235,35 +235,29 @@ public: symbol.erase(posAt); } } - // For i386 builds we don't need to remove _ + // For i386 builds we need to remove _ if (this->IsI386 && symbol[0] == '_') { symbol.erase(0, 1); } - /* - Check whether it is "Scalar deleting destructor" and - "Vector deleting destructor" - */ + // Check whether it is "Scalar deleting destructor" and "Vector + // deleting destructor" + // if scalarPrefix and vectorPrefix are not found then print the + // symbol const char* scalarPrefix = "??_G"; const char* vectorPrefix = "??_E"; - // original code had a check for - // symbol.find("real@") == std::string::npos) - // but if this disallows memmber functions with the name real - // if scalarPrefix and vectorPrefix are not found then print - // the symbol if (symbol.compare(0, 4, scalarPrefix) && symbol.compare(0, 4, vectorPrefix)) { SectChar = this->SectionHeaders[pSymbolTable->SectionNumber - 1] .Characteristics; - if (!pSymbolTable->Type && (SectChar & IMAGE_SCN_MEM_WRITE)) { - // Read only (i.e. constants) must be excluded - this->DataSymbols.insert(symbol); - } else { - if (pSymbolTable->Type || !(SectChar & IMAGE_SCN_MEM_READ) || - (SectChar & IMAGE_SCN_MEM_EXECUTE)) { - this->Symbols.insert(symbol); - } else { - // printf(" strange symbol: %s \n",symbol.c_str()); + + if (SectChar & IMAGE_SCN_MEM_EXECUTE) { + this->Symbols.insert(symbol); + } else if (SectChar & IMAGE_SCN_MEM_READ) { + // skip __real@ and __xmm@ + if (symbol.find("_real") == std::string::npos && + symbol.find("_xmm") == std::string::npos) { + this->DataSymbols.insert(symbol); } } } diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx index 178a7ce..391d65c 100644 --- a/Source/cmCommonTargetGenerator.cxx +++ b/Source/cmCommonTargetGenerator.cxx @@ -43,17 +43,6 @@ const char* cmCommonTargetGenerator::GetFeature(const std::string& feature) return this->GeneratorTarget->GetFeature(feature, this->ConfigName); } -void cmCommonTargetGenerator::AddFeatureFlags(std::string& flags, - const std::string& lang) -{ - // Add language-specific flags. - this->LocalGenerator->AddLanguageFlags(flags, lang, this->ConfigName); - - if (this->GeneratorTarget->IsIPOEnabled(this->ConfigName)) { - this->LocalGenerator->AppendFeatureOptions(flags, lang, "IPO"); - } -} - void cmCommonTargetGenerator::AddModuleDefinitionFlag( cmLinkLineComputer* linkLineComputer, std::string& flags) { diff --git a/Source/cmCommonTargetGenerator.h b/Source/cmCommonTargetGenerator.h index 8ba2e22..c36145f 100644 --- a/Source/cmCommonTargetGenerator.h +++ b/Source/cmCommonTargetGenerator.h @@ -28,9 +28,6 @@ public: std::string const& GetConfigName() const; protected: - // Add language feature flags. - void AddFeatureFlags(std::string& flags, const std::string& lang); - // Feature query methods. const char* GetFeature(const std::string& feature); diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index a0f677b..3f50e32 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -2919,6 +2919,19 @@ void cmGeneratorTarget::ComputeTargetManifest(const std::string& config) const } } +bool cmGeneratorTarget::ComputeCompileFeatures(std::string const& config) const +{ + std::vector<std::string> features; + this->GetCompileFeatures(features, config); + for (std::vector<std::string>::const_iterator it = features.begin(); + it != features.end(); ++it) { + if (!this->Makefile->AddRequiredTargetFeature(this->Target, *it)) { + return false; + } + } + return true; +} + std::string cmGeneratorTarget::GetImportedLibName( std::string const& config) const { diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 13b6b73..134b7c7 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -412,6 +412,8 @@ public: /** Add the target output files to the global generator manifest. */ void ComputeTargetManifest(const std::string& config) const; + bool ComputeCompileFeatures(std::string const& config) const; + /** * Trace through the source files in this target and add al source files * that they depend on, used by all generators diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx index ba623d5..7032cd5 100644 --- a/Source/cmGhsMultiTargetGenerator.cxx +++ b/Source/cmGhsMultiTargetGenerator.cxx @@ -232,10 +232,12 @@ void cmGhsMultiTargetGenerator::SetCompilerFlags(std::string const& config, const char* lang = language.c_str(); if (notKernel) { - this->LocalGenerator->AddLanguageFlags(flags, lang, config); + this->LocalGenerator->AddLanguageFlags(flags, this->GeneratorTarget, + lang, config); } else { - this->LocalGenerator->AddLanguageFlags( - flags, lang + std::string("_GHS_KERNEL"), config); + this->LocalGenerator->AddLanguageFlags(flags, this->GeneratorTarget, + lang + std::string("_GHS_KERNEL"), + config); } this->LocalGenerator->AddCMP0018Flags(flags, this->GeneratorTarget, lang, config); diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 50ad1a8..f3eb249 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1272,6 +1272,18 @@ bool cmGlobalGenerator::Compute() this->LocalGenerators[i]->AddHelperCommands(); } + // Finalize the set of compile features for each target. + // FIXME: This turns into calls to cmMakefile::AddRequiredTargetFeature + // which actually modifies the <lang>_STANDARD target property + // on the original cmTarget instance. It accumulates features + // across all configurations. Some refactoring is needed to + // compute a per-config resulta purely during generation. + for (i = 0; i < this->LocalGenerators.size(); ++i) { + if (!this->LocalGenerators[i]->ComputeTargetCompileFeatures()) { + return false; + } + } + #ifdef CMAKE_BUILD_WITH_CMAKE for (std::vector<cmGeneratorTarget const*>::iterator it = autogenTargets.begin(); diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 6636329..d99e3bb 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -1662,7 +1662,8 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt, std::string& flags = cflags[lang]; // Add language-specific flags. - this->CurrentLocalGenerator->AddLanguageFlags(flags, lang, configName); + this->CurrentLocalGenerator->AddLanguageFlags(flags, gtgt, lang, + configName); // Add shared-library flags if needed. this->CurrentLocalGenerator->AddCMP0018Flags(flags, gtgt, lang, diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 424ab6f..8ce158b 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -558,6 +558,31 @@ void cmLocalGenerator::ComputeTargetManifest() } } +bool cmLocalGenerator::ComputeTargetCompileFeatures() +{ + // Collect the set of configuration types. + std::vector<std::string> configNames; + this->Makefile->GetConfigurations(configNames); + if (configNames.empty()) { + configNames.push_back(""); + } + + // Process compile features of all targets. + std::vector<cmGeneratorTarget*> targets = this->GetGeneratorTargets(); + for (std::vector<cmGeneratorTarget*>::iterator t = targets.begin(); + t != targets.end(); ++t) { + cmGeneratorTarget* target = *t; + for (std::vector<std::string>::iterator ci = configNames.begin(); + ci != configNames.end(); ++ci) { + if (!target->ComputeCompileFeatures(*ci)) { + return false; + } + } + } + + return true; +} + bool cmLocalGenerator::IsRootMakefile() const { return !this->StateSnapshot.GetBuildsystemDirectoryParent().IsValid(); @@ -742,14 +767,6 @@ void cmLocalGenerator::AddCompileOptions(std::string& flags, this->AppendFlagEscape(flags, *i); } } - std::vector<std::string> features; - target->GetCompileFeatures(features, config); - for (std::vector<std::string>::const_iterator it = features.begin(); - it != features.end(); ++it) { - if (!this->Makefile->AddRequiredTargetFeature(target->Target, *it)) { - return; - } - } for (std::map<std::string, std::string>::const_iterator it = target->GetMaxLanguageStandards().begin(); @@ -915,6 +932,9 @@ void cmLocalGenerator::GetTargetFlags( const char* libraryLinkVariable = "CMAKE_SHARED_LINKER_FLAGS"; // default to shared library + const std::string linkLanguage = + linkLineComputer->GetLinkerLanguage(target, buildType); + switch (target->GetType()) { case cmStateEnums::STATIC_LIBRARY: this->GetStaticLibraryFlags(linkFlags, buildType, target); @@ -976,16 +996,13 @@ void cmLocalGenerator::GetTargetFlags( linkFlags += this->Makefile->GetSafeDefinition(build); linkFlags += " "; } - - const std::string linkLanguage = - linkLineComputer->GetLinkerLanguage(target, buildType); if (linkLanguage.empty()) { cmSystemTools::Error( "CMake can not determine linker language for target: ", target->GetName().c_str()); return; } - this->AddLanguageFlags(flags, linkLanguage, buildType); + this->AddLanguageFlagsForLinking(flags, target, linkLanguage, buildType); if (pcli) { this->OutputLinkLibraries(pcli, linkLineComputer, linkLibs, frameworkPath, linkPath); @@ -1040,6 +1057,8 @@ void cmLocalGenerator::GetTargetFlags( default: break; } + + this->AppendIPOLinkerFlags(linkFlags, target, config, linkLanguage); } void cmLocalGenerator::GetTargetCompileFlags(cmGeneratorTarget* target, @@ -1050,11 +1069,7 @@ void cmLocalGenerator::GetTargetCompileFlags(cmGeneratorTarget* target, cmMakefile* mf = this->GetMakefile(); // Add language-specific flags. - this->AddLanguageFlags(flags, lang, config); - - if (target->IsIPOEnabled(config)) { - this->AppendFeatureOptions(flags, lang, "IPO"); - } + this->AddLanguageFlags(flags, target, lang, config); this->AddArchitectureFlags(flags, target, lang, config); @@ -1287,6 +1302,7 @@ void cmLocalGenerator::AddArchitectureFlags(std::string& flags, } void cmLocalGenerator::AddLanguageFlags(std::string& flags, + cmGeneratorTarget const* target, const std::string& lang, const std::string& config) { @@ -1295,6 +1311,26 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags, flagsVar += lang; flagsVar += "_FLAGS"; this->AddConfigVariableFlags(flags, flagsVar, config); + + if (target->IsIPOEnabled(config)) { + this->AppendFeatureOptions(flags, lang, "IPO"); + } +} + +void cmLocalGenerator::AddLanguageFlagsForLinking( + std::string& flags, cmGeneratorTarget const* target, const std::string& lang, + const std::string& config) +{ + if (this->Makefile->IsOn("CMAKE_" + lang + + "_LINK_WITH_STANDARD_COMPILE_OPTION")) { + // This toolchain requires use of the language standard flag + // when linking in order to use the matching standard library. + // FIXME: If CMake gains an abstraction for standard library + // selection, this will have to be reconciled with it. + this->AddCompilerRequirementFlag(flags, target, lang); + } + + this->AddLanguageFlags(flags, target, lang, config); } cmGeneratorTarget* cmLocalGenerator::FindGeneratorTargetToUse( @@ -1768,6 +1804,38 @@ void cmLocalGenerator::AppendFlagEscape(std::string& flags, this->AppendFlags(flags, this->EscapeForShell(rawFlag)); } +void cmLocalGenerator::AppendIPOLinkerFlags(std::string& flags, + cmGeneratorTarget* target, + const std::string& config, + const std::string& lang) +{ + if (!target->IsIPOEnabled(config)) { + return; + } + + switch (target->GetType()) { + case cmStateEnums::EXECUTABLE: + case cmStateEnums::SHARED_LIBRARY: + case cmStateEnums::MODULE_LIBRARY: + break; + default: + return; + } + + const std::string name = "CMAKE_" + lang + "_LINK_OPTIONS_IPO"; + const char* rawFlagsList = this->Makefile->GetDefinition(name); + if (rawFlagsList == CM_NULLPTR) { + return; + } + + std::vector<std::string> flagsList; + cmSystemTools::ExpandListArgument(rawFlagsList, flagsList); + for (std::vector<std::string>::const_iterator oi = flagsList.begin(); + oi != flagsList.end(); ++oi) { + this->AppendFlagEscape(flags, *oi); + } +} + void cmLocalGenerator::AppendDefines(std::set<std::string>& defines, const char* defines_list) const { diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 1459a05..e888094 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -70,6 +70,8 @@ public: */ void ComputeTargetManifest(); + bool ComputeTargetCompileFeatures(); + bool IsRootMakefile() const; ///! Get the makefile for this generator @@ -98,8 +100,12 @@ public: const std::string& lang, const std::string& config); - void AddLanguageFlags(std::string& flags, const std::string& lang, - const std::string& config); + void AddLanguageFlags(std::string& flags, cmGeneratorTarget const* target, + const std::string& lang, const std::string& config); + void AddLanguageFlagsForLinking(std::string& flags, + cmGeneratorTarget const* target, + const std::string& lang, + const std::string& config); void AddCMP0018Flags(std::string& flags, cmGeneratorTarget const* target, std::string const& lang, const std::string& config); void AddVisibilityPresetFlags(std::string& flags, @@ -115,6 +121,9 @@ public: virtual void AppendFlags(std::string& flags, const char* newFlags); virtual void AppendFlagEscape(std::string& flags, const std::string& rawFlag); + void AppendIPOLinkerFlags(std::string& flags, cmGeneratorTarget* target, + const std::string& config, + const std::string& lang); ///! Get the include flags for the current makefile and language std::string GetIncludeFlags(const std::vector<std::string>& includes, cmGeneratorTarget* target, diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index a719887..359b9fd 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -150,7 +150,8 @@ void cmMakefileExecutableTargetGenerator::WriteDeviceExecutableRule( linkLanguage, *this->GeneratorTarget)); // Add language feature flags. - this->AddFeatureFlags(flags, linkLanguage); + this->LocalGenerator->AddLanguageFlagsForLinking( + flags, this->GeneratorTarget, linkLanguage, this->ConfigName); this->LocalGenerator->AddArchitectureFlags(flags, this->GeneratorTarget, linkLanguage, this->ConfigName); @@ -433,7 +434,8 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) } // Add language feature flags. - this->AddFeatureFlags(flags, linkLanguage); + this->LocalGenerator->AddLanguageFlagsForLinking( + flags, this->GeneratorTarget, linkLanguage, this->ConfigName); this->LocalGenerator->AddArchitectureFlags(flags, this->GeneratorTarget, linkLanguage, this->ConfigName); @@ -455,6 +457,9 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) this->AddModuleDefinitionFlag(linkLineComputer.get(), linkFlags); } + this->LocalGenerator->AppendIPOLinkerFlags(linkFlags, this->GeneratorTarget, + this->ConfigName, linkLanguage); + // Construct a list of files associated with this executable that // may need to be cleaned. std::vector<std::string> exeCleanFiles; diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index 2823977..2b37b4d 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -395,9 +395,10 @@ void cmMakefileLibraryTargetGenerator::WriteDeviceLibraryRules( vars.LinkFlags = linkFlags.c_str(); vars.TargetCompilePDB = targetOutPathCompilePDB.c_str(); - // Add language feature flags. + // Add language-specific flags. std::string langFlags; - this->AddFeatureFlags(langFlags, linkLanguage); + this->LocalGenerator->AddLanguageFlagsForLinking( + langFlags, this->GeneratorTarget, linkLanguage, this->ConfigName); vars.LanguageCompileFlags = langFlags.c_str(); @@ -493,6 +494,8 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( // Create set of linking flags. std::string linkFlags; this->LocalGenerator->AppendFlags(linkFlags, extraFlags); + this->LocalGenerator->AppendIPOLinkerFlags(linkFlags, this->GeneratorTarget, + this->ConfigName, linkLanguage); // Add OSX version flags, if any. if (this->GeneratorTarget->GetType() == cmStateEnums::SHARED_LIBRARY || @@ -853,9 +856,10 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules( } } - // Add language feature flags. + // Add language-specific flags. std::string langFlags; - this->AddFeatureFlags(langFlags, linkLanguage); + this->LocalGenerator->AddLanguageFlagsForLinking( + langFlags, this->GeneratorTarget, linkLanguage, this->ConfigName); this->LocalGenerator->AddArchitectureFlags( langFlags, this->GeneratorTarget, linkLanguage, this->ConfigName); diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 8206083..0331828 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -655,7 +655,8 @@ void cmNinjaNormalTargetGenerator::WriteDeviceLinkStatement() localGen.AddArchitectureFlags(t, &genTarget, cudaLinkLanguage, cfgName); vars["ARCH_FLAGS"] = t; t = ""; - localGen.AddLanguageFlags(t, cudaLinkLanguage, cfgName); + localGen.AddLanguageFlagsForLinking(t, &genTarget, cudaLinkLanguage, + cfgName); vars["LANGUAGE_COMPILE_FLAGS"] = t; } if (this->GetGeneratorTarget()->HasSOName(cfgName)) { @@ -874,7 +875,8 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() vars["ARCH_FLAGS"] = t; t = ""; t += lwyuFlags; - localGen.AddLanguageFlags(t, TargetLinkLanguage, cfgName); + localGen.AddLanguageFlagsForLinking(t, &genTarget, TargetLinkLanguage, + cfgName); vars["LANGUAGE_COMPILE_FLAGS"] = t; } if (this->GetGeneratorTarget()->HasSOName(cfgName)) { diff --git a/Source/cmSeparateArgumentsCommand.cxx b/Source/cmSeparateArgumentsCommand.cxx index b27d227..7b222a0 100644 --- a/Source/cmSeparateArgumentsCommand.cxx +++ b/Source/cmSeparateArgumentsCommand.cxx @@ -40,6 +40,13 @@ bool cmSeparateArgumentsCommand::InitialPass( if (doing == DoingVariable) { var = args[i]; doing = DoingMode; + } else if (doing == DoingMode && args[i] == "NATIVE_COMMAND") { +#ifdef _WIN32 + mode = ModeWindows; +#else + mode = ModeUnix; +#endif + doing = DoingCommand; } else if (doing == DoingMode && args[i] == "UNIX_COMMAND") { mode = ModeUnix; doing = DoingCommand; diff --git a/Source/kwsys/CMakeLists.txt b/Source/kwsys/CMakeLists.txt index e15b49e..e915b1a 100644 --- a/Source/kwsys/CMakeLists.txt +++ b/Source/kwsys/CMakeLists.txt @@ -797,6 +797,8 @@ ENDFOREACH() IF(KWSYS_C_SRCS OR KWSYS_CXX_SRCS) ADD_LIBRARY(${KWSYS_NAMESPACE} ${KWSYS_LIBRARY_TYPE} ${KWSYS_C_SRCS} ${KWSYS_CXX_SRCS}) + SET_PROPERTY(TARGET ${KWSYS_NAMESPACE} PROPERTY C_CLANG_TIDY "") + SET_PROPERTY(TARGET ${KWSYS_NAMESPACE} PROPERTY CXX_CLANG_TIDY "") SET_PROPERTY(TARGET ${KWSYS_NAMESPACE} PROPERTY C_INCLUDE_WHAT_YOU_USE "") SET_PROPERTY(TARGET ${KWSYS_NAMESPACE} PROPERTY CXX_INCLUDE_WHAT_YOU_USE "") SET_PROPERTY(TARGET ${KWSYS_NAMESPACE} PROPERTY LABELS ${KWSYS_LABELS_LIB}) @@ -943,6 +945,8 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR) ENDIF() IF(KWSYS_USE_ConsoleBuf) ADD_EXECUTABLE(testConsoleBufChild testConsoleBufChild.cxx) + SET_PROPERTY(TARGET testConsoleBufChild PROPERTY C_CLANG_TIDY "") + SET_PROPERTY(TARGET testConsoleBufChild PROPERTY CXX_CLANG_TIDY "") SET_PROPERTY(TARGET testConsoleBufChild PROPERTY C_INCLUDE_WHAT_YOU_USE "") SET_PROPERTY(TARGET testConsoleBufChild PROPERTY CXX_INCLUDE_WHAT_YOU_USE "") SET_PROPERTY(TARGET testConsoleBufChild PROPERTY LABELS ${KWSYS_LABELS_EXE}) @@ -972,6 +976,8 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR) ${KWSYS_CXX_TESTS} ) ADD_EXECUTABLE(${KWSYS_NAMESPACE}TestsCxx ${KWSYS_CXX_TEST_SRCS}) + SET_PROPERTY(TARGET ${KWSYS_NAMESPACE}TestsCxx PROPERTY C_CLANG_TIDY "") + SET_PROPERTY(TARGET ${KWSYS_NAMESPACE}TestsCxx PROPERTY CXX_CLANG_TIDY "") SET_PROPERTY(TARGET ${KWSYS_NAMESPACE}TestsCxx PROPERTY C_INCLUDE_WHAT_YOU_USE "") SET_PROPERTY(TARGET ${KWSYS_NAMESPACE}TestsCxx PROPERTY CXX_INCLUDE_WHAT_YOU_USE "") SET_PROPERTY(TARGET ${KWSYS_NAMESPACE}TestsCxx PROPERTY LABELS ${KWSYS_LABELS_EXE}) @@ -1039,8 +1045,12 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR) # Some Apple compilers produce bad optimizations in this source. IF(APPLE AND CMAKE_C_COMPILER_ID MATCHES "^(GNU|LLVM)$") SET_SOURCE_FILES_PROPERTIES(testProcess.c PROPERTIES COMPILE_FLAGS -O0) - ELSEIF(CMAKE_C_COMPILER_ID STREQUAL "XL") + ELSEIF(CMAKE_C_COMPILER_ID STREQUAL "XL" AND + NOT (CMAKE_SYSTEM MATCHES "Linux.*ppc64le" AND + NOT CMAKE_C_COMPILER_VERSION VERSION_LESS "13.1.1")) # Tell IBM XL not to warn about our test infinite loop + # v13.1.1 and newer on Linux ppc64le is clang based and does not accept + # the -qsuppress option SET_PROPERTY(SOURCE testProcess.c PROPERTY COMPILE_FLAGS -qsuppress=1500-010) ENDIF() diff --git a/Tests/CMakeTests/CMakeLists.txt b/Tests/CMakeTests/CMakeLists.txt index 1cca35d..1619081 100644 --- a/Tests/CMakeTests/CMakeLists.txt +++ b/Tests/CMakeTests/CMakeLists.txt @@ -19,7 +19,6 @@ AddCMakeTest(GetFilenameComponentRealpath "") AddCMakeTest(Version "") AddCMakeTest(Message "") AddCMakeTest(File "") -AddCMakeTest(SeparateArguments "") AddCMakeTest(ImplicitLinkInfo "") AddCMakeTest(ModuleNotices "") AddCMakeTest(GetProperty "") diff --git a/Tests/CMakeTests/SeparateArgumentsTest.cmake.in b/Tests/CMakeTests/SeparateArgumentsTest.cmake.in deleted file mode 100644 index 48964b8..0000000 --- a/Tests/CMakeTests/SeparateArgumentsTest.cmake.in +++ /dev/null @@ -1,25 +0,0 @@ -set(old_out "a b c") -separate_arguments(old_out) -set(old_exp "a;b;;c") - -set(unix_cmd "a \"b c\" 'd e' \";\" \\ \\'\\\" '\\'' \"\\\"\"") -set(unix_exp "a;b c;d e;\;; '\";';\"") -separate_arguments(unix_out UNIX_COMMAND "${unix_cmd}") - -set(windows_cmd "a \"b c\" 'd e' \";\" \\ \"c:\\windows\\path\\\\\" \\\"") -set(windows_exp "a;b c;'d;e';\;;\\;c:\\windows\\path\\;\"") -separate_arguments(windows_out WINDOWS_COMMAND "${windows_cmd}") - -foreach(mode old unix windows) - if(NOT "${${mode}_out}" STREQUAL "${${mode}_exp}") - message(FATAL_ERROR "separate_arguments ${mode}-style failed. " - "Expected\n [${${mode}_exp}]\nbut got\n [${${mode}_out}]\n") - endif() -endforeach() - -set(nothing) -separate_arguments(nothing) -if(DEFINED nothing) - message(FATAL_ERROR "separate_arguments null-case failed: " - "nothing=[${nothing}]") -endif() diff --git a/Tests/FindOpenMP/Test/CMakeLists.txt b/Tests/FindOpenMP/Test/CMakeLists.txt index 4ba0e5c..6313ef6 100644 --- a/Tests/FindOpenMP/Test/CMakeLists.txt +++ b/Tests/FindOpenMP/Test/CMakeLists.txt @@ -39,11 +39,7 @@ foreach(c C CXX Fortran) add_test(NAME test_tgt_${c} COMMAND test_tgt_${c}) add_executable(test_var_${c} ${OpenMPTEST_SOURCE_FILE}) - if(CMAKE_HOST_WIN32) - separate_arguments(_OpenMP_${c}_OPTIONS WINDOWS_COMMAND "${OpenMP_${c}_FLAGS}") - else() - separate_arguments(_OpenMP_${c}_OPTIONS UNIX_COMMAND "${OpenMP_${c}_FLAGS}") - endif() + separate_arguments(_OpenMP_${c}_OPTIONS NATIVE_COMMAND "${OpenMP_${c}_FLAGS}") target_compile_options(test_var_${c} PRIVATE "${_OpenMP_${c}_OPTIONS}") target_link_libraries(test_var_${c} PRIVATE "${OpenMP_${c}_FLAGS}") set_property(TARGET test_var_${c} PROPERTY LINKER_LANGUAGE ${c}) diff --git a/Tests/RunCMake/AutoExportDll/foo.c b/Tests/RunCMake/AutoExportDll/foo.c index 4b1318b..e70fbb5 100644 --- a/Tests/RunCMake/AutoExportDll/foo.c +++ b/Tests/RunCMake/AutoExportDll/foo.c @@ -13,3 +13,5 @@ int bar() { return 5; } + +const char testconst[] = "testconst"; diff --git a/Tests/RunCMake/AutoExportDll/say.cxx b/Tests/RunCMake/AutoExportDll/say.cxx index 51060e8..eb9c0ff 100644 --- a/Tests/RunCMake/AutoExportDll/say.cxx +++ b/Tests/RunCMake/AutoExportDll/say.cxx @@ -13,6 +13,14 @@ int WINAPI foo(); int bar(); int objlib(); void justnop(); + +// test const export +#ifdef _WIN32 +// data symbols must be explicitly imported +__declspec(dllimport) extern const char testconst[]; +#else +extern const char testconst[]; +#endif } // test c++ functions @@ -43,6 +51,8 @@ int main() bar(); objlib(); printf("\n"); + printf("%s", testconst); + printf("\n"); #ifdef HAS_JUSTNOP justnop(); #endif diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index cf778b6..75d4e29 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -217,6 +217,7 @@ add_RunCMake_test(list) add_RunCMake_test(message) add_RunCMake_test(project -DCMake_TEST_RESOURCES=${CMake_TEST_RESOURCES}) add_RunCMake_test(return) +add_RunCMake_test(separate_arguments) add_RunCMake_test(set_property) add_RunCMake_test(string) foreach(var diff --git a/Tests/RunCMake/separate_arguments/CMakeLists.txt b/Tests/RunCMake/separate_arguments/CMakeLists.txt new file mode 100644 index 0000000..2897109 --- /dev/null +++ b/Tests/RunCMake/separate_arguments/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.0) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/separate_arguments/EmptyCommand.cmake b/Tests/RunCMake/separate_arguments/EmptyCommand.cmake new file mode 100644 index 0000000..895b6ac --- /dev/null +++ b/Tests/RunCMake/separate_arguments/EmptyCommand.cmake @@ -0,0 +1,6 @@ +set(nothing) +separate_arguments(nothing) +if(DEFINED nothing) + message(FATAL_ERROR "separate_arguments null-case failed: " + "nothing=[${nothing}]") +endif() diff --git a/Tests/RunCMake/separate_arguments/NativeCommand.cmake b/Tests/RunCMake/separate_arguments/NativeCommand.cmake new file mode 100644 index 0000000..1cb009e --- /dev/null +++ b/Tests/RunCMake/separate_arguments/NativeCommand.cmake @@ -0,0 +1,19 @@ +set(unix_cmd "a \"b c\" 'd e' \";\" \\ \\'\\\" '\\'' \"\\\"\"") +set(unix_exp "a;b c;d e;\;; '\";';\"") + +set(windows_cmd "a \"b c\" 'd e' \";\" \\ \"c:\\windows\\path\\\\\" \\\"") +set(windows_exp "a;b c;'d;e';\;;\\;c:\\windows\\path\\;\"") + +if(CMAKE_HOST_WIN32) + set(native_cmd "${windows_cmd}") + set(native_exp "${windows_exp}") +else() + set(native_cmd "${unix_cmd}") + set(native_exp "${unix_exp}") +endif() +separate_arguments(native_out NATIVE_COMMAND "${native_cmd}") + +if(NOT "${native_out}" STREQUAL "${native_exp}") + message(FATAL_ERROR "separate_arguments native-style failed. " + "Expected\n [${native_exp}]\nbut got\n [${native_out}]\n") +endif() diff --git a/Tests/RunCMake/separate_arguments/PlainCommand.cmake b/Tests/RunCMake/separate_arguments/PlainCommand.cmake new file mode 100644 index 0000000..311a993 --- /dev/null +++ b/Tests/RunCMake/separate_arguments/PlainCommand.cmake @@ -0,0 +1,8 @@ +set(old_out "a b c") +separate_arguments(old_out) +set(old_exp "a;b;;c") + +if(NOT "${old_out}" STREQUAL "${old_exp}") + message(FATAL_ERROR "separate_arguments old-style failed. " + "Expected\n [${old_exp}]\nbut got\n [${old_out}]\n") +endif() diff --git a/Tests/RunCMake/separate_arguments/RunCMakeTest.cmake b/Tests/RunCMake/separate_arguments/RunCMakeTest.cmake new file mode 100644 index 0000000..07951bb --- /dev/null +++ b/Tests/RunCMake/separate_arguments/RunCMakeTest.cmake @@ -0,0 +1,7 @@ +include(RunCMake) + +run_cmake(EmptyCommand) +run_cmake(PlainCommand) +run_cmake(UnixCommand) +run_cmake(WindowsCommand) +run_cmake(NativeCommand) diff --git a/Tests/RunCMake/separate_arguments/UnixCommand.cmake b/Tests/RunCMake/separate_arguments/UnixCommand.cmake new file mode 100644 index 0000000..0b5767a --- /dev/null +++ b/Tests/RunCMake/separate_arguments/UnixCommand.cmake @@ -0,0 +1,8 @@ +set(unix_cmd "a \"b c\" 'd e' \";\" \\ \\'\\\" '\\'' \"\\\"\"") +set(unix_exp "a;b c;d e;\;; '\";';\"") +separate_arguments(unix_out UNIX_COMMAND "${unix_cmd}") + +if(NOT "${unix_out}" STREQUAL "${unix_exp}") + message(FATAL_ERROR "separate_arguments unix-style failed. " + "Expected\n [${unix_exp}]\nbut got\n [${unix_out}]\n") +endif() diff --git a/Tests/RunCMake/separate_arguments/WindowsCommand.cmake b/Tests/RunCMake/separate_arguments/WindowsCommand.cmake new file mode 100644 index 0000000..86aa14a --- /dev/null +++ b/Tests/RunCMake/separate_arguments/WindowsCommand.cmake @@ -0,0 +1,8 @@ +set(windows_cmd "a \"b c\" 'd e' \";\" \\ \"c:\\windows\\path\\\\\" \\\"") +set(windows_exp "a;b c;'d;e';\;;\\;c:\\windows\\path\\;\"") +separate_arguments(windows_out WINDOWS_COMMAND "${windows_cmd}") + +if(NOT "${windows_out}" STREQUAL "${windows_exp}") + message(FATAL_ERROR "separate_arguments windows-style failed. " + "Expected\n [${windows_exp}]\nbut got\n [${windows_out}]\n") +endif() @@ -240,6 +240,10 @@ CMAKE_UNUSED_SOURCES="\ " CMAKE_CXX_SOURCES="\ + LexerParser/cmCommandArgumentLexer \ + LexerParser/cmCommandArgumentParser \ + LexerParser/cmExprLexer \ + LexerParser/cmExprParser \ cmAddCustomCommandCommand \ cmAddCustomTargetCommand \ cmAddDefinitionsCommand \ @@ -255,8 +259,6 @@ CMAKE_CXX_SOURCES="\ cmCPackPropertiesGenerator \ cmCacheManager \ cmCommand \ - cmCommandArgumentLexer \ - cmCommandArgumentParser \ cmCommandArgumentParserHelper \ cmCommandArgumentsHelper \ cmCommands \ @@ -288,8 +290,6 @@ CMAKE_CXX_SOURCES="\ cmExportSet \ cmExportSetMap \ cmExportTryCompileFileGenerator \ - cmExprLexer \ - cmExprParser \ cmExprParserHelper \ cmExternalMakefileProjectGenerator \ cmFileCommand \ @@ -417,7 +417,7 @@ if ${cmake_system_mingw}; then fi CMAKE_C_SOURCES="\ - cmListFileLexer \ + LexerParser/cmListFileLexer \ " if ${cmake_system_mingw}; then @@ -810,6 +810,11 @@ if [ ! -d "cmsys" ]; then cmake_error 4 "Cannot create directory ${cmake_bootstrap_dir}/cmsys" fi +[ -d "LexerParser" ] || mkdir "LexerParser" +if [ ! -d "LexerParser" ]; then + cmake_error 5 "Cannot create directory ${cmake_bootstrap_dir}/LexerParser" +fi + # Delete all the bootstrap files rm -f "${cmake_bootstrap_dir}/cmake_bootstrap.log" rm -f "${cmake_bootstrap_dir}/cmConfigure.h${_tmp}" @@ -1431,9 +1436,15 @@ cmake_cxx_flags_SystemTools=" -DKWSYS_CXX_HAS_UTIMENSAT=${KWSYS_CXX_HAS_UTIMENSAT} -DKWSYS_CXX_HAS_UTIMES=${KWSYS_CXX_HAS_UTIMES} " -cmake_c_flags="${cmake_c_flags}-I`cmake_escape \"${cmake_bootstrap_dir}\"` -I`cmake_escape \"${cmake_source_dir}/Source\"` \ +cmake_c_flags="${cmake_c_flags} \ + -I`cmake_escape \"${cmake_bootstrap_dir}\"` \ + -I`cmake_escape \"${cmake_source_dir}/Source\"` \ + -I`cmake_escape \"${cmake_source_dir}/Source/LexerParser\"` \ -I`cmake_escape \"${cmake_source_dir}/Utilities\"`" -cmake_cxx_flags="${cmake_cxx_flags} -I`cmake_escape \"${cmake_bootstrap_dir}\"` -I`cmake_escape \"${cmake_source_dir}/Source\"` \ +cmake_cxx_flags="${cmake_cxx_flags} \ + -I`cmake_escape \"${cmake_bootstrap_dir}\"` \ + -I`cmake_escape \"${cmake_source_dir}/Source\"` \ + -I`cmake_escape \"${cmake_source_dir}/Source/LexerParser\"` \ -I`cmake_escape \"${cmake_source_dir}/Utilities\"`" echo "cmake: ${objs}" > "${cmake_bootstrap_dir}/Makefile" echo " ${cmake_cxx_compiler} ${cmake_ld_flags} ${cmake_cxx_flags} ${objs} -o cmake" >> "${cmake_bootstrap_dir}/Makefile" |