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

Commit

Permalink
Merge pull request #1781 from allisonvacanti/c++20_fix_backport
Browse files Browse the repository at this point in the history
Various CMake fixes for new build features
  • Loading branch information
alliepiper authored Aug 30, 2022
2 parents 512272c + 73a4616 commit 786e5aa
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 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
3 changes: 2 additions & 1 deletion thrust/cmake/FindTBB.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -236,11 +236,12 @@ if (WIN32 AND MSVC)
set(COMPILER_PREFIX "vc11")
elseif(MSVC_VERSION EQUAL 1800)
set(COMPILER_PREFIX "vc12")
elseif(MSVC_VERSION GREATER_EQUAL 1900 AND MSVC_VERSION LESS_EQUAL 1929)
elseif(MSVC_VERSION GREATER_EQUAL 1900 AND MSVC_VERSION LESS_EQUAL 1939)
# 1900-1925 actually spans three Visual Studio versions:
# 1900 = VS 14.0 (v140 toolset) a.k.a. MSVC 2015
# 1910-1919 = VS 15.0 (v141 toolset) a.k.a. MSVC 2017
# 1920-1929 = VS 16.0 (v142 toolset) a.k.a. MSVC 2019
# 1930-1939 = VS 17.0 (v143 toolset) a.k.a. MSVC 2022
#
# But these are binary compatible and TBB's open source distribution only
# ships a single vs14 lib (as of 2020.0)
Expand Down

0 comments on commit 786e5aa

Please sign in to comment.