diff --git a/cmake/CCCLGenerateHeaderTests.cmake b/cmake/CCCLGenerateHeaderTests.cmake index e483b194513..b04f033f4d2 100644 --- a/cmake/CCCLGenerateHeaderTests.cmake +++ b/cmake/CCCLGenerateHeaderTests.cmake @@ -108,4 +108,13 @@ function(cccl_generate_header_tests target_name project_include_path) add_library(${target_name} OBJECT ${header_srcs}) cccl_configure_target(${target_name} ${cccl_configure_target_options}) + # Check that all functions in headers are either template functions or inline: + set(link_target ${target_name}.link_check) + add_library(${link_target} SHARED) + cccl_configure_target(${link_target} ${cccl_configure_target_options}) + # Linking both ${target_name} and $ forces CMake to + # link the same objects twice. The compiler will complain about duplicate symbols if + # any functions are missing inline markup. + target_link_libraries(${link_target} PRIVATE ${target_name} $) + endfunction()