cmake_minimum_required(VERSION 3.23) project(libmegapixels C) set(LIBRARY_VERSION_MAJOR 0) set(LIBRARY_VERSION_STRING 0.1) set(CMAKE_C_STANDARD 23) set(CMAKE_C_VISIBILITY_PRESET hidden) add_library(megapixels SHARED include/libmegapixels.h src/findconfig.c src/parse.c src/mode.c src/pipeline.c src/log.c src/util.c src/convert.c src/aaa.c src/flash.c config.h) set_target_properties(megapixels PROPERTIES VERSION ${LIBRARY_VERSION_STRING} SOVERSION ${LIBRARY_VERSION_MAJOR} PUBLIC_HEADER include/libmegapixels.h) target_include_directories(megapixels PUBLIC include) target_link_libraries(megapixels "config") add_executable(findconfig util/findconfig.c) target_include_directories(findconfig PUBLIC include) target_link_libraries(findconfig PUBLIC megapixels) add_executable(getframe util/getframe.c) target_include_directories(getframe PUBLIC include) target_link_libraries(getframe PUBLIC megapixels) add_executable(sensorprofile util/sensorprofile.c) target_include_directories(sensorprofile PUBLIC include) target_link_libraries(sensorprofile PUBLIC megapixels) add_executable(configlint util/configlint.c) target_include_directories(configlint PUBLIC include) target_link_libraries(configlint PUBLIC megapixels) add_compile_definitions(SYSCONFDIR="/etc") add_compile_definitions(DATADIR="/usr/share") include_directories(${CMAKE_CURRENT_BINARY_DIR}) add_custom_command( OUTPUT config.h COMMAND touch ${CMAKE_CURRENT_BINARY_DIR}/config.h DEPENDS CMakeLists.txt COMMENT "Generating dummy header for meson compat..." ) add_subdirectory(tests)