2018-01-01 09:26:34 +01:00
|
|
|
cmake_minimum_required(VERSION 2.8)
|
|
|
|
|
|
|
|
project(libfort)
|
|
|
|
|
2018-01-07 13:19:00 +01:00
|
|
|
option(FORT_TEST_BUILD "Test build with sanitizers and small library stack size" ON)
|
|
|
|
option(FORT_GCC_BUILD "Build with gcc" ON)
|
2018-01-01 09:26:34 +01:00
|
|
|
|
|
|
|
set(CMAKE_VERBOSE_MAKEFILE ON)
|
|
|
|
|
|
|
|
include_directories(include)
|
|
|
|
include_directories(src)
|
|
|
|
|
2018-01-17 05:05:01 +01:00
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -g")
|
2018-01-01 09:26:34 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-01-17 19:22:57 +01:00
|
|
|
FILE(GLOB_RECURSE FortHeaders "include/*.h" "tests/*.h" "src/*.h" "src/*.h" "src/*.h" "src/*.h" "src/*.h" "src/*.h")
|
2018-01-01 09:26:34 +01:00
|
|
|
add_custom_target(headers SOURCES ${FortHeaders})
|
|
|
|
|
|
|
|
|
2018-01-17 19:22:57 +01:00
|
|
|
set(FORT_SOURCES
|
|
|
|
src/fort.c
|
|
|
|
src/vector.c
|
|
|
|
src/string_buffer.c
|
|
|
|
src/options.c
|
|
|
|
src/cell.c
|
|
|
|
src/row.c
|
|
|
|
src/table.c
|
|
|
|
src/fort_impl.c)
|
2018-01-01 09:26:34 +01:00
|
|
|
|
|
|
|
|
|
|
|
add_executable(${PROJECT_NAME}
|
|
|
|
example/main.c
|
|
|
|
${FORT_SOURCES})
|
|
|
|
|
|
|
|
|
|
|
|
include_directories(tests/cmocka-1.1.0/include)
|
|
|
|
link_directories(${CMAKE_SOURCE_DIR}/tests/cmocka-1.1.0/build/src)
|
|
|
|
|
2018-03-09 09:03:03 +01:00
|
|
|
add_executable(libfort_test
|
2018-01-17 19:22:57 +01:00
|
|
|
${FORT_SOURCES}
|
2018-01-01 09:26:34 +01:00
|
|
|
tests/test.c
|
|
|
|
tests/test_vector.c
|
2018-01-21 09:19:18 +01:00
|
|
|
tests/test_table.c
|
|
|
|
tests/test_string_buffer.c)
|
2018-01-01 09:26:34 +01:00
|
|
|
|
2018-03-09 09:03:03 +01:00
|
|
|
target_link_libraries(libfort_test
|
2018-01-01 09:26:34 +01:00
|
|
|
cmocka)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-01-07 13:19:00 +01:00
|
|
|
if(FORT_TEST_BUILD)
|
2018-01-01 09:26:34 +01:00
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address")
|
2018-01-07 13:19:00 +01:00
|
|
|
if(FORT_GCC_BUILD)
|
2018-01-01 09:26:34 +01:00
|
|
|
target_link_libraries(${PROJECT_NAME} asan)
|
2018-03-09 09:03:03 +01:00
|
|
|
target_link_libraries(libfort_test asan)
|
2018-01-07 13:19:00 +01:00
|
|
|
endif(FORT_GCC_BUILD)
|
|
|
|
endif(FORT_TEST_BUILD)
|
2018-01-01 09:26:34 +01:00
|
|
|
|