Skip to content

Commit a70bb69

Browse files
committed
A little CMakeLists.txt files housekeeping:
* Moved inclusion of `GNUInstallDirs` to the installation "section", near its use * Removed some whitespace at end-of-line * Added a comment explaining our not-absolutely-necessary `export()` command
1 parent dfcf141 commit a70bb69

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

CMakeLists.txt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Does your system only have an older version of CMake? Not to worry!
2-
# CMake offers download-and-use binary packages, with no installation
3-
# necessary... Visit https://cmake.org/download/ and grab one for
2+
# CMake offers download-and-use binary packages, with no installation
3+
# necessary... Visit https://cmake.org/download/ and grab one for
44
# your platform. They are not finicky with library dependencies, so
55
# compatability is very likely. Also, the package's CMake binary will
66
# not mistake any other local CMake-related files for its own.
@@ -12,7 +12,6 @@ PROJECT(cuda-api-wrappers
1212
HOMEPAGE_URL https://github.com/eyalroz/cuda-api-wrappers
1313
)
1414

15-
include(GNUInstallDirs)
1615
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "lib/")
1716
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "lib/")
1817

@@ -122,7 +121,7 @@ if(CUDAToolkit_VERSION VERSION_GREATER_EQUAL 12.4)
122121

123122
if (TARGET CUDA::nvfatbin_static)
124123
target_link_libraries(caw_fatbin_static INTERFACE CUDA::nvfatbin_static)
125-
elseif(EXISTS "${CUDA_nvfatbin_static_LIBRARY}")
124+
elseif(EXISTS "${CUDA_nvfatbin_static_LIBRARY}")
126125
target_link_libraries(caw_fatbin_static INTERFACE "${CUDA_nvfatbin_static_LIBRARY}")
127126
else()
128127
message(WARNING "Could not locate a valid NVIDIA non-fatbin creator target or library file")
@@ -176,6 +175,8 @@ endif()
176175
# Installing the libraries
177176
# ------------------------
178177

178+
include(GNUInstallDirs)
179+
179180
install(FILES "${PROJECT_SOURCE_DIR}/cmake/cuda-api-wrappers-config.cmake"
180181
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/cuda-api-wrappers")
181182

@@ -185,6 +186,9 @@ install(
185186
FILE_SET HEADERS
186187
)
187188

189+
# This command is not part of an installation per se, but rather
190+
# allows adding the built package into a package registry without
191+
# installation
188192
export(
189193
EXPORT cuda-api-wrappers_export
190194
NAMESPACE "${caw_namespace}::"

examples/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ if(NOT DEFINED CUDA_ARCH_FLAGS_STR)
2424
endif()
2525
endif()
2626
# NVCC is unfriendly if you specify multiple architectures, only some of which are supported; and
27-
# many versions of CMake will indeed tend to include older architectures in the auto-detection
27+
# many versions of CMake will indeed tend to include older architectures in the auto-detection
2828
# fallback, so - we must do a bit of purging.
2929
if(CUDAToolkit_VERSION VERSION_GREATER_EQUAL "13.0")
3030
string(REGEX REPLACE " ?-gencode arch=compute_(([1-6][0-9])|(7[0-2])),code=sm_(([1-6][0-9])|(7[0-2]))" "" CUDA_ARCH_FLAGS_STR_NO_UNSUPPORTED "${CUDA_ARCH_FLAGS_STR}")

0 commit comments

Comments
 (0)