cmake_minimum_required(VERSION 3.2) project(honeysuckle VERSION 1.0.0 DESCRIPTION "A C library to make writing lua bindings simple") find_package(Lua51 REQUIRED) include_directories(${LUA_INCLUDE_DIR}) # build and link the library set(HS_ROOT ${CMAKE_SOURCE_DIR}/src) set(HONEYSUCKLE_SOURCES ${HS_ROOT}/hs_type_to_string.c ${HS_ROOT}/hs_pushstring.c ${HS_ROOT}/hs_throw_error.c ${HS_ROOT}/hs_parse_args.c ${HS_ROOT}/honeysuckle.c ) add_library(honeysuckle ${HONEYSUCKLE_SOURCES}) set_target_properties(honeysuckle PROPERTIES CMAKE_C_FLAGS "-Wall -Wextra -Werror -Wfatal-errors -Wpedantic") target_link_libraries(honeysuckle ${LUA_LIBRARIES}) set_target_properties(honeysuckle PROPERTIES VERSION ${PROJECT_VERSION} PUBLIC_HEADER src/honeysuckle.h) # optionally build the tests set(TEST_ROOT ${CMAKE_SOURCE_DIR}/src/tests) set(TEST_SOURCES ${TEST_ROOT}/tests_main.c ${TEST_ROOT}/hs_type_to_string_tests.c ${TEST_ROOT}/hs_parse_args_tests.c # ${TEST_ROOT}/hs_parse_overloaded_tests.c # ${TEST_ROOT}/hs_create_table_tests.c # ${TEST_ROOT}/hs_process_table_tests.c ${TEST_ROOT}/hs_throw_error_tests.c # ${TEST_ROOT}/hs_traceback_tests.c # ${TEST_ROOT}/hs_call_tests.c # ${TEST_ROOT}/hs_call_args_tests.c ${TEST_ROOT}/hs_pushstring_tests.c # ${TEST_ROOT}/hs_rxx_tests.c ) add_executable(test EXCLUDE_FROM_ALL ${TEST_SOURCES}) target_link_libraries(test ${LUA_LIBRARIES} honeysuckle) include(GNUInstallDirs) install(TARGETS honeysuckle LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})