summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Help/manual/cmake-variables.7.rst1
-rw-r--r--Help/variable/CMAKE_EXPORT_COMPILE_COMMANDS.rst30
-rw-r--r--Modules/FindCUDA.cmake3
-rw-r--r--Modules/Platform/WindowsPaths.cmake52
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/cmInstallTargetGenerator.cxx16
-rw-r--r--Source/cmSystemTools.cxx27
7 files changed, 84 insertions, 47 deletions
diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst
index 3f49572..15eaece 100644
--- a/Help/manual/cmake-variables.7.rst
+++ b/Help/manual/cmake-variables.7.rst
@@ -118,6 +118,7 @@ Variables that Change Behavior
/variable/CMAKE_DISABLE_FIND_PACKAGE_PackageName
/variable/CMAKE_ERROR_DEPRECATED
/variable/CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION
+ /variable/CMAKE_EXPORT_COMPILE_COMMANDS
/variable/CMAKE_EXPORT_NO_PACKAGE_REGISTRY
/variable/CMAKE_SYSROOT
/variable/CMAKE_FIND_APPBUNDLE
diff --git a/Help/variable/CMAKE_EXPORT_COMPILE_COMMANDS.rst b/Help/variable/CMAKE_EXPORT_COMPILE_COMMANDS.rst
new file mode 100644
index 0000000..8776279
--- /dev/null
+++ b/Help/variable/CMAKE_EXPORT_COMPILE_COMMANDS.rst
@@ -0,0 +1,30 @@
+CMAKE_EXPORT_COMPILE_COMMANDS
+-----------------------------
+
+Enable/Disable output of compile commands during generation.
+
+If enabled, generates a ``compile_commands.json`` file containing the exact
+compiler calls for all translation units of the project in machine-readable
+form. The format of the JSON file looks like:
+
+.. code-block:: javascript
+
+ [
+ {
+ "directory": "/home/user/development/project",
+ "command": "/usr/bin/c++ ... -c ../foo/foo.cc",
+ "file": "../foo/foo.cc"
+ },
+
+ ...
+
+ {
+ "directory": "/home/user/development/project",
+ "command": "/usr/bin/c++ ... -c ../foo/bar.cc",
+ "file": "../foo/bar.cc"
+ }
+ ]
+
+.. note::
+ This option is implemented only by :ref:`Makefile Generators`
+ and the :generator:`Ninja`. It is ignored on other generators.
diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake
index ada5b8a..1674e2d 100644
--- a/Modules/FindCUDA.cmake
+++ b/Modules/FindCUDA.cmake
@@ -1474,6 +1474,7 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files)
-P "${custom_target_script}"
WORKING_DIRECTORY "${cuda_compile_intermediate_directory}"
COMMENT "${cuda_build_comment_string}"
+ VERBATIM
)
# Make sure the build system knows the file is generated.
@@ -1592,6 +1593,7 @@ function(CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS output_file cuda_target options
COMMAND ${CUDA_NVCC_EXECUTABLE} ${nvcc_flags} -dlink ${object_files} -o ${output_file}
${flags}
COMMENT "Building NVCC intermediate link file ${output_file_relative_path}"
+ VERBATIM
)
else()
get_filename_component(output_file_dir "${output_file}" DIRECTORY)
@@ -1601,6 +1603,7 @@ function(CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS output_file cuda_target options
COMMAND ${CMAKE_COMMAND} -E echo "Building NVCC intermediate link file ${output_file_relative_path}"
COMMAND ${CMAKE_COMMAND} -E make_directory "${output_file_dir}"
COMMAND ${CUDA_NVCC_EXECUTABLE} ${nvcc_flags} ${flags} -dlink ${object_files} -o "${output_file}"
+ VERBATIM
)
endif()
endif()
diff --git a/Modules/Platform/WindowsPaths.cmake b/Modules/Platform/WindowsPaths.cmake
index 658de3b..eafa8fa 100644
--- a/Modules/Platform/WindowsPaths.cmake
+++ b/Modules/Platform/WindowsPaths.cmake
@@ -28,46 +28,32 @@ set(__WINDOWS_PATHS_INCLUDED 1)
# Windows 64-bit Binary:
# ENV{ProgramFiles(x86)} = [C:\Program Files (x86)]
# ENV{ProgramFiles} = [C:\Program Files]
-# ENV{ProgramW6432} = <not set>
-# (executed from cygwin):
-# ENV{ProgramFiles(x86)} = <not set>
-# ENV{ProgramFiles} = [C:\Program Files]
-# ENV{ProgramW6432} = <not set>
+# ENV{ProgramW6432} = [C:\Program Files] or <not set>
#
-# Windows 32-bit Binary:
+# Windows 32-bit Binary on 64-bit Windows:
# ENV{ProgramFiles(x86)} = [C:\Program Files (x86)]
# ENV{ProgramFiles} = [C:\Program Files (x86)]
# ENV{ProgramW6432} = [C:\Program Files]
-# (executed from cygwin):
-# ENV{ProgramFiles(x86)} = <not set>
-# ENV{ProgramFiles} = [C:\Program Files (x86)]
-# ENV{ProgramW6432} = [C:\Program Files]
-if(DEFINED "ENV{ProgramW6432}")
- # 32-bit binary on 64-bit windows.
- # The 64-bit program files are in ProgramW6432.
- list(APPEND CMAKE_SYSTEM_PREFIX_PATH "$ENV{ProgramW6432}")
-
- # The 32-bit program files are in ProgramFiles.
- if(DEFINED "ENV{ProgramFiles}")
- list(APPEND CMAKE_SYSTEM_PREFIX_PATH "$ENV{ProgramFiles}")
+set(_programfiles "")
+foreach(v "ProgramW6432" "ProgramFiles" "ProgramFiles(x86)")
+ if(DEFINED "ENV{${v}}")
+ file(TO_CMAKE_PATH "$ENV{${v}}" _env_programfiles)
+ list(APPEND _programfiles "${_env_programfiles}")
+ unset(_env_programfiles)
endif()
-else()
- # 64-bit binary, or 32-bit binary on 32-bit windows.
- if(DEFINED "ENV{ProgramFiles}")
- list(APPEND CMAKE_SYSTEM_PREFIX_PATH "$ENV{ProgramFiles}")
- endif()
- set(programfilesx86 "ProgramFiles(x86)")
- if(DEFINED "ENV{${programfilesx86}}")
- # 64-bit binary. 32-bit program files are in ProgramFiles(x86).
- list(APPEND CMAKE_SYSTEM_PREFIX_PATH "$ENV{${programfilesx86}}")
- elseif(DEFINED "ENV{SystemDrive}")
- # Guess the 32-bit program files location.
- if(EXISTS "$ENV{SystemDrive}/Program Files (x86)")
- list(APPEND CMAKE_SYSTEM_PREFIX_PATH
- "$ENV{SystemDrive}/Program Files (x86)")
+endforeach()
+if(DEFINED "ENV{SystemDrive}")
+ foreach(d "Program Files" "Program Files (x86)")
+ if(EXISTS "$ENV{SystemDrive}/${d}")
+ list(APPEND _programfiles "$ENV{SystemDrive}/${d}")
endif()
- endif()
+ endforeach()
+endif()
+if(_programfiles)
+ list(REMOVE_DUPLICATES _programfiles)
+ list(APPEND CMAKE_SYSTEM_PREFIX_PATH ${_programfiles})
endif()
+unset(_programfiles)
# Add the CMake install location.
get_filename_component(_CMAKE_INSTALL_DIR "${CMAKE_ROOT}" PATH)
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 17ed248..b38f6eb 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 4)
-set(CMake_VERSION_PATCH 20160115)
+set(CMake_VERSION_PATCH 20160119)
#set(CMake_VERSION_RC 1)
diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx
index 1158a27..5e88fa2 100644
--- a/Source/cmInstallTargetGenerator.cxx
+++ b/Source/cmInstallTargetGenerator.cxx
@@ -791,18 +791,10 @@ cmInstallTargetGenerator
}
// Write a rule to run chrpath to set the install-tree RPATH
- if(newRpath.empty())
- {
- os << indent << "file(RPATH_REMOVE\n"
- << indent << " FILE \"" << toDestDirPath << "\")\n";
- }
- else
- {
- os << indent << "file(RPATH_CHANGE\n"
- << indent << " FILE \"" << toDestDirPath << "\"\n"
- << indent << " OLD_RPATH \"" << oldRpath << "\"\n"
- << indent << " NEW_RPATH \"" << newRpath << "\")\n";
- }
+ os << indent << "file(RPATH_CHANGE\n"
+ << indent << " FILE \"" << toDestDirPath << "\"\n"
+ << indent << " OLD_RPATH \"" << oldRpath << "\"\n"
+ << indent << " NEW_RPATH \"" << newRpath << "\")\n";
}
}
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 008272c..a89a6e0b 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -2565,6 +2565,7 @@ bool cmSystemTools::ChangeRPath(std::string const& file,
*changed = false;
}
int rp_count = 0;
+ bool remove_rpath = true;
cmSystemToolsRPathInfo rp[2];
{
// Parse the ELF binary.
@@ -2622,6 +2623,7 @@ bool cmSystemTools::ChangeRPath(std::string const& file,
// If it contains the new rpath instead then it is okay.
if(cmSystemToolsFindRPath(se[i]->Value, newRPath) != std::string::npos)
{
+ remove_rpath = false;
continue;
}
if(emsg)
@@ -2642,13 +2644,30 @@ bool cmSystemTools::ChangeRPath(std::string const& file,
rp[rp_count].Size = se[i]->Size;
rp[rp_count].Name = se_name[i];
+ std::string::size_type prefix_len = pos;
+
+ // If oldRPath was at the end of the file's RPath, and newRPath is empty,
+ // we should remove the unnecessary ':' at the end.
+ if (newRPath.empty() &&
+ pos > 0 &&
+ se[i]->Value[pos - 1] == ':' &&
+ pos + oldRPath.length() == se[i]->Value.length())
+ {
+ prefix_len--;
+ }
+
// Construct the new value which preserves the part of the path
// not being changed.
- rp[rp_count].Value = se[i]->Value.substr(0, pos);
+ rp[rp_count].Value = se[i]->Value.substr(0, prefix_len);
rp[rp_count].Value += newRPath;
rp[rp_count].Value += se[i]->Value.substr(pos+oldRPath.length(),
oldRPath.npos);
+ if (!rp[rp_count].Value.empty())
+ {
+ remove_rpath = false;
+ }
+
// Make sure there is enough room to store the new rpath and at
// least one null terminator.
if(rp[rp_count].Size < rp[rp_count].Value.length()+1)
@@ -2673,6 +2692,12 @@ bool cmSystemTools::ChangeRPath(std::string const& file,
return true;
}
+ // If the resulting rpath is empty, just remove the entire entry instead.
+ if (remove_rpath)
+ {
+ return cmSystemTools::RemoveRPath(file, emsg, changed);
+ }
+
{
// Open the file for update.
cmsys::ofstream f(file.c_str(),