diff options
author | Mathias Gaunard <mathias@gaunard.com> | 2013-03-27 10:33:36 (GMT) |
---|---|---|
committer | Robert Maynard <robert.maynard@kitware.com> | 2013-04-18 13:07:52 (GMT) |
commit | cd2d2480cc84c4d4b54cee76061e1aa5e57cb832 (patch) | |
tree | c2f66de8f3df49d8ef7183ba7e94d2bc2c9c0f2b /Modules/FindCUDA.cmake | |
parent | 51e4424df66b71e5044f20017adf39edd396b61a (diff) | |
download | CMake-cd2d2480cc84c4d4b54cee76061e1aa5e57cb832.zip CMake-cd2d2480cc84c4d4b54cee76061e1aa5e57cb832.tar.gz CMake-cd2d2480cc84c4d4b54cee76061e1aa5e57cb832.tar.bz2 |
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.cmake | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index 423ad3d..8248624 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 |