Cleanup CMake files

- Replace tabs with spaces
- Use lowercase for CMake commands
- Unify alignment
- Remove superfluous empty line
- Add space after CMake command

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
This commit is contained in:
Thomas Lauf 2023-05-26 09:50:40 +02:00
parent 81bc57309b
commit 20a8a4a4cc
8 changed files with 51 additions and 42 deletions

View file

@ -17,8 +17,8 @@ if (EXISTS ${CMAKE_SOURCE_DIR}/.git/index)
execute_process (COMMAND git log -1 --pretty=format:%h execute_process (COMMAND git log -1 --pretty=format:%h
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE COMMIT) OUTPUT_VARIABLE COMMIT)
configure_file ( ${CMAKE_SOURCE_DIR}/commit.h.in configure_file (${CMAKE_SOURCE_DIR}/commit.h.in
${CMAKE_SOURCE_DIR}/commit.h) ${CMAKE_SOURCE_DIR}/commit.h)
message ("-- Found SHA1 reference: ${COMMIT}") message ("-- Found SHA1 reference: ${COMMIT}")
endif (EXISTS ${CMAKE_SOURCE_DIR}/.git/index) endif (EXISTS ${CMAKE_SOURCE_DIR}/.git/index)
@ -32,22 +32,21 @@ set (PACKAGE_STRING "${PACKAGE} ${VERSION}")
string (TIMESTAMP PACKAGE_DATE "%Y-%m-%d") string (TIMESTAMP PACKAGE_DATE "%Y-%m-%d")
if (FREEBSD OR DRAGONFLY) if (FREEBSD OR DRAGONFLY)
SET (TIMEW_MANDIR man CACHE STRING "Installation directory for man pages") set (TIMEW_MANDIR man CACHE STRING "Installation directory for man pages")
SET (TIMEW_MAN1DIR man/man1 CACHE STRING "Installation directory for man pages, section 1") set (TIMEW_MAN1DIR man/man1 CACHE STRING "Installation directory for man pages, section 1")
SET (TIMEW_MAN5DIR man/man5 CACHE STRING "Installation directory for man pages, section 5") set (TIMEW_MAN5DIR man/man5 CACHE STRING "Installation directory for man pages, section 5")
SET (TIMEW_MAN7DIR man/man7 CACHE STRING "Installation directory for man pages, section 7") set (TIMEW_MAN7DIR man/man7 CACHE STRING "Installation directory for man pages, section 7")
else (FREEBSD OR DRAGONFLY) else (FREEBSD OR DRAGONFLY)
SET (TIMEW_MANDIR share/man CACHE STRING "Installation directory for man pages") set (TIMEW_MANDIR share/man CACHE STRING "Installation directory for man pages")
SET (TIMEW_MAN1DIR share/man/man1 CACHE STRING "Installation directory for man pages, section 1") set (TIMEW_MAN1DIR share/man/man1 CACHE STRING "Installation directory for man pages, section 1")
SET (TIMEW_MAN5DIR share/man/man5 CACHE STRING "Installation directory for man pages, section 5") set (TIMEW_MAN5DIR share/man/man5 CACHE STRING "Installation directory for man pages, section 5")
SET (TIMEW_MAN7DIR share/man/man7 CACHE STRING "Installation directory for man pages, section 7") set (TIMEW_MAN7DIR share/man/man7 CACHE STRING "Installation directory for man pages, section 7")
endif (FREEBSD OR DRAGONFLY) endif (FREEBSD OR DRAGONFLY)
SET (TIMEW_DOCDIR share/doc/timew CACHE STRING "Installation directory for doc files") set (TIMEW_DOCDIR share/doc/timew CACHE STRING "Installation directory for doc files")
message ("-- Configuring cmake.h") message ("-- Configuring cmake.h")
configure_file ( configure_file (${CMAKE_SOURCE_DIR}/cmake.h.in
${CMAKE_SOURCE_DIR}/cmake.h.in ${CMAKE_SOURCE_DIR}/cmake.h)
${CMAKE_SOURCE_DIR}/cmake.h)
add_subdirectory (src) add_subdirectory (src)
add_subdirectory (src/commands) add_subdirectory (src/commands)
@ -66,9 +65,22 @@ endforeach (doc_FILE)
set (CPACK_SOURCE_GENERATOR "TGZ") set (CPACK_SOURCE_GENERATOR "TGZ")
set (CPACK_SOURCE_PACKAGE_FILE_NAME ${PACKAGE_NAME}-${PACKAGE_VERSION}) set (CPACK_SOURCE_PACKAGE_FILE_NAME ${PACKAGE_NAME}-${PACKAGE_VERSION})
set (CPACK_SOURCE_IGNORE_FILES "CMakeCache" "CMakeFiles" "CPackConfig" "CPackSourceConfig" set (CPACK_SOURCE_IGNORE_FILES "CMakeCache"
"_CPack_Packages" "cmake_install" "install_manifest" "Makefile$" "CMakeFiles"
"test" "package-config" "src/timew$" "src/libtimew.a" "CPackConfig"
"src/commands/libcommands.a" "src/lex$" "src/liblibshared.a" "CPackSourceConfig"
"/\\\\.gitignore" "/\\\\.git/" "swp$") "_CPack_Packages"
"cmake_install"
"install_manifest"
"Makefile$"
"test"
"package-config"
"src/timew$"
"src/libtimew.a"
"src/commands/libcommands.a"
"src/lex$"
"src/liblibshared.a"
"/\\\\.gitignore"
"/\\\\.git/"
"swp$")
include (CPack) include (CPack)

View file

@ -8,6 +8,7 @@
(thanks to Ankur Sinha) (thanks to Ankur Sinha)
- Use local man pages in tests - Use local man pages in tests
(thanks to Maxim Beder) (thanks to Maxim Beder)
- Cleanup CMake files
------ current release --------------------------- ------ current release ---------------------------

View file

@ -6,10 +6,9 @@ set (DOC_FILES)
foreach (SRC ${DOC_SOURCES}) foreach (SRC ${DOC_SOURCES})
string (REPLACE ".adoc" "" OUTPUT_FILE_NAME "${SRC}") string (REPLACE ".adoc" "" OUTPUT_FILE_NAME "${SRC}")
add_custom_command ( add_custom_command (OUTPUT "${OUTPUT_FILE_NAME}"
OUTPUT "${OUTPUT_FILE_NAME}" COMMAND ${ASCIIDOCTOR_EXECUTABLE} -b manpage ${ASCIIDOCTOR_OPTIONS} ${SRC} -o ${OUTPUT_FILE_NAME}
COMMAND ${ASCIIDOCTOR_EXECUTABLE} -b manpage ${ASCIIDOCTOR_OPTIONS} ${SRC} -o ${OUTPUT_FILE_NAME} DEPENDS "${SRC}")
DEPENDS "${SRC}")
set (DOC_FILES ${DOC_FILES} "${OUTPUT_FILE_NAME}") set (DOC_FILES ${DOC_FILES} "${OUTPUT_FILE_NAME}")
endforeach (SRC) endforeach (SRC)

View file

@ -6,10 +6,9 @@ set (DOC_FILES)
foreach (SRC ${DOC_SOURCES}) foreach (SRC ${DOC_SOURCES})
string (REPLACE ".adoc" "" OUTPUT_FILE_NAME "${SRC}") string (REPLACE ".adoc" "" OUTPUT_FILE_NAME "${SRC}")
add_custom_command ( add_custom_command (OUTPUT "${OUTPUT_FILE_NAME}"
OUTPUT "${OUTPUT_FILE_NAME}" COMMAND ${ASCIIDOCTOR_EXECUTABLE} -b manpage ${ASCIIDOCTOR_OPTIONS} ${SRC} -o ${OUTPUT_FILE_NAME}
COMMAND ${ASCIIDOCTOR_EXECUTABLE} -b manpage ${ASCIIDOCTOR_OPTIONS} ${SRC} -o ${OUTPUT_FILE_NAME} DEPENDS "${SRC}")
DEPENDS "${SRC}")
set (DOC_FILES ${DOC_FILES} "${OUTPUT_FILE_NAME}") set (DOC_FILES ${DOC_FILES} "${OUTPUT_FILE_NAME}")
endforeach (SRC) endforeach (SRC)

View file

@ -3,7 +3,7 @@ cmake_minimum_required (VERSION 2.8.12)
message ("-- Configuring theme documentation") message ("-- Configuring theme documentation")
install (FILES README DESTINATION ${TIMEW_DOCDIR}/doc/themes) install (FILES README DESTINATION ${TIMEW_DOCDIR}/doc/themes)
INSTALL (FILES dark.theme DESTINATION ${TIMEW_DOCDIR}/doc/themes) install (FILES dark.theme DESTINATION ${TIMEW_DOCDIR}/doc/themes)
INSTALL (FILES dark_blue.theme DESTINATION ${TIMEW_DOCDIR}/doc/themes) install (FILES dark_blue.theme DESTINATION ${TIMEW_DOCDIR}/doc/themes)
INSTALL (FILES dark_green.theme DESTINATION ${TIMEW_DOCDIR}/doc/themes) install (FILES dark_green.theme DESTINATION ${TIMEW_DOCDIR}/doc/themes)
INSTALL (FILES dark_red.theme DESTINATION ${TIMEW_DOCDIR}/doc/themes) install (FILES dark_red.theme DESTINATION ${TIMEW_DOCDIR}/doc/themes)

View file

@ -72,4 +72,3 @@ set_property (TARGET timew_executable PROPERTY OUTPUT_NAME "timew")
set_property (TARGET lex_executable PROPERTY OUTPUT_NAME "lex") set_property (TARGET lex_executable PROPERTY OUTPUT_NAME "lex")
install (TARGETS timew_executable DESTINATION bin) install (TARGETS timew_executable DESTINATION bin)

View file

@ -7,15 +7,14 @@ include_directories (${CMAKE_SOURCE_DIR}
set (ADDITIONAL_HELP_H "additional-help.h") set (ADDITIONAL_HELP_H "additional-help.h")
ADD_CUSTOM_COMMAND ( add_custom_command (OUTPUT ${ADDITIONAL_HELP_H}
OUTPUT ${ADDITIONAL_HELP_H} COMMAND /bin/sh src/commands/generate-additional-help.sh > src/commands/${ADDITIONAL_HELP_H}
COMMAND /bin/sh src/commands/generate-additional-help.sh > src/commands/${ADDITIONAL_HELP_H} DEPENDS ${CMAKE_CURRENT_LIST_DIR}/generate-additional-help.sh
DEPENDS ${CMAKE_CURRENT_LIST_DIR}/generate-additional-help.sh WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMENT "Generating ${ADDITIONAL_HELP_H}")
COMMENT "Generating ${ADDITIONAL_HELP_H}")
ADD_CUSTOM_TARGET (generate_additional_help add_custom_target (generate_additional_help
DEPENDS ${ADDITIONAL_HELP_H}) DEPENDS ${ADDITIONAL_HELP_H})
set (commands_SRCS CmdAnnotate.cpp set (commands_SRCS CmdAnnotate.cpp
CmdCancel.cpp CmdCancel.cpp

View file

@ -4,9 +4,9 @@ cmake_minimum_required (VERSION 2.8.12)
# https://gitlab.kitware.com/cmake/cmake/issues/16062 # https://gitlab.kitware.com/cmake/cmake/issues/16062
# The issue has been fixed in CMake 3.11.0; the policy is set # The issue has been fixed in CMake 3.11.0; the policy is set
# to OLD for compatibility with older versions of CMake only. # to OLD for compatibility with older versions of CMake only.
if(POLICY CMP0037 AND ${CMAKE_VERSION} VERSION_LESS "3.11.0") if (POLICY CMP0037 AND ${CMAKE_VERSION} VERSION_LESS "3.11.0")
cmake_policy(SET CMP0037 OLD) cmake_policy(SET CMP0037 OLD)
endif() endif ()
# If this is a debug build, check if we have libfiu installed and available on # If this is a debug build, check if we have libfiu installed and available on
# the system. If so, we will be able to use it to add additional tests of the # the system. If so, we will be able to use it to add additional tests of the