summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitattributes24
-rw-r--r--Help/command/execute_process.rst19
-rw-r--r--Help/manual/cmake-language.7.rst6
-rw-r--r--Help/manual/cmake-variables.7.rst1
-rw-r--r--Help/variable/CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES.rst7
-rw-r--r--Modules/CMakeCUDACompiler.cmake.in2
-rw-r--r--Modules/CMakeCUDACompilerABI.cu2
-rw-r--r--Modules/CMakeCUDAInformation.cmake6
-rw-r--r--Modules/CMakeDetermineCUDACompiler.cmake34
-rw-r--r--Modules/Compiler/NVIDIA-CUDA.cmake11
-rw-r--r--Modules/ExternalProject.cmake13
-rw-r--r--Modules/FindCUDA/select_compute_arch.cmake1
-rw-r--r--Modules/FindGTK2.cmake5
-rw-r--r--Modules/FindHDF5.cmake6
-rw-r--r--Modules/Platform/Windows-NVIDIA-CUDA.cmake14
-rw-r--r--Source/.gitattributes31
-rw-r--r--Source/CTest/cmCTestSVN.cxx5
-rw-r--r--Source/CursesDialog/form/.gitattributes1
-rw-r--r--Source/cmExecuteProcessCommand.cxx2
-rw-r--r--Source/cmFindLibraryCommand.cxx64
-rw-r--r--Source/cmGeneratorTarget.cxx2
-rw-r--r--Source/cmGlobalVisualStudio15Generator.cxx34
-rw-r--r--Source/cmGlobalVisualStudio15Generator.h4
-rw-r--r--Source/cmMakefile.cxx2
-rw-r--r--Source/cmMakefileTargetGenerator.cxx3
-rw-r--r--Source/cmNinjaTargetGenerator.cxx10
-rw-r--r--Source/cmQtAutoGenerators.cxx4
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx1
-rw-r--r--Tests/CompileFeatures/.gitattributes2
-rw-r--r--Tests/Cuda/.clang-format9
-rw-r--r--Tests/Cuda/CMakeLists.txt2
-rw-r--r--Tests/Cuda/Complex/CMakeLists.txt2
-rw-r--r--Tests/Cuda/Complex/dynamic.cu13
-rw-r--r--Tests/Cuda/Complex/file1.cu2
-rw-r--r--Tests/Cuda/Complex/file2.cu14
-rw-r--r--Tests/Cuda/Complex/file3.cu11
-rw-r--r--Tests/Cuda/Complex/mixed.cu6
-rw-r--r--Tests/Cuda/ConsumeCompileFeatures/main.cu8
-rw-r--r--Tests/Cuda/ObjectLibrary/static.cu6
-rw-r--r--Tests/Cuda/ProperLinkFlags/CMakeLists.txt2
-rw-r--r--Tests/Cuda/ProperLinkFlags/file1.cu2
-rw-r--r--Tests/Cuda/ToolkitInclude/CMakeLists.txt11
-rw-r--r--Tests/Cuda/ToolkitInclude/main.cpp8
-rw-r--r--Tests/Cuda/WithC/CMakeLists.txt12
-rw-r--r--Tests/Cuda/WithC/cuda.cu16
-rw-r--r--Tests/Cuda/WithC/main.c14
-rw-r--r--Tests/CudaOnly/.clang-format9
-rw-r--r--Tests/CudaOnly/EnableStandard/CMakeLists.txt11
-rw-r--r--Tests/CudaOnly/EnableStandard/main.cu6
-rw-r--r--Tests/CudaOnly/SeparateCompilation/CMakeLists.txt2
-rw-r--r--Tests/CudaOnly/SeparateCompilation/file1.cu2
-rw-r--r--Tests/CudaOnly/SeparateCompilation/file2.cu14
-rw-r--r--Tests/CudaOnly/SeparateCompilation/file3.cu11
-rw-r--r--Tests/CudaOnly/SeparateCompilation/file4.cu10
-rw-r--r--Tests/CudaOnly/SeparateCompilation/file5.cu10
-rw-r--r--Tests/CudaOnly/SeparateCompilation/main.cu2
-rw-r--r--Tests/CudaOnly/WithDefs/CMakeLists.txt2
-rw-r--r--Tests/CudaOnly/WithDefs/main.notcu28
-rw-r--r--Tests/ObjectLibrary/A/CMakeLists.txt1
-rw-r--r--Tests/PositionIndependentTargets/.gitattributes2
-rw-r--r--Tests/RunCMake/CommandLine/cmake_depends/.gitattributes2
-rw-r--r--Tests/RunCMake/GenerateExportHeader/reference/.gitattributes2
-rw-r--r--Tests/RunCMake/find_library/LibArchLink-stderr.txt2
-rw-r--r--Tests/RunCMake/find_library/LibArchLink.cmake24
-rw-r--r--Tests/RunCMake/find_library/RunCMakeTest.cmake3
-rw-r--r--Utilities/.gitattributes4
-rw-r--r--Utilities/KWIML/test/CMakeLists.txt2
-rwxr-xr-xUtilities/Scripts/clang-format.bash36
68 files changed, 449 insertions, 190 deletions
diff --git a/.gitattributes b/.gitattributes
index d959918..3829160 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1,6 +1,13 @@
.gitattributes export-ignore
.hooks* export-ignore
+# Custom attribute to mark sources as using our C code style.
+[attr]our-c-style whitespace=tab-in-indent format.clang-format
+
+# Custom attribute to mark sources as generated.
+# Do not perform whitespace checks. Do not format.
+[attr]generated whitespace=-tab-in-indent,-indent-with-non-tab -format.clang-format
+
bootstrap crlf=input
configure crlf=input
*.[1-9] crlf=input
@@ -16,10 +23,17 @@ configure crlf=input
*.sln -crlf
*.vcproj -crlf
-*.c whitespace=tab-in-indent
-*.h whitespace=tab-in-indent
-*.cxx whitespace=tab-in-indent
-*.txt whitespace=tab-in-indent
-*.cmake whitespace=tab-in-indent
+*.c our-c-style
+*.cc our-c-style
+*.cpp our-c-style
+*.cu our-c-style
+*.cxx our-c-style
+*.h our-c-style
+*.hh our-c-style
+*.hpp our-c-style
+*.hxx our-c-style
+*.notcu our-c-style
+*.cmake whitespace=tab-in-indent
*.rst whitespace=tab-in-indent conflict-marker-size=79
+*.txt whitespace=tab-in-indent
diff --git a/Help/command/execute_process.rst b/Help/command/execute_process.rst
index 71233d9..d617243 100644
--- a/Help/command/execute_process.rst
+++ b/Help/command/execute_process.rst
@@ -70,10 +70,21 @@ Options:
``ENCODING <name>``
On Windows, the encoding that is used to decode output from the process.
Ignored on other platforms.
- Valid encoding names are: ``AUTO`` (the default), ``NONE``, ``UTF8``,
- ``ANSI`` and ``OEM``.
- ``AUTO`` encoding means current active console's codepage will be used
- or if that isn't available then ``ANSI`` codepage will be used.
+ Valid encoding names are:
+
+ ``NONE``
+ Perform no decoding. This assumes that the process output is encoded
+ in the same way as CMake's internal encoding (UTF-8).
+ This is the default.
+ ``AUTO``
+ Use the current active console's codepage or if that isn't
+ available then use ANSI.
+ ``ANSI``
+ Use the ANSI codepage.
+ ``OEM``
+ Use the original equipment manufacturer (OEM) code page.
+ ``UTF8``
+ Use the UTF-8 codepage.
If more than one ``OUTPUT_*`` or ``ERROR_*`` option is given for the
same pipe the precedence is not specified.
diff --git a/Help/manual/cmake-language.7.rst b/Help/manual/cmake-language.7.rst
index ba0b30f..27b5d30 100644
--- a/Help/manual/cmake-language.7.rst
+++ b/Help/manual/cmake-language.7.rst
@@ -329,11 +329,17 @@ For example:
To support legacy CMake code, unquoted arguments may also contain
double-quoted strings (``"..."``, possibly enclosing horizontal
whitespace), and make-style variable references (``$(MAKEVAR)``).
+
Unescaped double-quotes must balance, may not appear at the
beginning of an unquoted argument, and are treated as part of the
content. For example, the unquoted arguments ``-Da="b c"``,
``-Da=$(v)``, and ``a" "b"c"d`` are each interpreted literally.
+ Make-style references are treated literally as part of the content
+ and do not undergo variable expansion. They are treated as part
+ of a single argument (rather than as separate ``$``, ``(``,
+ ``MAKEVAR``, and ``)`` arguments).
+
The above "unquoted_legacy" production represents such arguments.
We do not recommend using legacy unquoted arguments in new code.
Instead use a `Quoted Argument`_ or a `Bracket Argument`_ to
diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst
index 95f780a..38444d1 100644
--- a/Help/manual/cmake-variables.7.rst
+++ b/Help/manual/cmake-variables.7.rst
@@ -353,6 +353,7 @@ Variables for Languages
/variable/CMAKE_CUDA_EXTENSIONS
/variable/CMAKE_CUDA_STANDARD
/variable/CMAKE_CUDA_STANDARD_REQUIRED
+ /variable/CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES
/variable/CMAKE_CXX_COMPILE_FEATURES
/variable/CMAKE_CXX_EXTENSIONS
/variable/CMAKE_CXX_STANDARD
diff --git a/Help/variable/CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES.rst b/Help/variable/CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES.rst
new file mode 100644
index 0000000..768f571
--- /dev/null
+++ b/Help/variable/CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES.rst
@@ -0,0 +1,7 @@
+CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES
+--------------------------------------
+
+When the ``CUDA`` language has been enabled, this provides a
+:ref:`;-list <CMake Language Lists>` of include directories provided
+by the CUDA Toolkit. The value may be useful for C++ source files
+to include CUDA headers.
diff --git a/Modules/CMakeCUDACompiler.cmake.in b/Modules/CMakeCUDACompiler.cmake.in
index 158d12b..f524e5f 100644
--- a/Modules/CMakeCUDACompiler.cmake.in
+++ b/Modules/CMakeCUDACompiler.cmake.in
@@ -16,6 +16,8 @@ set(CMAKE_CUDA_SOURCE_FILE_EXTENSIONS cu)
set(CMAKE_CUDA_LINKER_PREFERENCE 15)
set(CMAKE_CUDA_LINKER_PREFERENCE_PROPAGATES 1)
+set(CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES "@CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES@")
+
set(CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES "@CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES@")
set(CMAKE_CUDA_HOST_IMPLICIT_LINK_DIRECTORIES "@CMAKE_CUDA_HOST_IMPLICIT_LINK_DIRECTORIES@")
set(CMAKE_CUDA_HOST_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "@CMAKE_CUDA_HOST_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES@")
diff --git a/Modules/CMakeCUDACompilerABI.cu b/Modules/CMakeCUDACompilerABI.cu
index 5aa1b8a..99bacef 100644
--- a/Modules/CMakeCUDACompilerABI.cu
+++ b/Modules/CMakeCUDACompilerABI.cu
@@ -1,5 +1,5 @@
#ifndef __CUDACC__
-# error "A C or C++ compiler has been selected for CUDA"
+#error "A C or C++ compiler has been selected for CUDA"
#endif
#include "CMakeCompilerABI.h"
diff --git a/Modules/CMakeCUDAInformation.cmake b/Modules/CMakeCUDAInformation.cmake
index 13b1789..1c48159 100644
--- a/Modules/CMakeCUDAInformation.cmake
+++ b/Modules/CMakeCUDAInformation.cmake
@@ -93,6 +93,12 @@ if(NOT CMAKE_NOT_USING_CONFIG_FLAGS)
endif()
+if(CMAKE_CUDA_STANDARD_LIBRARIES_INIT)
+ set(CMAKE_CUDA_STANDARD_LIBRARIES "${CMAKE_CUDA_STANDARD_LIBRARIES_INIT}"
+ CACHE STRING "Libraries linked by default with all CUDA applications.")
+ mark_as_advanced(CMAKE_CUDA_STANDARD_LIBRARIES)
+endif()
+
include(CMakeCommonLanguageInclude)
# now define the following rules:
diff --git a/Modules/CMakeDetermineCUDACompiler.cmake b/Modules/CMakeDetermineCUDACompiler.cmake
index bef6d0e..7b6d17b 100644
--- a/Modules/CMakeDetermineCUDACompiler.cmake
+++ b/Modules/CMakeDetermineCUDACompiler.cmake
@@ -84,20 +84,20 @@ endif()
#the compiler with cuda-fake-ld and pass too CMAKE_PARSE_IMPLICIT_LINK_INFO
if(CMAKE_CUDA_COMPILER_ID STREQUAL NVIDIA)
set(_nvcc_log "")
- string(REPLACE "\r" "" _nvcc_output "${CMAKE_CUDA_COMPILER_PRODUCED_OUTPUT}")
- if(_nvcc_output MATCHES "#\\\$ +LIBRARIES= *([^\n]*)\n")
+ string(REPLACE "\r" "" _nvcc_output_orig "${CMAKE_CUDA_COMPILER_PRODUCED_OUTPUT}")
+ if(_nvcc_output_orig MATCHES "#\\\$ +LIBRARIES= *([^\n]*)\n")
set(_nvcc_libraries "${CMAKE_MATCH_1}")
string(APPEND _nvcc_log " found 'LIBRARIES=' string: [${_nvcc_libraries}]\n")
else()
set(_nvcc_libraries "")
- string(REPLACE "\n" "\n " _nvcc_output_log "\n${_nvcc_output}")
+ string(REPLACE "\n" "\n " _nvcc_output_log "\n${_nvcc_output_orig}")
string(APPEND _nvcc_log " no 'LIBRARIES=' string found in nvcc output:${_nvcc_output_log}\n")
endif()
set(_nvcc_link_line "")
if(_nvcc_libraries)
# Remove variable assignments.
- string(REGEX REPLACE "#\\\$ *[^= ]+=[^\n]*\n" "" _nvcc_output "${_nvcc_output}")
+ string(REGEX REPLACE "#\\\$ *[^= ]+=[^\n]*\n" "" _nvcc_output "${_nvcc_output_orig}")
# Split lines.
string(REGEX REPLACE "\n+(#\\\$ )?" ";" _nvcc_output "${_nvcc_output}")
foreach(line IN LISTS _nvcc_output)
@@ -150,6 +150,32 @@ if(CMAKE_CUDA_COMPILER_ID STREQUAL NVIDIA)
message(FATAL_ERROR "Failed to extract nvcc implicit link line.")
endif()
+ set(CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES )
+ if(_nvcc_output_orig MATCHES "#\\\$ +INCLUDES= *([^\n]*)\n")
+ set(_nvcc_includes "${CMAKE_MATCH_1}")
+ string(APPEND _nvcc_log " found 'INCLUDES=' string: [${_nvcc_includes}]\n")
+ else()
+ set(_nvcc_includes "")
+ string(REPLACE "\n" "\n " _nvcc_output_log "\n${_nvcc_output_orig}")
+ string(APPEND _nvcc_log " no 'INCLUDES=' string found in nvcc output:${_nvcc_output_log}\n")
+ endif()
+ if(_nvcc_includes)
+ # across all operating system each include directory is prefixed with -I
+ separate_arguments(_nvcc_output UNIX_COMMAND "${_nvcc_includes}")
+ foreach(line IN LISTS _nvcc_output)
+ string(REGEX REPLACE "^-I" "" line "${line}")
+ get_filename_component(line "${line}" ABSOLUTE)
+ list(APPEND CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES "${line}")
+ endforeach()
+
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "Parsed CUDA nvcc include information from above output:\n${_nvcc_log}\n${log}\n\n")
+ else()
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "Failed to detect CUDA nvcc include information:\n${_nvcc_log}\n\n")
+ endif()
+
+
endif()
# configure all variables set in this file
diff --git a/Modules/Compiler/NVIDIA-CUDA.cmake b/Modules/Compiler/NVIDIA-CUDA.cmake
index ae35132..316cab8 100644
--- a/Modules/Compiler/NVIDIA-CUDA.cmake
+++ b/Modules/Compiler/NVIDIA-CUDA.cmake
@@ -7,16 +7,15 @@ if(NOT "x${CMAKE_CUDA_SIMULATE_ID}" STREQUAL "xMSVC")
# CMAKE_SHARED_LIBRARY_CUDA_FLAGS is sent to the host linker so we
# don't need to forward it through nvcc.
set(CMAKE_SHARED_LIBRARY_CUDA_FLAGS -fPIC)
+ string(APPEND CMAKE_CUDA_FLAGS_INIT " ")
+ string(APPEND CMAKE_CUDA_FLAGS_DEBUG_INIT " -g")
+ string(APPEND CMAKE_CUDA_FLAGS_RELEASE_INIT " -O3 -DNDEBUG")
+ string(APPEND CMAKE_CUDA_FLAGS_MINSIZEREL_INIT " -O1 -DNDEBUG")
+ string(APPEND CMAKE_CUDA_FLAGS_RELWITHDEBINFO_INIT " -O2 -g -DNDEBUG")
endif()
set(CMAKE_SHARED_LIBRARY_CREATE_CUDA_FLAGS -shared)
set(CMAKE_INCLUDE_SYSTEM_FLAG_CUDA -isystem=)
-string(APPEND CMAKE_CUDA_FLAGS_INIT " ")
-string(APPEND CMAKE_CUDA_FLAGS_DEBUG_INIT " -g")
-string(APPEND CMAKE_CUDA_FLAGS_MINSIZEREL_INIT " -Os -DNDEBUG")
-string(APPEND CMAKE_CUDA_FLAGS_RELEASE_INIT " -O3 -DNDEBUG")
-string(APPEND CMAKE_CUDA_FLAGS_RELWITHDEBINFO_INIT " -O2 -g -DNDEBUG")
-
if("x${CMAKE_CUDA_SIMULATE_ID}" STREQUAL "xMSVC")
set(CMAKE_CUDA_STANDARD_DEFAULT "")
else()
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index 458c114..00781d6 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -174,9 +174,16 @@ Create custom targets to build projects in external trees
Install step options are:
``INSTALL_DIR <dir>``
- Installation prefix
+ Installation prefix to be placed in the ``<INSTALL_DIR>`` placeholder.
+ This does not actually configure the external project to install to
+ the given prefix. That must be done by passing appropriate arguments
+ to the external project configuration step, e.g. using ``<INSTALL_DIR>``.
``INSTALL_COMMAND <cmd>...``
- Command to drive install after build
+ Command to drive installation of the external project after it has been
+ built. This only happens at the *build* time of the calling project.
+ In order to install files from the external project alongside the
+ locally-built files, a separate local :command:`install` call must be
+ added to pick the files up from one of the external project trees.
Test step options are:
@@ -594,7 +601,7 @@ if(error_code)
endif()
execute_process(
- COMMAND \"${git_EXECUTABLE}\" \${git_options} checkout ${git_tag}
+ COMMAND \"${git_EXECUTABLE}\" \${git_options} checkout ${git_tag} --
WORKING_DIRECTORY \"${work_dir}/${src_name}\"
RESULT_VARIABLE error_code
)
diff --git a/Modules/FindCUDA/select_compute_arch.cmake b/Modules/FindCUDA/select_compute_arch.cmake
index a96a8ca..8fb44d8 100644
--- a/Modules/FindCUDA/select_compute_arch.cmake
+++ b/Modules/FindCUDA/select_compute_arch.cmake
@@ -112,6 +112,7 @@ function(CUDA_SELECT_NVCC_ARCH_FLAGS out_variable)
list(REMOVE_DUPLICATES CUDA_ARCH_LIST)
foreach(arch_name ${CUDA_ARCH_LIST})
set(arch_bin)
+ set(arch_ptx)
set(add_ptx FALSE)
# Check to see if we are compiling PTX
if(arch_name MATCHES "(.*)\\+PTX$")
diff --git a/Modules/FindGTK2.cmake b/Modules/FindGTK2.cmake
index 6747be5..20d7924 100644
--- a/Modules/FindGTK2.cmake
+++ b/Modules/FindGTK2.cmake
@@ -223,7 +223,10 @@ function(_GTK2_SIGCXX_GET_VERSION _OUT_major _OUT_minor _OUT_micro _sigcxxversio
set(${_OUT_minor} ${${_OUT_minor}} PARENT_SCOPE)
set(${_OUT_micro} ${${_OUT_micro}} PARENT_SCOPE)
else()
- message(FATAL_ERROR "Include file ${_gtkversion_hdr} does not exist")
+ # The header does not have the version macros; assume it is ``0.0.0``.
+ set(${_OUT_major} 0)
+ set(${_OUT_minor} 0)
+ set(${_OUT_micro} 0)
endif()
endfunction()
diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake
index e1199a7..65a825d 100644
--- a/Modules/FindHDF5.cmake
+++ b/Modules/FindHDF5.cmake
@@ -666,9 +666,9 @@ if( NOT HDF5_FOUND )
foreach(__lang IN LISTS HDF5_LANGUAGE_BINDINGS)
# find the HDF5 include directories
- if(LANGUAGE STREQUAL "Fortran")
+ if("${__lang}" STREQUAL "Fortran")
set(HDF5_INCLUDE_FILENAME hdf5.mod)
- elseif(LANGUAGE STREQUAL "CXX")
+ elseif("${__lang}" STREQUAL "CXX")
set(HDF5_INCLUDE_FILENAME H5Cpp.h)
else()
set(HDF5_INCLUDE_FILENAME hdf5.h)
@@ -680,7 +680,7 @@ if( NOT HDF5_FOUND )
PATH_SUFFIXES include Include
${_HDF5_SEARCH_OPTS}
)
- mark_as_advanced(HDF5_${LANGUAGE}_INCLUDE_DIR)
+ mark_as_advanced(HDF5_${__lang}_INCLUDE_DIR)
list(APPEND HDF5_INCLUDE_DIRS ${HDF5_${__lang}_INCLUDE_DIR})
# find the HDF5 libraries
diff --git a/Modules/Platform/Windows-NVIDIA-CUDA.cmake b/Modules/Platform/Windows-NVIDIA-CUDA.cmake
index 809ee06..845fa4b 100644
--- a/Modules/Platform/Windows-NVIDIA-CUDA.cmake
+++ b/Modules/Platform/Windows-NVIDIA-CUDA.cmake
@@ -35,8 +35,12 @@ set(CMAKE_CUDA_DEVICE_LINK_LIBRARY
set(CMAKE_CUDA_DEVICE_LINK_EXECUTABLE
"<CMAKE_CUDA_COMPILER> <FLAGS> <CMAKE_CUDA_LINK_FLAGS> -shared -dlink <OBJECTS> -o <TARGET> <LINK_LIBRARIES> -Xcompiler=-Fd<TARGET_COMPILE_PDB>,-FS")
-string(APPEND CMAKE_CUDA_FLAGS_INIT " -Xcompiler=-GR,-EHsc")
-string(APPEND CMAKE_CUDA_FLAGS_DEBUG_INIT " -Xcompiler=-MDd,-Zi,-RTC1")
-string(APPEND CMAKE_CUDA_FLAGS_RELEASE_INIT " -Xcompiler=-MD")
-string(APPEND CMAKE_CUDA_FLAGS_RELWITHDEBINFO_INIT " -Xcompiler=-MD")
-string(APPEND CMAKE_CUDA_FLAGS_MINSIZEREL_INIT " -Xcompiler=-MD")
+string(REPLACE "/D" "-D" _PLATFORM_DEFINES_CUDA "${_PLATFORM_DEFINES}${_PLATFORM_DEFINES_CXX}")
+
+string(APPEND CMAKE_CUDA_FLAGS_INIT " ${PLATFORM_DEFINES_CUDA} -D_WINDOWS -Xcompiler=\"/W3${_FLAGS_CXX}\"")
+string(APPEND CMAKE_CUDA_FLAGS_DEBUG_INIT " -Xcompiler=\"-MDd -Zi -Ob0 -Od ${_RTC1}\"")
+string(APPEND CMAKE_CUDA_FLAGS_RELEASE_INIT " -Xcompiler=\"-MD -O2 -Ob2\" -DNDEBUG")
+string(APPEND CMAKE_CUDA_FLAGS_RELWITHDEBINFO_INIT " -Xcompiler=\"-MD -Zi -O2 -Ob1\" -DNDEBUG")
+string(APPEND CMAKE_CUDA_FLAGS_MINSIZEREL_INIT " -Xcompiler=\"-MD -O1 -Ob1\" -DNDEBUG")
+
+set(CMAKE_CUDA_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}")
diff --git a/Source/.gitattributes b/Source/.gitattributes
index dbd6382..1cec8a3 100644
--- a/Source/.gitattributes
+++ b/Source/.gitattributes
@@ -1,10 +1,21 @@
-# Preserve indentation style in generated code.
-cmCommandArgumentLexer.cxx whitespace=-tab-in-indent,-indent-with-non-tab
-cmCommandArgumentLexer.h whitespace=-tab-in-indent,-indent-with-non-tab
-cmDependsJavaLexer.cxx whitespace=-tab-in-indent,-indent-with-non-tab
-cmDependsJavaLexer.h whitespace=-tab-in-indent,-indent-with-non-tab
-cmExprLexer.cxx whitespace=-tab-in-indent,-indent-with-non-tab
-cmExprLexer.h whitespace=-tab-in-indent,-indent-with-non-tab
-cmFortranLexer.cxx whitespace=-tab-in-indent,-indent-with-non-tab
-cmFortranLexer.h whitespace=-tab-in-indent,-indent-with-non-tab
-cmListFileLexer.c whitespace=-tab-in-indent,-indent-with-non-tab
+/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.
+/bindexplib.* -format.clang-format
+/kwsys/** -format.clang-format
diff --git a/Source/CTest/cmCTestSVN.cxx b/Source/CTest/cmCTestSVN.cxx
index fc405ca..410e0d4 100644
--- a/Source/CTest/cmCTestSVN.cxx
+++ b/Source/CTest/cmCTestSVN.cxx
@@ -523,8 +523,11 @@ private:
void cmCTestSVN::LoadRepositories()
{
+ if (!this->Repositories.empty()) {
+ return;
+ }
+
// Info for root repository
- this->Repositories.clear();
this->Repositories.push_back(SVNInfo(""));
this->RootInfo = &(this->Repositories.back());
diff --git a/Source/CursesDialog/form/.gitattributes b/Source/CursesDialog/form/.gitattributes
new file mode 100644
index 0000000..62d728c
--- /dev/null
+++ b/Source/CursesDialog/form/.gitattributes
@@ -0,0 +1 @@
+* -format.clang-format
diff --git a/Source/cmExecuteProcessCommand.cxx b/Source/cmExecuteProcessCommand.cxx
index eb26a50..92cdf64 100644
--- a/Source/cmExecuteProcessCommand.cxx
+++ b/Source/cmExecuteProcessCommand.cxx
@@ -47,7 +47,7 @@ bool cmExecuteProcessCommand::InitialPass(std::vector<std::string> const& args,
std::string error_variable;
std::string result_variable;
std::string working_directory;
- cmProcessOutput::Encoding encoding = cmProcessOutput::Auto;
+ cmProcessOutput::Encoding encoding = cmProcessOutput::None;
for (size_t i = 0; i < args.size(); ++i) {
if (args[i] == "COMMAND") {
doing_command = true;
diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx
index 2feedf3..c86f9c1 100644
--- a/Source/cmFindLibraryCommand.cxx
+++ b/Source/cmFindLibraryCommand.cxx
@@ -84,36 +84,68 @@ void cmFindLibraryCommand::AddArchitecturePaths(const char* suffix)
}
}
+static bool cmLibDirsLinked(std::string const& l, std::string const& r)
+{
+ // Compare the real paths of the two directories.
+ // Since our caller only changed the trailing component of each
+ // directory, the real paths can be the same only if at least one of
+ // the trailing components is a symlink. Use this as an optimization
+ // to avoid excessive realpath calls.
+ return (cmSystemTools::FileIsSymlink(l) ||
+ cmSystemTools::FileIsSymlink(r)) &&
+ cmSystemTools::GetRealPath(l) == cmSystemTools::GetRealPath(r);
+}
+
void cmFindLibraryCommand::AddArchitecturePath(
std::string const& dir, std::string::size_type start_pos, const char* suffix,
bool fresh)
{
std::string::size_type pos = dir.find("lib/", start_pos);
+
if (pos != std::string::npos) {
- std::string cur_dir = dir.substr(0, pos + 3);
-
- // Follow "lib<suffix>".
- std::string next_dir = cur_dir + suffix;
- if (cmSystemTools::FileIsDirectory(next_dir)) {
- next_dir += dir.substr(pos + 3);
- std::string::size_type next_pos = pos + 3 + strlen(suffix) + 1;
- this->AddArchitecturePath(next_dir, next_pos, suffix);
+ // Check for "lib".
+ std::string lib = dir.substr(0, pos + 3);
+ bool use_lib = cmSystemTools::FileIsDirectory(lib);
+
+ // Check for "lib<suffix>" and use it first.
+ std::string libX = lib + suffix;
+ bool use_libX = cmSystemTools::FileIsDirectory(libX);
+
+ // Avoid copies of the same directory due to symlinks.
+ if (use_libX && use_lib && cmLibDirsLinked(libX, lib)) {
+ use_libX = false;
}
- // Follow "lib".
- if (cmSystemTools::FileIsDirectory(cur_dir)) {
+ if (use_libX) {
+ libX += dir.substr(pos + 3);
+ std::string::size_type libX_pos = pos + 3 + strlen(suffix) + 1;
+ this->AddArchitecturePath(libX, libX_pos, suffix);
+ }
+
+ if (use_lib) {
this->AddArchitecturePath(dir, pos + 3 + 1, suffix, false);
}
}
+
if (fresh) {
- // Check for <dir><suffix>/.
- std::string cur_dir = dir + suffix + "/";
- if (cmSystemTools::FileIsDirectory(cur_dir)) {
- this->SearchPaths.push_back(cur_dir);
+ // Check for the original unchanged path.
+ bool use_dir = cmSystemTools::FileIsDirectory(dir);
+
+ // Check for <dir><suffix>/ and use it first.
+ std::string dirX = dir + suffix;
+ bool use_dirX = cmSystemTools::FileIsDirectory(dirX);
+
+ // Avoid copies of the same directory due to symlinks.
+ if (use_dirX && use_dir && cmLibDirsLinked(dirX, dir)) {
+ use_dirX = false;
+ }
+
+ if (use_dirX) {
+ dirX += "/";
+ this->SearchPaths.push_back(dirX);
}
- // Now add the original unchanged path
- if (cmSystemTools::FileIsDirectory(dir)) {
+ if (use_dir) {
this->SearchPaths.push_back(dir);
}
}
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 6ce8140..3fe5c83 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -1147,7 +1147,7 @@ std::string cmGeneratorTarget::GetCompilePDBPath(
{
std::string dir = this->GetCompilePDBDirectory(config);
std::string name = this->GetCompilePDBName(config);
- if (dir.empty() && !name.empty()) {
+ if (dir.empty() && !name.empty() && this->HaveWellDefinedOutputFiles()) {
dir = this->GetPDBDirectory(config);
}
if (!dir.empty()) {
diff --git a/Source/cmGlobalVisualStudio15Generator.cxx b/Source/cmGlobalVisualStudio15Generator.cxx
index d11ee7c..2312bc0 100644
--- a/Source/cmGlobalVisualStudio15Generator.cxx
+++ b/Source/cmGlobalVisualStudio15Generator.cxx
@@ -109,6 +109,18 @@ void cmGlobalVisualStudio15Generator::WriteSLNHeader(std::ostream& fout)
}
}
+bool cmGlobalVisualStudio15Generator::InitializeWindows(cmMakefile* mf)
+{
+ // If the Win 8.1 SDK is installed then we can select a SDK matching
+ // the target Windows version.
+ if (this->IsWin81SDKInstalled()) {
+ return cmGlobalVisualStudio14Generator::InitializeWindows(mf);
+ }
+ // Otherwise we must choose a Win 10 SDK even if we are not targeting
+ // Windows 10.
+ return this->SelectWindows10SDK(mf, false);
+}
+
bool cmGlobalVisualStudio15Generator::SelectWindowsStoreToolset(
std::string& toolset) const
{
@@ -135,6 +147,28 @@ bool cmGlobalVisualStudio15Generator::IsWindowsStoreToolsetInstalled() const
return vsSetupAPIHelper.IsWin10SDKInstalled();
}
+bool cmGlobalVisualStudio15Generator::IsWin81SDKInstalled() const
+{
+ // Does the VS installer tool know about one?
+ if (vsSetupAPIHelper.IsWin81SDKInstalled()) {
+ return true;
+ }
+
+ // Does the registry know about one (e.g. from VS 2015)?
+ std::string win81Root;
+ if (cmSystemTools::ReadRegistryValue(
+ "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\"
+ "Windows Kits\\Installed Roots;KitsRoot81",
+ win81Root, cmSystemTools::KeyWOW64_32) ||
+ cmSystemTools::ReadRegistryValue(
+ "HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\"
+ "Windows Kits\\Installed Roots;KitsRoot81",
+ win81Root, cmSystemTools::KeyWOW64_32)) {
+ return true;
+ }
+ return false;
+}
+
std::string cmGlobalVisualStudio15Generator::FindMSBuildCommand()
{
std::string msbuild;
diff --git a/Source/cmGlobalVisualStudio15Generator.h b/Source/cmGlobalVisualStudio15Generator.h
index 781b41e..f979b65 100644
--- a/Source/cmGlobalVisualStudio15Generator.h
+++ b/Source/cmGlobalVisualStudio15Generator.h
@@ -28,6 +28,7 @@ public:
virtual const char* GetToolsVersion() { return "15.0"; }
protected:
+ bool InitializeWindows(cmMakefile* mf) CM_OVERRIDE;
virtual bool SelectWindowsStoreToolset(std::string& toolset) const;
virtual const char* GetIDEVersion() { return "15.0"; }
@@ -40,6 +41,9 @@ protected:
// of the toolset is installed
bool IsWindowsStoreToolsetInstalled() const;
+ // Check for a Win 8 SDK known to the registry or VS installer tool.
+ bool IsWin81SDKInstalled() const;
+
std::string FindMSBuildCommand() CM_OVERRIDE;
std::string FindDevEnvCommand() CM_OVERRIDE;
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index bfe46ae..1e995fb 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -3362,7 +3362,7 @@ std::string cmMakefile::GetModulesFile(const char* filename) const
if (!moduleInCMakeModulePath.empty() && !moduleInCMakeRoot.empty()) {
const char* currentFile = this->GetDefinition("CMAKE_CURRENT_LIST_FILE");
std::string mods = cmSystemTools::GetCMakeRoot() + "/Modules/";
- if (currentFile && strncmp(currentFile, mods.c_str(), mods.size()) == 0) {
+ if (currentFile && cmSystemTools::IsSubDirectory(currentFile, mods)) {
switch (this->GetPolicyStatus(cmPolicies::CMP0017)) {
case cmPolicies::WARN: {
std::ostringstream e;
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 866c132..54b3f36 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -590,7 +590,8 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
std::vector<std::string> compileCommands;
if (lang == "CUDA") {
std::string cmdVar;
- if (this->GeneratorTarget->GetProperty("CUDA_SEPARABLE_COMPILATION")) {
+ if (this->GeneratorTarget->GetPropertyAsBool(
+ "CUDA_SEPARABLE_COMPILATION")) {
cmdVar = std::string("CMAKE_CUDA_COMPILE_SEPARABLE_COMPILATION");
} else {
cmdVar = std::string("CMAKE_CUDA_COMPILE_WHOLE_COMPILATION");
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 0b33b19..b1f26e4 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -385,7 +385,7 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang)
vars.CMTargetType =
cmState::GetTargetTypeName(this->GetGeneratorTarget()->GetType());
vars.Language = lang.c_str();
- vars.Source = "$IN_ABS";
+ vars.Source = "$in";
vars.Object = "$out";
vars.Defines = "$DEFINES";
vars.Includes = "$INCLUDES";
@@ -580,7 +580,8 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang)
std::vector<std::string> compileCmds;
if (lang == "CUDA") {
std::string cmdVar;
- if (this->GeneratorTarget->GetProperty("CUDA_SEPARABLE_COMPILATION")) {
+ if (this->GeneratorTarget->GetPropertyAsBool(
+ "CUDA_SEPARABLE_COMPILATION")) {
cmdVar = std::string("CMAKE_CUDA_COMPILE_SEPARABLE_COMPILATION");
} else {
cmdVar = std::string("CMAKE_CUDA_COMPILE_WHOLE_COMPILATION");
@@ -772,7 +773,8 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
cmSourceFile const* source, bool writeOrderDependsTargetForTarget)
{
std::string const language = source->GetLanguage();
- std::string const sourceFileName = this->GetSourceFilePath(source);
+ std::string const sourceFileName =
+ language == "RC" ? source->GetFullPath() : this->GetSourceFilePath(source);
std::string const objectDir =
this->ConvertToNinjaPath(this->GeneratorTarget->GetSupportDirectory());
std::string const objectFileName =
@@ -781,8 +783,6 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement(
cmSystemTools::GetFilenamePath(objectFileName);
cmNinjaVars vars;
- vars["IN_ABS"] = this->GetLocalGenerator()->ConvertToOutputFormat(
- source->GetFullPath(), cmOutputConverter::SHELL);
vars["FLAGS"] = this->ComputeFlagsForObject(source, language);
vars["DEFINES"] = this->ComputeDefines(source, language);
vars["INCLUDES"] = this->GetIncludes(language);
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index c84fe4f..1d6972b 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -655,10 +655,10 @@ bool cmQtAutoGenerators::RunAutogen(cmMakefile* makefile)
it != this->Headers.end(); ++it) {
const std::string& headerName = *it;
if (!this->MocSkipTest(headerName)) {
- headerFilesMoc.insert(this->Headers.begin(), this->Headers.end());
+ headerFilesMoc.insert(headerName);
}
if (!this->UicSkipTest(headerName)) {
- headerFilesUic.insert(this->Headers.begin(), this->Headers.end());
+ headerFilesUic.insert(headerName);
}
}
this->ParseHeaders(headerFilesMoc, headerFilesUic, includedMocs,
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 1ac2951..7447821 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -130,6 +130,7 @@ void cmVisualStudio10TargetGenerator::WritePlatformConfigTag(
}
stream->fill(' ');
stream->width(indentLevel * 2);
+ (*stream) << ""; // applies indentation
(*stream) << "<" << tag << " Condition=\"";
(*stream) << "'$(Configuration)|$(Platform)'=='";
(*stream) << config << "|" << this->Platform;
diff --git a/Tests/CompileFeatures/.gitattributes b/Tests/CompileFeatures/.gitattributes
new file mode 100644
index 0000000..83da28d
--- /dev/null
+++ b/Tests/CompileFeatures/.gitattributes
@@ -0,0 +1,2 @@
+# Do not format a source containing C++11 '>>' syntax as C++98.
+cxx_right_angle_brackets.cpp -format.clang-format
diff --git a/Tests/Cuda/.clang-format b/Tests/Cuda/.clang-format
new file mode 100644
index 0000000..a77589a
--- /dev/null
+++ b/Tests/Cuda/.clang-format
@@ -0,0 +1,9 @@
+---
+# This configuration requires clang-format 3.8 or higher.
+BasedOnStyle: Mozilla
+AlignOperands: false
+AlwaysBreakAfterReturnType: None
+AlwaysBreakAfterDefinitionReturnType: None
+ColumnLimit: 79
+Standard: Cpp11
+...
diff --git a/Tests/Cuda/CMakeLists.txt b/Tests/Cuda/CMakeLists.txt
index 40c9675..de48501 100644
--- a/Tests/Cuda/CMakeLists.txt
+++ b/Tests/Cuda/CMakeLists.txt
@@ -2,4 +2,6 @@
ADD_TEST_MACRO(Cuda.Complex CudaComplex)
ADD_TEST_MACRO(Cuda.ConsumeCompileFeatures CudaConsumeCompileFeatures)
ADD_TEST_MACRO(Cuda.ObjectLibrary CudaObjectLibrary)
+ADD_TEST_MACRO(Cuda.ToolkitInclude CudaToolkitInclude)
ADD_TEST_MACRO(Cuda.ProperLinkFlags ProperLinkFlags)
+ADD_TEST_MACRO(Cuda.WithC CudaWithC)
diff --git a/Tests/Cuda/Complex/CMakeLists.txt b/Tests/Cuda/Complex/CMakeLists.txt
index 9a3703a..bff7d07 100644
--- a/Tests/Cuda/Complex/CMakeLists.txt
+++ b/Tests/Cuda/Complex/CMakeLists.txt
@@ -15,7 +15,7 @@ project (CudaComplex CXX CUDA)
#and also bulding cpp targets that need cuda implicit libraries
#verify that we can pass explicit cuda arch flags
-set(CMAKE_CUDA_FLAGS "-gencode arch=compute_30,code=compute_30")
+string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_30,code=compute_30")
set(CMAKE_CUDA_STANDARD 11)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CUDA_STANDARD_REQUIRED TRUE)
diff --git a/Tests/Cuda/Complex/dynamic.cu b/Tests/Cuda/Complex/dynamic.cu
index a23dc25..82255c5 100644
--- a/Tests/Cuda/Complex/dynamic.cu
+++ b/Tests/Cuda/Complex/dynamic.cu
@@ -1,7 +1,7 @@
-#include <string>
#include <cuda.h>
#include <iostream>
+#include <string>
#ifdef _WIN32
#define EXPORT __declspec(dllexport)
@@ -16,18 +16,15 @@ EXPORT int __host__ cuda_dynamic_host_func(int x)
return dynamic_base_func(x);
}
-static
-__global__
-void DetermineIfValidCudaDevice()
+static __global__ void DetermineIfValidCudaDevice()
{
}
EXPORT void cuda_dynamic_lib_func()
{
- DetermineIfValidCudaDevice <<<1,1>>> ();
+ DetermineIfValidCudaDevice<<<1, 1>>>();
cudaError_t err = cudaGetLastError();
- if(err == cudaSuccess)
- {
+ if (err == cudaSuccess) {
std::cerr << cudaGetErrorString(err) << std::endl;
- }
+ }
}
diff --git a/Tests/Cuda/Complex/file1.cu b/Tests/Cuda/Complex/file1.cu
index a2e8bf3..1ce63bf 100644
--- a/Tests/Cuda/Complex/file1.cu
+++ b/Tests/Cuda/Complex/file1.cu
@@ -5,6 +5,6 @@ result_type __device__ file1_func(int x)
{
result_type r;
r.input = x;
- r.sum = x*x;
+ r.sum = x * x;
return r;
}
diff --git a/Tests/Cuda/Complex/file2.cu b/Tests/Cuda/Complex/file2.cu
index 6b8b06b..74f3558 100644
--- a/Tests/Cuda/Complex/file2.cu
+++ b/Tests/Cuda/Complex/file2.cu
@@ -5,16 +5,12 @@ result_type __device__ file1_func(int x);
result_type_dynamic __device__ file2_func(int x)
{
- if(x!=42)
- {
+ if (x != 42) {
const result_type r = file1_func(x);
- const result_type_dynamic rd { r.input, r.sum, true };
+ const result_type_dynamic rd{ r.input, r.sum, true };
return rd;
- }
- else
- {
- const result_type_dynamic rd { x, x*x*x, false };
+ } else {
+ const result_type_dynamic rd{ x, x * x * x, false };
return rd;
- }
-
+ }
}
diff --git a/Tests/Cuda/Complex/file3.cu b/Tests/Cuda/Complex/file3.cu
index 47e64c5..7c37d66 100644
--- a/Tests/Cuda/Complex/file3.cu
+++ b/Tests/Cuda/Complex/file3.cu
@@ -7,9 +7,7 @@
result_type __device__ file1_func(int x);
result_type_dynamic __device__ file2_func(int x);
-static
-__global__
-void file3_kernel(result_type& r, int x)
+static __global__ void file3_kernel(result_type& r, int x)
{
r = file1_func(x);
result_type_dynamic rd = file2_func(x);
@@ -18,12 +16,11 @@ void file3_kernel(result_type& r, int x)
int file3_launch_kernel(int x)
{
result_type r;
- file3_kernel <<<1,1>>> (r,x);
+ file3_kernel<<<1, 1>>>(r, x);
cudaError_t err = cudaGetLastError();
- if(err == cudaSuccess)
- {
+ if (err == cudaSuccess) {
std::cerr << cudaGetErrorString(err) << std::endl;
return x;
- }
+ }
return r.sum;
}
diff --git a/Tests/Cuda/Complex/mixed.cu b/Tests/Cuda/Complex/mixed.cu
index 7051de0..4bba07c 100644
--- a/Tests/Cuda/Complex/mixed.cu
+++ b/Tests/Cuda/Complex/mixed.cu
@@ -17,9 +17,7 @@ result_type_dynamic __device__ file2_func(int x);
IMPORT void __host__ cuda_dynamic_lib_func();
-static
-__global__
-void mixed_kernel(result_type& r, int x)
+static __global__ void mixed_kernel(result_type& r, int x)
{
r = file1_func(x);
result_type_dynamic rd = file2_func(x);
@@ -30,6 +28,6 @@ EXPORT int mixed_launch_kernel(int x)
cuda_dynamic_lib_func();
result_type r;
- mixed_kernel <<<1,1>>> (r,x);
+ mixed_kernel<<<1, 1>>>(r, x);
return r.sum;
}
diff --git a/Tests/Cuda/ConsumeCompileFeatures/main.cu b/Tests/Cuda/ConsumeCompileFeatures/main.cu
index 712871c..bc32450 100644
--- a/Tests/Cuda/ConsumeCompileFeatures/main.cu
+++ b/Tests/Cuda/ConsumeCompileFeatures/main.cu
@@ -5,14 +5,16 @@ int static_cxx11_func(int);
void test_functions()
{
- auto x = static_cxx11_func( int(42) );
+ auto x = static_cxx11_func(int(42));
std::cout << x << std::endl;
}
-int main(int argc, char **argv)
+int main(int argc, char** argv)
{
test_functions();
- std::cout << "this executable doesn't use cuda code, just call methods defined" << std::endl;
+ std::cout
+ << "this executable doesn't use cuda code, just call methods defined"
+ << std::endl;
std::cout << "in libraries that have cuda code" << std::endl;
return 0;
}
diff --git a/Tests/Cuda/ObjectLibrary/static.cu b/Tests/Cuda/ObjectLibrary/static.cu
index 2374c23..cdf682b 100644
--- a/Tests/Cuda/ObjectLibrary/static.cu
+++ b/Tests/Cuda/ObjectLibrary/static.cu
@@ -8,14 +8,14 @@ int __host__ file1_sq_func(int x)
cudaError_t err;
int nDevices = 0;
err = cudaGetDeviceCount(&nDevices);
- if(err != cudaSuccess)
- {
+ if (err != cudaSuccess) {
std::cout << "nDevices: " << nDevices << std::endl;
std::cout << "err: " << err << std::endl;
return 1;
}
std::cout << "this library uses cuda code" << std::endl;
- std::cout << "you have " << nDevices << " devices that support cuda" << std::endl;
+ std::cout << "you have " << nDevices << " devices that support cuda"
+ << std::endl;
return x * x;
}
diff --git a/Tests/Cuda/ProperLinkFlags/CMakeLists.txt b/Tests/Cuda/ProperLinkFlags/CMakeLists.txt
index a9eb8bd..b6e0e39 100644
--- a/Tests/Cuda/ProperLinkFlags/CMakeLists.txt
+++ b/Tests/Cuda/ProperLinkFlags/CMakeLists.txt
@@ -9,7 +9,7 @@ project (ProperLinkFlags CUDA CXX)
#Specify a set of valid CUDA flags and an invalid set of CXX flags ( for CUDA )
#to make sure we don't use the CXX flags when linking CUDA executables
-set(CMAKE_CUDA_FLAGS "-arch=sm_35 --use_fast_math")
+string(APPEND CMAKE_CUDA_FLAGS " -arch=sm_35 --use_fast_math")
set(CMAKE_CXX_FLAGS "-Wall")
set(CMAKE_CXX_STANDARD 11)
diff --git a/Tests/Cuda/ProperLinkFlags/file1.cu b/Tests/Cuda/ProperLinkFlags/file1.cu
index d93dc9f..9a105f0 100644
--- a/Tests/Cuda/ProperLinkFlags/file1.cu
+++ b/Tests/Cuda/ProperLinkFlags/file1.cu
@@ -6,6 +6,6 @@ result_type __device__ file1_func(int x)
__ldg(&x);
result_type r;
r.input = x;
- r.sum = x*x;
+ r.sum = x * x;
return r;
}
diff --git a/Tests/Cuda/ToolkitInclude/CMakeLists.txt b/Tests/Cuda/ToolkitInclude/CMakeLists.txt
new file mode 100644
index 0000000..f246b54
--- /dev/null
+++ b/Tests/Cuda/ToolkitInclude/CMakeLists.txt
@@ -0,0 +1,11 @@
+cmake_minimum_required(VERSION 3.8)
+project (ToolkitInclude CXX CUDA)
+
+#Goal for this example:
+# Validate that between the CXX implicit include directories and the
+# CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES directories we can find
+# the cuda runtime headers
+
+add_executable(CudaToolkitInclude main.cpp)
+target_include_directories(CudaToolkitInclude PRIVATE
+ ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES})
diff --git a/Tests/Cuda/ToolkitInclude/main.cpp b/Tests/Cuda/ToolkitInclude/main.cpp
new file mode 100644
index 0000000..c8d5c6b
--- /dev/null
+++ b/Tests/Cuda/ToolkitInclude/main.cpp
@@ -0,0 +1,8 @@
+// Only thing we care about is that these headers are found
+#include <cuda.h>
+#include <cuda_runtime_api.h>
+
+int main()
+{
+ return 0;
+}
diff --git a/Tests/Cuda/WithC/CMakeLists.txt b/Tests/Cuda/WithC/CMakeLists.txt
new file mode 100644
index 0000000..1f25ab4
--- /dev/null
+++ b/Tests/Cuda/WithC/CMakeLists.txt
@@ -0,0 +1,12 @@
+cmake_minimum_required(VERSION 3.7)
+project(CudaComplex CUDA C)
+
+string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_30,code=compute_30")
+
+add_executable(CudaWithC main.c cuda.cu)
+
+if(APPLE)
+ # We need to add the default path to the driver (libcuda.dylib) as an rpath, so that
+ # the static cuda runtime can find it at runtime.
+ target_link_libraries(CudaWithC PRIVATE -Wl,-rpath,/usr/local/cuda/lib)
+endif()
diff --git a/Tests/Cuda/WithC/cuda.cu b/Tests/Cuda/WithC/cuda.cu
new file mode 100644
index 0000000..06bd7b9
--- /dev/null
+++ b/Tests/Cuda/WithC/cuda.cu
@@ -0,0 +1,16 @@
+#include <cuda.h>
+
+#include <iostream>
+
+extern "C" int use_cuda(void)
+{
+ int nDevices = 0;
+ cudaError_t err = cudaGetDeviceCount(&nDevices);
+ if (err != cudaSuccess) {
+ std::cerr << "Failed to retrieve the number of CUDA enabled devices"
+ << std::endl;
+ return 1;
+ }
+ std::cout << "Found " << nDevices << " CUDA enabled devices" << std::endl;
+ return 0;
+}
diff --git a/Tests/Cuda/WithC/main.c b/Tests/Cuda/WithC/main.c
new file mode 100644
index 0000000..cb5fddc
--- /dev/null
+++ b/Tests/Cuda/WithC/main.c
@@ -0,0 +1,14 @@
+extern int use_cuda(void);
+
+#ifdef _WIN32
+#include <windows.h>
+#endif
+
+int main()
+{
+#ifdef _WIN32
+ /* Use an API that requires CMake's "standard" C libraries. */
+ GetOpenFileName(NULL);
+#endif
+ return use_cuda();
+}
diff --git a/Tests/CudaOnly/.clang-format b/Tests/CudaOnly/.clang-format
new file mode 100644
index 0000000..a77589a
--- /dev/null
+++ b/Tests/CudaOnly/.clang-format
@@ -0,0 +1,9 @@
+---
+# This configuration requires clang-format 3.8 or higher.
+BasedOnStyle: Mozilla
+AlignOperands: false
+AlwaysBreakAfterReturnType: None
+AlwaysBreakAfterDefinitionReturnType: None
+ColumnLimit: 79
+Standard: Cpp11
+...
diff --git a/Tests/CudaOnly/EnableStandard/CMakeLists.txt b/Tests/CudaOnly/EnableStandard/CMakeLists.txt
index 53b9132..35a1deb 100644
--- a/Tests/CudaOnly/EnableStandard/CMakeLists.txt
+++ b/Tests/CudaOnly/EnableStandard/CMakeLists.txt
@@ -13,3 +13,14 @@ target_link_libraries(CudaOnlyEnableStandard PRIVATE CUDAStatic11 CUDADynamic11)
set_target_properties(CUDAStatic11 CUDADynamic11 PROPERTIES CUDA_STANDARD 11)
set_target_properties(CUDAStatic11 CUDADynamic11 PROPERTIES CUDA_STANDARD_REQUIRED TRUE)
+
+#Verify CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES
+foreach(dir ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES})
+ if(NOT IS_DIRECTORY "${dir}")
+ message(FATAL_ERROR
+ "CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES entry\n"
+ " ${dir}\n"
+ "is not an existing directory."
+ )
+ endif()
+endforeach()
diff --git a/Tests/CudaOnly/EnableStandard/main.cu b/Tests/CudaOnly/EnableStandard/main.cu
index f7144e6..f219583 100644
--- a/Tests/CudaOnly/EnableStandard/main.cu
+++ b/Tests/CudaOnly/EnableStandard/main.cu
@@ -12,11 +12,11 @@ IMPORT int shared_cuda11_func(int);
void test_functions()
{
- static_cuda11_func( int(42) );
- shared_cuda11_func( int(42) );
+ static_cuda11_func(int(42));
+ shared_cuda11_func(int(42));
}
-int main(int argc, char **argv)
+int main(int argc, char** argv)
{
test_functions();
return 0;
diff --git a/Tests/CudaOnly/SeparateCompilation/CMakeLists.txt b/Tests/CudaOnly/SeparateCompilation/CMakeLists.txt
index 7055eef..d134b96 100644
--- a/Tests/CudaOnly/SeparateCompilation/CMakeLists.txt
+++ b/Tests/CudaOnly/SeparateCompilation/CMakeLists.txt
@@ -9,7 +9,7 @@ project (CudaOnlySeparateCompilation CUDA)
#and executables.
#We complicate the matter by also testing that multiple static libraries
#all containing cuda separable compilation code links properly
-set(CMAKE_CUDA_FLAGS "-gencode arch=compute_30,code=compute_30")
+string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_30,code=compute_30")
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CUDA_STANDARD 11)
add_library(CUDASerarateLibA STATIC file1.cu file2.cu file3.cu)
diff --git a/Tests/CudaOnly/SeparateCompilation/file1.cu b/Tests/CudaOnly/SeparateCompilation/file1.cu
index a2e8bf3..1ce63bf 100644
--- a/Tests/CudaOnly/SeparateCompilation/file1.cu
+++ b/Tests/CudaOnly/SeparateCompilation/file1.cu
@@ -5,6 +5,6 @@ result_type __device__ file1_func(int x)
{
result_type r;
r.input = x;
- r.sum = x*x;
+ r.sum = x * x;
return r;
}
diff --git a/Tests/CudaOnly/SeparateCompilation/file2.cu b/Tests/CudaOnly/SeparateCompilation/file2.cu
index 6b8b06b..74f3558 100644
--- a/Tests/CudaOnly/SeparateCompilation/file2.cu
+++ b/Tests/CudaOnly/SeparateCompilation/file2.cu
@@ -5,16 +5,12 @@ result_type __device__ file1_func(int x);
result_type_dynamic __device__ file2_func(int x)
{
- if(x!=42)
- {
+ if (x != 42) {
const result_type r = file1_func(x);
- const result_type_dynamic rd { r.input, r.sum, true };
+ const result_type_dynamic rd{ r.input, r.sum, true };
return rd;
- }
- else
- {
- const result_type_dynamic rd { x, x*x*x, false };
+ } else {
+ const result_type_dynamic rd{ x, x * x * x, false };
return rd;
- }
-
+ }
}
diff --git a/Tests/CudaOnly/SeparateCompilation/file3.cu b/Tests/CudaOnly/SeparateCompilation/file3.cu
index 670a18b..155b513 100644
--- a/Tests/CudaOnly/SeparateCompilation/file3.cu
+++ b/Tests/CudaOnly/SeparateCompilation/file3.cu
@@ -6,13 +6,10 @@
result_type __device__ file1_func(int x);
result_type_dynamic __device__ file2_func(int x);
-
-static
-__global__
-void file3_kernel(result_type& r, int x)
+static __global__ void file3_kernel(result_type& r, int x)
{
- //call static_func which is a method that is defined in the
- //static library that is always out of date
+ // call static_func which is a method that is defined in the
+ // static library that is always out of date
r = file1_func(x);
result_type_dynamic rd = file2_func(x);
}
@@ -20,6 +17,6 @@ void file3_kernel(result_type& r, int x)
result_type file3_launch_kernel(int x)
{
result_type r;
- file3_kernel <<<1,1>>> (r,x);
+ file3_kernel<<<1, 1>>>(r, x);
return r;
}
diff --git a/Tests/CudaOnly/SeparateCompilation/file4.cu b/Tests/CudaOnly/SeparateCompilation/file4.cu
index 86ef623..2e3e01e 100644
--- a/Tests/CudaOnly/SeparateCompilation/file4.cu
+++ b/Tests/CudaOnly/SeparateCompilation/file4.cu
@@ -7,12 +7,10 @@
result_type __device__ file1_func(int x);
result_type_dynamic __device__ file2_func(int x);
-static
-__global__
-void file4_kernel(result_type& r, int x)
+static __global__ void file4_kernel(result_type& r, int x)
{
- //call static_func which is a method that is defined in the
- //static library that is always out of date
+ // call static_func which is a method that is defined in the
+ // static library that is always out of date
r = file1_func(x);
result_type_dynamic rd = file2_func(x);
}
@@ -20,6 +18,6 @@ void file4_kernel(result_type& r, int x)
int file4_launch_kernel(int x)
{
result_type r;
- file4_kernel <<<1,1>>> (r,x);
+ file4_kernel<<<1, 1>>>(r, x);
return r.sum;
}
diff --git a/Tests/CudaOnly/SeparateCompilation/file5.cu b/Tests/CudaOnly/SeparateCompilation/file5.cu
index 6fdb32a..fee8e9e 100644
--- a/Tests/CudaOnly/SeparateCompilation/file5.cu
+++ b/Tests/CudaOnly/SeparateCompilation/file5.cu
@@ -7,12 +7,10 @@
result_type __device__ file1_func(int x);
result_type_dynamic __device__ file2_func(int x);
-static
-__global__
-void file5_kernel(result_type& r, int x)
+static __global__ void file5_kernel(result_type& r, int x)
{
- //call static_func which is a method that is defined in the
- //static library that is always out of date
+ // call static_func which is a method that is defined in the
+ // static library that is always out of date
r = file1_func(x);
result_type_dynamic rd = file2_func(x);
}
@@ -20,6 +18,6 @@ void file5_kernel(result_type& r, int x)
int file5_launch_kernel(int x)
{
result_type r;
- file5_kernel <<<1,1>>> (r,x);
+ file5_kernel<<<1, 1>>>(r, x);
return r.sum;
}
diff --git a/Tests/CudaOnly/SeparateCompilation/main.cu b/Tests/CudaOnly/SeparateCompilation/main.cu
index 5c8e150..03e0921 100644
--- a/Tests/CudaOnly/SeparateCompilation/main.cu
+++ b/Tests/CudaOnly/SeparateCompilation/main.cu
@@ -7,7 +7,7 @@
int file4_launch_kernel(int x);
int file5_launch_kernel(int x);
-int main(int argc, char **argv)
+int main(int argc, char** argv)
{
file4_launch_kernel(42);
file5_launch_kernel(42);
diff --git a/Tests/CudaOnly/WithDefs/CMakeLists.txt b/Tests/CudaOnly/WithDefs/CMakeLists.txt
index 6c4011c..2646d29 100644
--- a/Tests/CudaOnly/WithDefs/CMakeLists.txt
+++ b/Tests/CudaOnly/WithDefs/CMakeLists.txt
@@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.7)
project (CudaOnlyWithDefs CUDA)
#verify that we can pass explicit cuda arch flags
-set(CMAKE_CUDA_FLAGS "-gencode arch=compute_30,code=compute_30")
+string(APPEND CMAKE_CUDA_FLAGS " -gencode arch=compute_30,code=compute_30")
set(debug_compile_flags --generate-code arch=compute_20,code=sm_20)
if(CMAKE_CUDA_SIMULATE_ID STREQUAL "MSVC")
list(APPEND debug_compile_flags -Xcompiler=-WX)
diff --git a/Tests/CudaOnly/WithDefs/main.notcu b/Tests/CudaOnly/WithDefs/main.notcu
index 67bf10c..80ed3a5 100644
--- a/Tests/CudaOnly/WithDefs/main.notcu
+++ b/Tests/CudaOnly/WithDefs/main.notcu
@@ -6,14 +6,12 @@
#error "PACKED_DEFINE not defined!"
#endif
-static
-__global__
-void DetermineIfValidCudaDevice()
+static __global__ void DetermineIfValidCudaDevice()
{
}
#ifdef _MSC_VER
-#pragma pack(push,1)
+#pragma pack(push, 1)
#undef PACKED_DEFINE
#define PACKED_DEFINE
#endif
@@ -32,28 +30,24 @@ struct PACKED_DEFINE result_type
result_type can_launch_kernel()
{
result_type r;
- DetermineIfValidCudaDevice <<<1,1>>> ();
+ DetermineIfValidCudaDevice<<<1, 1>>>();
r.valid = (cudaSuccess == cudaGetLastError());
- if(r.valid)
- {
+ if (r.valid) {
r.value = 1;
- }
- else
- {
+ } else {
r.value = -1;
- }
+ }
return r;
}
-int main(int argc, char **argv)
+int main(int argc, char** argv)
{
cudaError_t err;
int nDevices = 0;
err = cudaGetDeviceCount(&nDevices);
- if(err != cudaSuccess)
- {
- std::cerr << cudaGetErrorString(err) << std::endl;
- return 1;
- }
+ if (err != cudaSuccess) {
+ std::cerr << cudaGetErrorString(err) << std::endl;
+ return 1;
+ }
return 0;
}
diff --git a/Tests/ObjectLibrary/A/CMakeLists.txt b/Tests/ObjectLibrary/A/CMakeLists.txt
index 188fd64..c185d75 100644
--- a/Tests/ObjectLibrary/A/CMakeLists.txt
+++ b/Tests/ObjectLibrary/A/CMakeLists.txt
@@ -21,3 +21,4 @@ add_custom_command(
add_library(A OBJECT a1.c a2.c a.cmake)
target_include_directories(A PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
+set_property(TARGET A PROPERTY COMPILE_PDB_NAME Apdb)
diff --git a/Tests/PositionIndependentTargets/.gitattributes b/Tests/PositionIndependentTargets/.gitattributes
new file mode 100644
index 0000000..ed36631
--- /dev/null
+++ b/Tests/PositionIndependentTargets/.gitattributes
@@ -0,0 +1,2 @@
+# Do not format a source where we want a long line preserved.
+pic_test.h -format.clang-format
diff --git a/Tests/RunCMake/CommandLine/cmake_depends/.gitattributes b/Tests/RunCMake/CommandLine/cmake_depends/.gitattributes
new file mode 100644
index 0000000..9c22288
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/cmake_depends/.gitattributes
@@ -0,0 +1,2 @@
+# Do not format a source encoded in UTF-16.
+test_UTF-16LE.h -format.clang-format
diff --git a/Tests/RunCMake/GenerateExportHeader/reference/.gitattributes b/Tests/RunCMake/GenerateExportHeader/reference/.gitattributes
new file mode 100644
index 0000000..883a7f1
--- /dev/null
+++ b/Tests/RunCMake/GenerateExportHeader/reference/.gitattributes
@@ -0,0 +1,2 @@
+# Exclude reference content from formatting.
+* -format.clang-format
diff --git a/Tests/RunCMake/find_library/LibArchLink-stderr.txt b/Tests/RunCMake/find_library/LibArchLink-stderr.txt
new file mode 100644
index 0000000..139e077
--- /dev/null
+++ b/Tests/RunCMake/find_library/LibArchLink-stderr.txt
@@ -0,0 +1,2 @@
+TOP_LIBRARY='[^']*/Tests/RunCMake/find_library/LibArchLink-build/lib/libtop.a'
+SUB_LIBRARY='[^']*/Tests/RunCMake/find_library/LibArchLink-build/lib/sub/libsub.a'
diff --git a/Tests/RunCMake/find_library/LibArchLink.cmake b/Tests/RunCMake/find_library/LibArchLink.cmake
new file mode 100644
index 0000000..c91381d
--- /dev/null
+++ b/Tests/RunCMake/find_library/LibArchLink.cmake
@@ -0,0 +1,24 @@
+set(CMAKE_SIZEOF_VOID_P 4)
+set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB32_PATHS ON)
+list(APPEND CMAKE_FIND_LIBRARY_PREFIXES lib)
+list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES .a)
+
+file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib)
+execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink lib ${CMAKE_CURRENT_BINARY_DIR}/lib32)
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/lib/libtop.a" "top")
+find_library(TOP_LIBRARY
+ NAMES top
+ PATHS ${CMAKE_CURRENT_BINARY_DIR}/lib
+ NO_DEFAULT_PATH
+ )
+message("TOP_LIBRARY='${TOP_LIBRARY}'")
+
+file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib/sub)
+execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink . ${CMAKE_CURRENT_BINARY_DIR}/lib/sub/32)
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/lib/sub/libsub.a" "sub")
+find_library(SUB_LIBRARY
+ NAMES sub
+ PATHS ${CMAKE_CURRENT_BINARY_DIR}/lib/sub
+ NO_DEFAULT_PATH
+ )
+message("SUB_LIBRARY='${SUB_LIBRARY}'")
diff --git a/Tests/RunCMake/find_library/RunCMakeTest.cmake b/Tests/RunCMake/find_library/RunCMakeTest.cmake
index 5733965..e7e8db3 100644
--- a/Tests/RunCMake/find_library/RunCMakeTest.cmake
+++ b/Tests/RunCMake/find_library/RunCMakeTest.cmake
@@ -1,6 +1,9 @@
include(RunCMake)
run_cmake(Created)
+if(CMAKE_HOST_UNIX)
+ run_cmake(LibArchLink)
+endif()
if(WIN32 OR CYGWIN)
run_cmake(PrefixInPATH)
endif()
diff --git a/Utilities/.gitattributes b/Utilities/.gitattributes
index c6345eb..bd97802 100644
--- a/Utilities/.gitattributes
+++ b/Utilities/.gitattributes
@@ -1,3 +1,7 @@
/Git export-ignore
/GitSetup export-ignore
SetupForDevelopment.sh export-ignore
+
+# Do not format third-party sources.
+/KWIML/** -format.clang-format
+/cm*/** -format.clang-format
diff --git a/Utilities/KWIML/test/CMakeLists.txt b/Utilities/KWIML/test/CMakeLists.txt
index 4f6f37b..1bf93bb 100644
--- a/Utilities/KWIML/test/CMakeLists.txt
+++ b/Utilities/KWIML/test/CMakeLists.txt
@@ -10,7 +10,7 @@ endif()
# Suppress printf/scanf format warnings; we test if the sizes match.
foreach(lang C CXX)
if(KWIML_LANGUAGE_${lang} AND CMAKE_${lang}_COMPILER_ID STREQUAL "GNU")
- set(CMAKE_${lang}_FLAGS "${CMAKE_${lang}_FLAGS} -Wno-format")
+ set(CMAKE_${lang}_FLAGS "${CMAKE_${lang}_FLAGS} -Wno-format -Wno-format-security")
endif()
endforeach()
diff --git a/Utilities/Scripts/clang-format.bash b/Utilities/Scripts/clang-format.bash
index 8e07c99..edcda77 100755
--- a/Utilities/Scripts/clang-format.bash
+++ b/Utilities/Scripts/clang-format.bash
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
#=============================================================================
-# Copyright 2015-2016 Kitware, Inc.
+# Copyright 2015-2017 Kitware, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -106,34 +106,12 @@ case "$mode" in
*) die "invalid mode: $mode" ;;
esac
-# Filter sources to which our style should apply.
-$git_ls -z -- '*.c' '*.cc' '*.cpp' '*.cxx' '*.h' '*.hh' '*.hpp' '*.hxx' |
+# List files as selected above.
+$git_ls |
- # Exclude lexer/parser generator input and output.
- egrep -z -v '^Source/cmCommandArgumentLexer\.' |
- egrep -z -v '^Source/cmCommandArgumentParser(\.y|\.cxx|Tokens\.h)' |
- egrep -z -v '^Source/cmDependsJavaLexer\.' |
- egrep -z -v '^Source/cmDependsJavaParser(\.y|\.cxx|Tokens\.h)' |
- egrep -z -v '^Source/cmExprLexer\.' |
- egrep -z -v '^Source/cmExprParser(\.y|\.cxx|Tokens\.h)' |
- egrep -z -v '^Source/cmFortranLexer\.' |
- egrep -z -v '^Source/cmFortranParser(\.y|\.cxx|Tokens\.h)' |
- egrep -z -v '^Source/cmListFileLexer(\.in\.l|\.c)' |
-
- # Exclude third-party sources.
- egrep -z -v '^Source/bindexplib' |
- egrep -z -v '^Source/(kwsys|CursesDialog/form)/' |
- egrep -z -v '^Utilities/(KW|cm).*/' |
-
- # Exclude reference content.
- egrep -z -v '^Tests/RunCMake/GenerateExportHeader/reference/' |
-
- # Exclude manually-formatted sources (e.g. with long lines).
- egrep -z -v '^Tests/PositionIndependentTargets/pic_test.h' |
- egrep -z -v '^Tests/CompileFeatures/cxx_right_angle_brackets.cpp' |
-
- # Exclude sources with encoding not suported by clang-format.
- egrep -z -v '^Tests/RunCMake/CommandLine/cmake_depends/test_UTF-16LE.h' |
+ # Select sources with our attribute.
+ git check-attr --stdin format.clang-format |
+ sed -n '/: format\.clang-format: set$/ {s/:[^:]*:[^:]*$//p}' |
# Update sources in-place.
- xargs -0 "$clang_format" -i
+ xargs -d '\n' "$clang_format" -i