From 15e2ec60828b9908a938e9a0e3d9218b764e4390 Mon Sep 17 00:00:00 2001 From: Bastian Dehn Date: Sun, 1 Mar 2026 20:37:24 +0100 Subject: [PATCH] change cmake keywords lower case --- CMakeLists.txt | 22 ++++++++++++---------- src/CMakeLists.txt | 37 ++++++++++++++++++++----------------- tests/CMakeLists.txt | 11 ++++++----- 3 files changed, 38 insertions(+), 32 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f2debb7..6de677c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,13 +1,15 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 3.25.1) +cmake_minimum_required(VERSION 3.25.1) -IF ("${CMAKE_BUILD_TYPE}" STREQUAL "Release") - SET(CMAKE_C_FLAGS "-std=c99 -Werror -Wextra -pedantic") -ELSE() - SET(CMAKE_C_FLAGS "-std=c99 -g -Wall -Wextra -pedantic -fsanitize=address") -ENDIF() -MESSAGE(STATUS "CMAKE_C_FLAGS: ${CMAKE_C_FLAGS}") +project(mv_none_space VERSION 1.1.5) -PROJECT(mv_none_space VERSION 1.1.5) +if("${CMAKE_BUILD_TYPE}" STREQUAL "Release") + set(CMAKE_C_FLAGS "-std=c99 -Werror -Wextra -pedantic") +else() + set(CMAKE_C_FLAGS "-std=c99 -g -Wall -Wextra -pedantic -fsanitize=address") +endif() +message(STATUS "CMAKE_C_FLAGS: ${CMAKE_C_FLAGS}") -ADD_SUBDIRECTORY(src) -ADD_SUBDIRECTORY(tests) \ No newline at end of file + + +add_subdirectory(src) +add_subdirectory(tests) \ No newline at end of file diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b1ab6f0..051cd5d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,22 +1,25 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 3.25.1) +cmake_minimum_required(VERSION 3.25.1) -CONFIGURE_FILE(config.h.in config.h) -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}) +configure_file(config.h.in config.h) +include_directories(${CMAKE_CURRENT_BINARY_DIR}) -ADD_EXECUTABLE(${PROJECT_NAME} main.c rename.c config.h) +add_executable(${PROJECT_NAME} + main.c + rename.c + config.h) -INSTALL(TARGETS ${PROJECT_NAME} +install(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) -SET(CPACK_GENERATOR "DEB") -SET(CPACK_DEBIAN_PACKAGE_NAME "mv-none-space") -SET(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT) -SET(CPACK_DEBIAN_PACKAGE_VERSION ${PROJECT_VERSION}) -SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64") -SET(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON) -SET(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS ON) -SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "Bastian Dehn ") -SET(CPACK_DEBIAN_PACKAGE_DESCRIPTION "tool to rename recursiv files with space and replace special chars") -SET(CPACK_DEBIAN_PACKAGE_PRIORITY "optional") -SET(CPACK_DEBIAN_PACKAGE_SECTION "utils") -INCLUDE(CPack) \ No newline at end of file +set(CPACK_GENERATOR "DEB") +set(CPACK_DEBIAN_PACKAGE_NAME "mv-none-space") +set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT) +set(CPACK_DEBIAN_PACKAGE_VERSION ${PROJECT_VERSION}) +set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64") +set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON) +set(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS ON) +set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Bastian Dehn ") +set(CPACK_DEBIAN_PACKAGE_DESCRIPTION "tool to rename recursiv files with space and replace special chars") +set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional") +set(CPACK_DEBIAN_PACKAGE_SECTION "utils") +include(CPack) \ No newline at end of file diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 687ff3d..5dd002b 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,12 +1,13 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 3.25.1) +cmake_minimum_required(VERSION 3.25.1) -FIND_LIBRARY(cmocka NAMES cmocka REQUIRED) +find_library(CMOCKA cmocka REQUIRED) -ADD_EXECUTABLE(rename_tests +add_executable(rename_tests rename_tests.c ../src/rename.c) -TARGET_LINK_LIBRARIES(rename_tests ${cmocka}) +target_link_libraries(rename_tests + ${CMOCKA}) -ADD_CUSTOM_TARGET(run_tests +add_custom_target(run_tests ALL ./rename_tests DEPENDS rename_tests) \ No newline at end of file -- 2.47.3