Skip to content

Commit

Permalink
Replaced the build system from Make to CMake
Browse files Browse the repository at this point in the history
  Add /build dir to ignore
  Add CMakeLists.txt file to configure build system
  Del Makefile
  • Loading branch information
balaraz committed Jul 2, 2024
1 parent 485d020 commit b530824
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 88 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build/
29 changes: 29 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
cmake_minimum_required(VERSION 3.5)

set(NAME mmv)

project(${NAME}-c C)

set(SRCDIR ${CMAKE_SOURCE_DIR}/src)

include_directories(${SRCDIR})

file(GLOB SRCS ${SRCDIR}/*.c)

add_executable(${NAME} ${CMAKE_SOURCE_DIR}/main.c ${SRCS})


option(TESTING "Enable tests executables" OFF)

if(TESTING)
message(STATUS "Enable testing")
enable_testing()
add_subdirectory(libs/Unity)
add_subdirectory(test)
endif()


include(GNUInstallDirs)

install(TARGETS ${NAME} DESTINATION ${CMAKE_INSTALL_BINDIR})
install(FILES ${CMAKE_SOURCE_DIR}/man/${NAME}.1.gz DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
88 changes: 0 additions & 88 deletions Makefile

This file was deleted.

13 changes: 13 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

add_executable(test_utils ${CMAKE_CURRENT_SOURCE_DIR}/test_utils.c)
target_link_libraries(test_utils PRIVATE unity::framework)
add_test(NAME Utils COMMAND test_utils)

add_executable(test_set ${CMAKE_CURRENT_SOURCE_DIR}/test_set.c)
target_link_libraries(test_set PRIVATE unity::framework)
add_test(NAME Set COMMAND test_set)

add_executable(test_mmv ${CMAKE_CURRENT_SOURCE_DIR}/test_mmv.c)
target_link_libraries(test_mmv PRIVATE unity::framework)
add_test(NAME mmv COMMAND test_mmv)
set_tests_properties(mmv PROPERTIES ENVIRONMENT "EDITOR=true")

0 comments on commit b530824

Please sign in to comment.