From 8dba3f7f3591f4271522835cb2057acf4ae56f53 Mon Sep 17 00:00:00 2001 From: Nick Wellnhofer Date: Tue, 18 Nov 2014 18:37:56 +0100 Subject: Start with tests for the C API The C API tests can be run individually via build/api_test/api_test Or together with the spec tests via cmake --build build --target test --- api_test/CMakeLists.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 api_test/CMakeLists.txt (limited to 'api_test/CMakeLists.txt') diff --git a/api_test/CMakeLists.txt b/api_test/CMakeLists.txt new file mode 100644 index 0000000..7b6c3d6 --- /dev/null +++ b/api_test/CMakeLists.txt @@ -0,0 +1,11 @@ +add_executable(api_test + harness.c + main.c +) +target_include_directories(api_test + PRIVATE + ${PROJECT_SOURCE_DIR}/src + ${PROJECT_BINARY_DIR}/src +) +target_link_libraries(api_test libcmark) + -- cgit v1.2.3 From 2c45e45627ec0a705e9580ff299be0465f5bdced Mon Sep 17 00:00:00 2001 From: Nick Wellnhofer Date: Tue, 18 Nov 2014 21:03:18 +0100 Subject: Try to support older CMake versions --- api_test/CMakeLists.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'api_test/CMakeLists.txt') diff --git a/api_test/CMakeLists.txt b/api_test/CMakeLists.txt index 7b6c3d6..31f1980 100644 --- a/api_test/CMakeLists.txt +++ b/api_test/CMakeLists.txt @@ -2,8 +2,7 @@ add_executable(api_test harness.c main.c ) -target_include_directories(api_test - PRIVATE +include_directories( ${PROJECT_SOURCE_DIR}/src ${PROJECT_BINARY_DIR}/src ) -- cgit v1.2.3 From 00a48356ee002a63362496ca62c1fa8f6c05ad58 Mon Sep 17 00:00:00 2001 From: Nick Wellnhofer Date: Tue, 18 Nov 2014 21:08:38 +0100 Subject: Add header file to CMake api_test sources --- api_test/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) (limited to 'api_test/CMakeLists.txt') diff --git a/api_test/CMakeLists.txt b/api_test/CMakeLists.txt index 31f1980..66629d8 100644 --- a/api_test/CMakeLists.txt +++ b/api_test/CMakeLists.txt @@ -1,5 +1,6 @@ add_executable(api_test harness.c + harness.h main.c ) include_directories( -- cgit v1.2.3 From fc46123f0a527a364f9a0fb1e7b8b7448fd84b89 Mon Sep 17 00:00:00 2001 From: Nick Wellnhofer Date: Tue, 18 Nov 2014 21:34:29 +0100 Subject: Set compiler flags for api_test --- api_test/CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'api_test/CMakeLists.txt') diff --git a/api_test/CMakeLists.txt b/api_test/CMakeLists.txt index 66629d8..b2ab2c8 100644 --- a/api_test/CMakeLists.txt +++ b/api_test/CMakeLists.txt @@ -9,3 +9,11 @@ include_directories( ) target_link_libraries(api_test libcmark) +# Compiler flags +if(CMAKE_COMPILER_IS_GNUCC OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang") + set_target_properties(api_test PROPERTIES COMPILE_FLAGS + "-std=c99 -Wall -Wextra" + ) +elseif ("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC") + set_target_properties(api_test PROPERTIES COMPILE_FLAGS "/TP /W4") +endif() -- cgit v1.2.3