summaryrefslogtreecommitdiff
path: root/Modules/FindCUDA.cmake
diff options
context:
space:
mode:
authorMathias Gaunard <mathias@gaunard.com>2013-03-27 11:33:36 +0100
committerRobert Maynard <robert.maynard@kitware.com>2013-04-18 09:07:52 -0400
commitcd2d2480cc84c4d4b54cee76061e1aa5e57cb832 (patch)
treec2f66de8f3df49d8ef7183ba7e94d2bc2c9c0f2b /Modules/FindCUDA.cmake
parent51e4424df66b71e5044f20017adf39edd396b61a (diff)
downloadcmake-cd2d2480cc84c4d4b54cee76061e1aa5e57cb832.tar.gz
FindCUDA: CUDA_COMPUTE_BUILD_PATH uses relative paths to binary dir.
make CUDA_COMPUTE_BUILD_PATH use a relative path to the current binary directory instead of the current source directory if the source file considered is in the current binary directory. This is done to shorten the paths given to the compiler.
Diffstat (limited to 'Modules/FindCUDA.cmake')
-rw-r--r--Modules/FindCUDA.cmake8
1 files changed, 7 insertions, 1 deletions
diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake
index 423ad3d137..8248624e47 100644
--- a/Modules/FindCUDA.cmake
+++ b/Modules/FindCUDA.cmake
@@ -920,7 +920,13 @@ function(CUDA_COMPUTE_BUILD_PATH path build_path)
if (IS_ABSOLUTE "${bpath}")
# Absolute paths are generally unnessary, especially if something like
# file(GLOB_RECURSE) is used to pick up the files.
- file(RELATIVE_PATH bpath "${CMAKE_CURRENT_SOURCE_DIR}" "${bpath}")
+
+ string(FIND "${bpath}" "${CMAKE_CURRENT_BINARY_DIR}" _binary_dir_pos)
+ if (_binary_dir_pos EQUAL 0)
+ file(RELATIVE_PATH bpath "${CMAKE_CURRENT_BINARY_DIR}" "${bpath}")
+ else()
+ file(RELATIVE_PATH bpath "${CMAKE_CURRENT_SOURCE_DIR}" "${bpath}")
+ endif()
endif()
# This recipie is from cmLocalGenerator::CreateSafeUniqueObjectFileName in the