Here an example like this compiles
cmake_minimum_required(VERSION 3.13)
project(Variant
LANGUAGES CXX)
# -----------------------------------------------------------------------------
# Handle VTK dependency
# -----------------------------------------------------------------------------
# Enable C++20 for the project
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON) # Ensure the standard is required.
set(CMAKE_CXX_EXTENSIONS OFF) # Use only standard-compliant C++.
find_package(VTK
COMPONENTS
CommonCore)
if (NOT VTK_FOUND)
message("Skipping issue: ${VTK_NOT_FOUND_MESSAGE}")
return ()
endif ()
# -----------------------------------------------------------------------------
# Compile example code
# -----------------------------------------------------------------------------
add_executable(Variant Variant.cxx)
target_link_libraries(Variant
PRIVATE
VTK::CommonCore
)
Perhaps, you have an issue linking to debug from a release build or vice versa.