diff --git a/CMakeLists.txt b/CMakeLists.txt index ab699559a..c03688533 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -556,7 +556,7 @@ if(FLATBUFFERS_BUILD_TESTS) # Add a library so there is a single target that the generated samples can # link too. - if(MSVC) + if(MSVC OR ${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.20.0") add_library(flatsample INTERFACE) else() add_library(flatsample STATIC)