Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Commit

Permalink
Only generate per-dialect targets when needed.
Browse files Browse the repository at this point in the history
  • Loading branch information
Allison Vacanti committed Aug 30, 2022
1 parent 512272c commit f58f28c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
7 changes: 2 additions & 5 deletions cmake/ThrustBuildCompilerTargets.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@
# - Interface target providing compiler-specific options needed to build
# Thrust's tests, examples, etc.
#
# thrust.compiler_interface_cpp11
# thrust.compiler_interface_cpp14
# thrust.compiler_interface_cpp17
# thrust.compiler_interface_cppXX
# - Interface targets providing compiler-specific options that should only be
# applied to certain dialects of C++.
# applied to certain dialects of C++. May not be defined for all dialects.
#
# thrust.promote_cudafe_warnings
# - Interface target that adds warning promotion for NVCC cudafe invocations.
Expand Down Expand Up @@ -175,7 +173,6 @@ function(thrust_build_compiler_targets)
# These targets are used for dialect-specific options:
add_library(thrust.compiler_interface_cpp11 INTERFACE)
add_library(thrust.compiler_interface_cpp14 INTERFACE)
add_library(thrust.compiler_interface_cpp17 INTERFACE)

if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# C4127: conditional expression is constant
Expand Down
8 changes: 7 additions & 1 deletion cmake/ThrustBuildTargetList.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,15 @@ function(_thrust_add_target_to_target_list target_name host device dialect prefi

target_link_libraries(${target_name} INTERFACE
thrust.compiler_interface
thrust.compiler_interface_cpp${dialect}
)

# dialect-specific interface:
if (TARGET thrust.compiler_interface_cpp${dialect})
target_link_libraries(${target_name} INTERFACE
thrust.compiler_interface_cpp${dialect}
)
endif()

# Workaround Github issue #1174. cudafe promote TBB header warnings to
# errors, even when they're -isystem includes.
if ((NOT host STREQUAL "TBB") OR (NOT device STREQUAL "CUDA"))
Expand Down

0 comments on commit f58f28c

Please sign in to comment.