Skip to content

Commit f255c0b

Browse files
committed
ci: convert to use CMake
Convert the CI to use CMake instead of Makefiles. This will allow us to wire up support for Windows in a subsequent commit.
1 parent e3fb2fe commit f255c0b

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

Diff for: .github/workflows/ci.yml

+4-2
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,7 @@ jobs:
1919
uses: actions/checkout@v2
2020
- name: Build
2121
run: |
22-
cd test
23-
make
22+
mkdir build
23+
cd build
24+
cmake ..
25+
cmake --build .

Diff for: CMakeLists.txt

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.25.0)
1+
cmake_minimum_required(VERSION 3.16..3.29)
22

33
project(clar LANGUAGES C)
44

@@ -20,6 +20,9 @@ set_target_properties(clar PROPERTIES
2020
C_EXTENSIONS OFF
2121
)
2222

23-
if(BUILD_TESTS)
24-
add_subdirectory(test)
23+
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
24+
include(CTest)
25+
if(BUILD_TESTING)
26+
add_subdirectory(test)
27+
endif()
2528
endif()

Diff for: test/CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ find_package(Python COMPONENTS Interpreter REQUIRED)
22

33
add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/clar.suite"
44
COMMAND "${Python_EXECUTABLE}" "${CMAKE_SOURCE_DIR}/generate.py" --output "${CMAKE_CURRENT_BINARY_DIR}"
5-
DEPENDS main.c sample.c
5+
DEPENDS main.c sample.c clar_test.h
66
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
77
)
88

@@ -15,7 +15,7 @@ set_target_properties(clar_test PROPERTIES
1515

1616
# MSVC generates all kinds of warnings. We may want to fix these in the future
1717
# and then unconditionally treat warnings as errors.
18-
if (NOT MSVC)
18+
if(NOT MSVC)
1919
set_target_properties(clar_test PROPERTIES
2020
COMPILE_WARNING_AS_ERROR ON
2121
)

0 commit comments

Comments
 (0)