File tree 5 files changed +51
-17
lines changed
5 files changed +51
-17
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,24 @@ install(DIRECTORY "${CUB_SOURCE_DIR}/cub/cmake/"
16
16
)
17
17
# Need to configure a file to store the infix specified in
18
18
# CMAKE_INSTALL_INCLUDEDIR since it can be defined by the user
19
- set (install_location "${CMAKE_INSTALL_LIBDIR} /cmake/cub" )
19
+ set (_CCCL_RELATIVE_LIBDIR "${CMAKE_INSTALL_LIBDIR} " )
20
+ if (_CCCL_RELATIVE_LIBDIR MATCHES "^${CMAKE_INSTALL_PREFIX} " )
21
+ # libdir is an abs string that starts with prefix
22
+ string (LENGTH "${CMAKE_INSTALL_PREFIX} " to_remove)
23
+ string (SUBSTRING "${_CCCL_RELATIVE_LIBDIR} " ${to_remove} -1 relative)
24
+ # remove any leading "/""
25
+ string (REGEX REPLACE "^/(.)" "\\ 1" _CCCL_RELATIVE_LIBDIR "${relative} " )
26
+ else ()
27
+ message (FATAL_ERROR "CMAKE_INSTALL_LIBDIR must be a relative path or an absolute path under CMAKE_INSTALL_PREFIX" )
28
+ endif ()
29
+ set (install_location "${_CCCL_RELATIVE_LIBDIR} /cmake/cub" )
30
+
31
+ # Transform to a list of directories, replace each directory with "../"
32
+ # and convert back to a string
33
+ string (REGEX REPLACE "/" ";" from_install_prefix "${install_location} " )
34
+ list (TRANSFORM from_install_prefix REPLACE ".+" "../" )
35
+ list (JOIN from_install_prefix "" from_install_prefix)
36
+
20
37
configure_file ("${CUB_SOURCE_DIR} /cub/cmake/cub-header-search.cmake.in"
21
38
"${CUB_BINARY_DIR} /cub/cmake/cub-header-search.cmake"
22
39
@ONLY)
Original file line number Diff line number Diff line change 2
2
unset (_CUB_VERSION_INCLUDE_DIR CACHE ) # Clear old result to force search
3
3
4
4
# Find CMAKE_INSTALL_INCLUDEDIR=@CMAKE_INSTALL_INCLUDEDIR@ directory"
5
- set (from_install_prefix "@install_location@" )
6
-
7
- # Transform to a list of directories, replace each directoy with "../"
8
- # and convert back to a string
9
- string (REGEX REPLACE "/" ";" from_install_prefix "${from_install_prefix} " )
10
- list (TRANSFORM from_install_prefix REPLACE ".+" "../" )
11
- list (JOIN from_install_prefix "" from_install_prefix)
5
+ set (from_install_prefix "@from_install_prefix@" )
12
6
13
7
find_path (_CUB_VERSION_INCLUDE_DIR cub/version .cuh
14
8
NO_CMAKE_FIND_ROOT_PATH # Don't allow CMake to re-root the search
Original file line number Diff line number Diff line change @@ -28,7 +28,18 @@ install(DIRECTORY "${libcudacxx_SOURCE_DIR}/lib/cmake/libcudacxx"
28
28
# Need to configure a file to store CMAKE_INSTALL_INCLUDEDIR
29
29
# since it can be defined by the user. This is common to work around collisions
30
30
# with the CTK installed headers.
31
- set (install_location "${CMAKE_INSTALL_LIBDIR} /cmake/libcudacxx" )
31
+ set (_CCCL_RELATIVE_LIBDIR "${CMAKE_INSTALL_LIBDIR} " )
32
+ if (_CCCL_RELATIVE_LIBDIR MATCHES "^${CMAKE_INSTALL_PREFIX} " )
33
+ # libdir is an abs string that starts with prefix
34
+ string (LENGTH "${CMAKE_INSTALL_PREFIX} " to_remove)
35
+ string (SUBSTRING "${_CCCL_RELATIVE_LIBDIR} " ${to_remove} -1 relative)
36
+ # remove any leading "/""
37
+ string (REGEX REPLACE "^/(.)" "\\ 1" _CCCL_RELATIVE_LIBDIR "${relative} " )
38
+ else ()
39
+ message (FATAL_ERROR "CMAKE_INSTALL_LIBDIR must be a relative path or an absolute path under CMAKE_INSTALL_PREFIX" )
40
+ endif ()
41
+ set (install_location "${_CCCL_RELATIVE_LIBDIR} /cmake/libcudacxx" )
42
+
32
43
# Transform to a list of directories, replace each directory with "../"
33
44
# and convert back to a string
34
45
string (REGEX REPLACE "/" ";" from_install_prefix "${install_location} " )
Original file line number Diff line number Diff line change @@ -15,9 +15,27 @@ install(DIRECTORY "${Thrust_SOURCE_DIR}/thrust/cmake/"
15
15
DESTINATION "${CMAKE_INSTALL_LIBDIR} /cmake/thrust"
16
16
REGEX .*header-search.cmake.* EXCLUDE
17
17
)
18
+
18
19
# Need to configure a file to store the infix specified in
19
20
# CMAKE_INSTALL_INCLUDEDIR since it can be defined by the user
20
- set (install_location "${CMAKE_INSTALL_LIBDIR} /cmake/thrust" )
21
+ set (_CCCL_RELATIVE_LIBDIR "${CMAKE_INSTALL_LIBDIR} " )
22
+ if (_CCCL_RELATIVE_LIBDIR MATCHES "^${CMAKE_INSTALL_PREFIX} " )
23
+ # libdir is an abs string that starts with prefix
24
+ string (LENGTH "${CMAKE_INSTALL_PREFIX} " to_remove)
25
+ string (SUBSTRING "${_CCCL_RELATIVE_LIBDIR} " ${to_remove} -1 relative)
26
+ # remove any leading "/""
27
+ string (REGEX REPLACE "^/(.)" "\\ 1" _CCCL_RELATIVE_LIBDIR "${relative} " )
28
+ else ()
29
+ message (FATAL_ERROR "CMAKE_INSTALL_LIBDIR must be a relative path or an absolute path under CMAKE_INSTALL_PREFIX" )
30
+ endif ()
31
+ set (install_location "${_CCCL_RELATIVE_LIBDIR} /cmake/thrust" )
32
+
33
+ # Transform to a list of directories, replace each directory with "../"
34
+ # and convert back to a string
35
+ string (REGEX REPLACE "/" ";" from_install_prefix "${install_location} " )
36
+ list (TRANSFORM from_install_prefix REPLACE ".+" "../" )
37
+ list (JOIN from_install_prefix "" from_install_prefix)
38
+
21
39
configure_file ("${Thrust_SOURCE_DIR} /thrust/cmake/thrust-header-search.cmake.in"
22
40
"${Thrust_BINARY_DIR} /thrust/cmake/thrust-header-search.cmake"
23
41
@ONLY)
Original file line number Diff line number Diff line change 2
2
unset (_THRUST_VERSION_INCLUDE_DIR CACHE ) # Clear old result to force search
3
3
4
4
# Find CMAKE_INSTALL_INCLUDEDIR=@CMAKE_INSTALL_INCLUDEDIR@ directory"
5
- set (from_install_prefix "@install_location@" )
6
-
7
- # Transform to a list of directories, replace each directoy with "../"
8
- # and convert back to a string
9
- string (REGEX REPLACE "/" ";" from_install_prefix "${from_install_prefix} " )
10
- list (TRANSFORM from_install_prefix REPLACE ".+" "../" )
11
- list (JOIN from_install_prefix "" from_install_prefix)
5
+ set (from_install_prefix "@from_install_prefix@" )
12
6
13
7
find_path (_THRUST_VERSION_INCLUDE_DIR thrust/version .h
14
8
NO_CMAKE_FIND_ROOT_PATH # Don't allow CMake to re-root the search
You can’t perform that action at this time.
0 commit comments