cmake_minimum_required(VERSION 3.10) project(extent-sampling VERSION 0.1.0) find_package(GSL REQUIRED) # TODO: Make indent optional find_program(INDENT NAMES indent REQUIRED) find_program(SC NAMES sc REQUIRED) # Generate C source files from SC source files. file(GLOB SC_SOURCES "src/*.sc") foreach(sc_source ${SC_SOURCES}) get_filename_component(source_basename ${sc_source} NAME_WE) set(c_file ${source_basename}.c) add_custom_command( OUTPUT ${c_file} COMMAND ${SC} ${sc_source} ${c_file} COMMAND ${INDENT} ${c_file} DEPENDS ${sc_source} src/macros/macros.sc VERBATIM) list(APPEND C_SOURCES ${c_file}) endforeach() include_directories("include") add_library(extentsampling SHARED ${C_SOURCES})