File CMakeLists.txt of Package failed_vdt

cmake_minimum_required(VERSION 3.5)
project(vdt LANGUAGES C CXX)

# Package options (keep defaults compatible with upstream)
option(DIAG "Build diagnostic programs" ON)
option(AVX "Enable AVX optimizations" OFF)
option(SSE "Enable SSE optimizations" ON)

# If the target processor is not an x86 family CPU, force-disable SSE.
# This prevents adding -msse on architectures that don't understand it
# (for example, riscv64), which breaks the build (gcc reports
# "unrecognized command-line option '-msse'").
if(NOT CMAKE_SYSTEM_PROCESSOR MATCHES "^(x86|i386|i486|i586|i686|x86_64|amd64)$")
  if(SSE)
    message(STATUS "Target processor (${CMAKE_SYSTEM_PROCESSOR}) does not support SSE — disabling SSE option")
  endif()
  # Force the cached option off so command-line -DSSE=ON cannot enable it on unsupported archs.
  set(SSE OFF CACHE BOOL "Enable SSE optimizations" FORCE)
endif()

# Add instruction-specific compile flags only when enabled and supported.
if(SSE)
  message(STATUS "Using SSE instructions!")
  add_compile_options(-msse)
endif()

if(AVX)
  message(STATUS "Using AVX instructions!")
  add_compile_options(-mavx)
endif()

# Basic project layout: defer to subdirectories for the actual targets.
# The upstream project uses subdirectories named src, lib and progs.
# Keep these to preserve original build structure.
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/src/CMakeLists.txt")
  add_subdirectory(src)
endif()

if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/lib/CMakeLists.txt")
  add_subdirectory(lib)
endif()

if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/progs/CMakeLists.txt")
  add_subdirectory(progs)
endif()
openSUSE Build Service is sponsored by