Skip to content

Commit

Permalink
Whitespace fixup for CMake files
Browse files Browse the repository at this point in the history
replace tabs by spaces
  • Loading branch information
chris2511 committed Sep 6, 2024
1 parent 60ca584 commit d5d9e86
Show file tree
Hide file tree
Showing 5 changed files with 124 additions and 126 deletions.
72 changes: 36 additions & 36 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
cmake_minimum_required(VERSION 3.19.0)

project(xca
DESCRIPTION "X Certificate and Key management"
HOMEPAGE_URL http://xca.hohnstaedt.de
LANGUAGES CXX
DESCRIPTION "X Certificate and Key management"
HOMEPAGE_URL http://xca.hohnstaedt.de
LANGUAGES CXX
)

file(READ VERSION.txt ver)
string(REGEX MATCH "([0-9\.]*)" _ ${ver})
set(PROJECT_VERSION ${CMAKE_MATCH_1})

cmake_host_system_information(RESULT OS_DATA_LIST QUERY
OS_NAME OS_RELEASE OS_VERSION OS_PLATFORM)
OS_NAME OS_RELEASE OS_VERSION OS_PLATFORM)
list(JOIN OS_DATA_LIST " -- " OS_DATA)
message(STATUS ${OS_DATA})

string(REGEX MATCH "([0-9]+\.[0-9]+\.[0-9]+)" OSX_SDK_MINIMUM
${CMAKE_OSX_DEPLOYMENT_TARGET} ".0.0.0")
${CMAKE_OSX_DEPLOYMENT_TARGET} ".0.0.0")

include(GNUInstallDirs)
include(CTest)
Expand Down Expand Up @@ -82,7 +82,7 @@ configure_file(local.h.in local.h)
##### Libraries and executables
add_library(xcalib STATIC)
add_executable(${CMAKE_PROJECT_NAME} img/imgres.qrc lib/main.cpp
${UI_FILES} ${PROJECT_BINARY_DIR}/local.h)
${UI_FILES} ${PROJECT_BINARY_DIR}/local.h)
add_executable(xcadoc ${PROJECT_BINARY_DIR}/local.h)
add_executable(xcaexport ${PROJECT_BINARY_DIR}/local.h)

Expand Down Expand Up @@ -130,12 +130,12 @@ endif()
file(TO_CMAKE_PATH ${OPENSSL_ROOT_DIR} OPENSSL_ROOT_DIR)

target_link_libraries(xcalib
OpenSSL::Crypto
${QT}::Widgets ${QT}::Core ${QT}::Sql ${QT}::Help
${ASAN_LIB}
OpenSSL::Crypto
${QT}::Widgets ${QT}::Core ${QT}::Sql ${QT}::Help
${ASAN_LIB}
)
target_link_libraries(xcadoc
OpenSSL::Crypto ${QT}::Core ${ASAN_LIB}
OpenSSL::Crypto ${QT}::Core ${ASAN_LIB}
)
target_link_libraries(xcaexport ${QT}::Core ${ASAN_LIB})
target_link_libraries(${CMAKE_PROJECT_NAME} ${ASAN_LIB} xcalib)
Expand All @@ -145,7 +145,7 @@ if (APPLE)
find_library(IOKIT_LIBRARY IOKit)
find_library(COREFOUNDATION_LIBRARY CoreFoundation)
target_link_libraries(${CMAKE_PROJECT_NAME}
${IOKIT_LIBRARY} ${COREFOUNDATION_LIBRARY}
${IOKIT_LIBRARY} ${COREFOUNDATION_LIBRARY}
)
set(CMAKE_MACOSX_BUNDLE ON)

Expand Down Expand Up @@ -191,9 +191,9 @@ include(img/CMakeLists.txt)
include(test/CMakeLists.txt)

install(TARGETS ${CMAKE_PROJECT_NAME}
RESOURCE DESTINATION Resources
BUNDLE DESTINATION .
RUNTIME DESTINATION ${RUNTIME_DEST}
RESOURCE DESTINATION Resources
BUNDLE DESTINATION .
RUNTIME DESTINATION ${RUNTIME_DEST}
)

set(CPACK_PACKAGE_VERSION "${PROJECT_VERSION}")
Expand All @@ -203,10 +203,10 @@ set(CPACK_PACKAGE_VERSION "${PROJECT_VERSION}")

if(APPLE)
set_target_properties(${CMAKE_PROJECT_NAME} PROPERTIES
MACOSX_BUNDLE TRUE
XCODE_ATTRIBUTE_INSTALL_PATH /Applications
XCODE_ATTRIBUTE_SKIP_INSTALL No
RESOURCE "${APP_RESOURCES}"
MACOSX_BUNDLE TRUE
XCODE_ATTRIBUTE_INSTALL_PATH /Applications
XCODE_ATTRIBUTE_SKIP_INSTALL No
RESOURCE "${APP_RESOURCES}"
)
find_program(MACDEPLOYQT_EXECUTABLE macdeployqt HINTS ${_qt_bin_dir})
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
Expand All @@ -230,9 +230,9 @@ if(APPLE)
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND codesign --deep --signature-size=96000
--options=runtime --timestamp
--entitlements ${PROJECT_SOURCE_DIR}/misc/entitlement${APPSTORE}.plist
--force -s ${APPLE_DEVELOPER_CERT}
$<TARGET_FILE_DIR:${PROJECT_NAME}>/../..
--entitlements ${PROJECT_SOURCE_DIR}/misc/entitlement${APPSTORE}.plist
--force -s ${APPLE_DEVELOPER_CERT}
$<TARGET_FILE_DIR:${PROJECT_NAME}>/../..
COMMENT "Running codesign for ${APPLE_DEVELOPER_CERT} ..."
DEPENDS ${PROJECT_SOURCE_DIR}/misc/entitlement${APPSTORE}.plist
)
Expand Down Expand Up @@ -274,26 +274,26 @@ elseif(WIN32)
)
target_link_options(${CMAKE_PROJECT_NAME} PRIVATE -mwindows -MD)
install(DIRECTORY
${CMAKE_BINARY_DIR}/platforms
${CMAKE_BINARY_DIR}/sqldrivers
${CMAKE_BINARY_DIR}/styles
DESTINATION ${RUNTIME_DEST}
${CMAKE_BINARY_DIR}/platforms
${CMAKE_BINARY_DIR}/sqldrivers
${CMAKE_BINARY_DIR}/styles
DESTINATION ${RUNTIME_DEST}
)
install(FILES ${CMAKE_BINARY_DIR}/${QT}Core.dll
${CMAKE_BINARY_DIR}/${QT}Gui.dll
${CMAKE_BINARY_DIR}/${QT}Help.dll
${CMAKE_BINARY_DIR}/${QT}Sql.dll
${CMAKE_BINARY_DIR}/${QT}Widgets.dll
${CMAKE_BINARY_DIR}/libgcc_s_seh-1.dll
${CMAKE_BINARY_DIR}/libstdc++-6.dll
${CMAKE_BINARY_DIR}/libwinpthread-1.dll
${SYSTEM32}/vcruntime140.dll
${OPENSSL_ROOT_DIR}/bin/libcrypto-${OPENSSL_LIBRARY_MAJOR}-x64.dll
DESTINATION ${RUNTIME_DEST}
${CMAKE_BINARY_DIR}/${QT}Gui.dll
${CMAKE_BINARY_DIR}/${QT}Help.dll
${CMAKE_BINARY_DIR}/${QT}Sql.dll
${CMAKE_BINARY_DIR}/${QT}Widgets.dll
${CMAKE_BINARY_DIR}/libgcc_s_seh-1.dll
${CMAKE_BINARY_DIR}/libstdc++-6.dll
${CMAKE_BINARY_DIR}/libwinpthread-1.dll
${SYSTEM32}/vcruntime140.dll
${OPENSSL_ROOT_DIR}/bin/libcrypto-${OPENSSL_LIBRARY_MAJOR}-x64.dll
DESTINATION ${RUNTIME_DEST}
)
if (OPENSSL_VERSION VERSION_GREATER_EQUAL 3.0.0)
install(FILES ${OPENSSL_ROOT_DIR}/lib/ossl-modules/legacy.dll
DESTINATION ${RUNTIME_DEST})
DESTINATION ${RUNTIME_DEST})
endif()
install(CODE "execute_process(COMMAND cmake -E chdir \${CMAKE_INSTALL_PREFIX} tar cvf ${RUNTIME_DEST}.zip --format=zip -- ${RUNTIME_DEST})")
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR})
Expand Down
38 changes: 19 additions & 19 deletions cmake/git_version.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,41 +8,41 @@ list(GET VERSION_LIST 2 PROJECT_VERSION_PATCH)
if(Git_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git")
message(STATUS "Git found: ${GIT_EXECUTABLE}")
execute_process(COMMAND git rev-parse HEAD
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_REV
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_REV
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
)
execute_process(COMMAND git diff-index --quiet HEAD --
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
OUTPUT_QUIET ERROR_QUIET
RESULT_VARIABLE GIT_LOCAL_CHANGES
OUTPUT_STRIP_TRAILING_WHITESPACE
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
OUTPUT_QUIET ERROR_QUIET
RESULT_VARIABLE GIT_LOCAL_CHANGES
OUTPUT_STRIP_TRAILING_WHITESPACE
)
execute_process(COMMAND git rev-list --count RELEASE.${PROJECT_VERSION}..HEAD
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_COMMIT_COUNTER
RESULT_VARIABLE GIT_COMMIT_COUNTER_RESULT
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_COMMIT_COUNTER
RESULT_VARIABLE GIT_COMMIT_COUNTER_RESULT
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
)
if(NOT GIT_COMMIT_COUNTER_RESULT)
math(EXPR PROJECT_VERSION_PATCH "${PROJECT_VERSION_PATCH} + ${GIT_COMMIT_COUNTER}")
set(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
message(STATUS "Commit counter: ${GIT_COMMIT_COUNTER} - ${GIT_REV} - ${PROJECT_VERSION}")
endif()
set(RELEASE_TAG "RELEASE.${PROJECT_VERSION}"
CACHE STRING "Release TAG for the release")
CACHE STRING "Release TAG for the release")
if (DEFINED ENV{RELEASE_TAG})
set(RELEASE_TAG "$ENV{RELEASE_TAG}")
endif()
set(RELEASE_NAME "${PROJECT_NAME}-${PROJECT_VERSION}")
add_custom_command(
OUTPUT "${RELEASE_NAME}.tar.gz"
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
COMMAND git archive --format=tar.gz --prefix=${RELEASE_NAME}/
${RELEASE_TAG} > ${CMAKE_BINARY_DIR}/${RELEASE_NAME}.tar.gz
COMMENT "Create ${RELEASE_NAME}.tar.gz from tag ${RELEASE_TAG}"
OUTPUT "${RELEASE_NAME}.tar.gz"
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
COMMAND git archive --format=tar.gz --prefix=${RELEASE_NAME}/
${RELEASE_TAG} > ${CMAKE_BINARY_DIR}/${RELEASE_NAME}.tar.gz
COMMENT "Create ${RELEASE_NAME}.tar.gz from tag ${RELEASE_TAG}"
)
add_custom_target(release DEPENDS ${RELEASE_NAME}.tar.gz)

Expand Down
6 changes: 3 additions & 3 deletions cmake/text_header_file.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ if (FILE AND SRC AND DST)
file(READ "${SRC}/preamble.txt" PREAMBLE)
file(READ "${SRC}/${FILE}.text" CONT)
file(WRITE "${DST}/${FILE}.txt"
${PREAMBLE} "\n# "
${DIR_HINT} "\n"
${CONT})
${PREAMBLE} "\n# "
${DIR_HINT} "\n"
${CONT})
else()
message(FATAL_ERROR "Mandatory FILE or SRC variable not defined")
endif()
Expand Down
114 changes: 56 additions & 58 deletions doc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ find_program(SPHINX sphinx-build)
find_package(Qt6 QUIET OPTIONAL_COMPONENTS ToolsTools)

set(FILENAMES
index commandline requests object-ids common-actions database options
certificates revocationlist changelog introduction privatekey
step-by-step certificate-input template smartcard miscellaneous
index commandline requests object-ids common-actions database options
certificates revocationlist changelog introduction privatekey
step-by-step certificate-input template smartcard miscellaneous
)

foreach(file ${FILENAMES})
Expand Down Expand Up @@ -41,53 +41,53 @@ WixFile(${D}/documentation.wxs ${WIX_DOC_CONTENT})
if(SPHINX)
configure_file(${S}/conf.py.in ${RST}/conf.py)
add_custom_command(
OUTPUT ${HTML_DEST}
COMMAND ${SPHINX} -q -b html ${RST} ${D}/html
DEPENDS ${RST}/conf.py sphinx-src
COMMENT "Create HTML documentation"
OUTPUT ${HTML_DEST}
COMMAND ${SPHINX} -q -b html ${RST} ${D}/html
DEPENDS ${RST}/conf.py sphinx-src
COMMENT "Create HTML documentation"
)
add_custom_target(sphinx-html DEPENDS ${HTML_DEST})
add_custom_command(
OUTPUT ${D}/qthelp/xca.qhcp ${D}/qthelp/xca.qhp ${QTHELP_DEST}
COMMAND ${SPHINX} -q -b qthelp ${RST} ${D}/qthelp
DEPENDS ${RST}/conf.py sphinx-src
COMMENT "Create context sensitive help"
OUTPUT ${D}/qthelp/xca.qhcp ${D}/qthelp/xca.qhp ${QTHELP_DEST}
COMMAND ${SPHINX} -q -b qthelp ${RST} ${D}/qthelp
DEPENDS ${RST}/conf.py sphinx-src
COMMENT "Create context sensitive help"
)
add_custom_target(sphinx-qthelp
DEPENDS ${D}/qthelp/xca.qhcp ${D}/qthelp/xca.qhp ${QTHELP_DEST}
DEPENDS ${D}/qthelp/xca.qhcp ${D}/qthelp/xca.qhp ${QTHELP_DEST}
)
add_custom_command(
OUTPUT ${RST}/database_schema.sql
COMMAND ${CMAKE_COMMAND} -E make_directory ${RST}/_static
COMMAND ${CMAKE_COMMAND}
-D SRC=${PROJECT_SOURCE_DIR}/lib/database_schema.cpp
-D DST=${RST}/database_schema.sql
-P ${PROJECT_SOURCE_DIR}/cmake/database_schema.cmake
DEPENDS ${PROJECT_SOURCE_DIR}/lib/database_schema.cpp
COMMENT "Generating database schema SQL documentation"
OUTPUT ${RST}/database_schema.sql
COMMAND ${CMAKE_COMMAND} -E make_directory ${RST}/_static
COMMAND ${CMAKE_COMMAND}
-D SRC=${PROJECT_SOURCE_DIR}/lib/database_schema.cpp
-D DST=${RST}/database_schema.sql
-P ${PROJECT_SOURCE_DIR}/cmake/database_schema.cmake
DEPENDS ${PROJECT_SOURCE_DIR}/lib/database_schema.cpp
COMMENT "Generating database schema SQL documentation"
)
add_custom_command(
OUTPUT ${D}/rst.stamp
BYPRODUCTS ${RST}/COPYRIGHT ${RST}/changelog ${RST_DEST}
COMMAND ${CMAKE_COMMAND} -E make_directory ${RST}/_static
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${PROJECT_SOURCE_DIR}/img/bigcert.png
${RST}/_static
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${PROJECT_SOURCE_DIR}/COPYRIGHT
${PROJECT_SOURCE_DIR}/changelog
${RST_SOURCE} ${RST}
COMMAND ${CMAKE_COMMAND} -E touch ${D}/rst.stamp
DEPENDS ${PROJECT_SOURCE_DIR}/COPYRIGHT
${PROJECT_SOURCE_DIR}/changelog
${RST_SOURCE}
COMMENT "Prepare Sphinx source directory"
OUTPUT ${D}/rst.stamp
BYPRODUCTS ${RST}/COPYRIGHT ${RST}/changelog ${RST_DEST}
COMMAND ${CMAKE_COMMAND} -E make_directory ${RST}/_static
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${PROJECT_SOURCE_DIR}/img/bigcert.png
${RST}/_static
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${PROJECT_SOURCE_DIR}/COPYRIGHT
${PROJECT_SOURCE_DIR}/changelog
${RST_SOURCE} ${RST}
COMMAND ${CMAKE_COMMAND} -E touch ${D}/rst.stamp
DEPENDS ${PROJECT_SOURCE_DIR}/COPYRIGHT
${PROJECT_SOURCE_DIR}/changelog
${RST_SOURCE}
COMMENT "Prepare Sphinx source directory"
)
add_custom_command(
OUTPUT ${RST}/arguments.rst
DEPENDS xcadoc
COMMAND xcadoc rst ${RST}/arguments.rst
COMMENT "Generate 'rst' commandline documentation"
OUTPUT ${RST}/arguments.rst
DEPENDS xcadoc
COMMAND xcadoc rst ${RST}/arguments.rst
COMMENT "Generate 'rst' commandline documentation"
)
target_sources(${CMAKE_PROJECT_NAME} PRIVATE ${HTML_DEST})
foreach(EXPORT_TOPIC x509 x509-clp key key-clp request revocation)
Expand All @@ -103,10 +103,10 @@ if(SPHINX)

add_dependencies(${CMAKE_PROJECT_NAME} sphinx-html)
add_custom_target(sphinx-src
DEPENDS ${D}/rst.stamp
${RST}/database_schema.sql
${RST}/arguments.rst
${EXPORT_TOPICS}
DEPENDS ${D}/rst.stamp
${RST}/database_schema.sql
${RST}/arguments.rst
${EXPORT_TOPICS}
)

if (UNIX)
Expand Down Expand Up @@ -134,10 +134,10 @@ if(SPHINX)
if(QHELPGEN)
set(QTHELP_IDX ${D}/qthelp/xca.qhc)
add_custom_command(
OUTPUT ${QTHELP_IDX} ${D}/qthelp/xca.qch
COMMAND ${QHELPGEN} ${D}/qthelp/xca.qhcp
DEPENDS sphinx-qthelp
COMMENT "Create context sensitive help index"
OUTPUT ${QTHELP_IDX} ${D}/qthelp/xca.qch
COMMAND ${QHELPGEN} ${D}/qthelp/xca.qhcp
DEPENDS sphinx-qthelp
COMMENT "Create context sensitive help index"
)
add_custom_target(sphinx-qtcollgen DEPENDS ${QTHELP_IDX})
target_sources(${CMAKE_PROJECT_NAME} PRIVATE ${QTHELP_DEST} ${QTHELP_IDX})
Expand All @@ -163,22 +163,20 @@ endif(SPHINX)

if (NOT WIN32)
add_custom_command(
OUTPUT "${D}/xca.1.gz"
COMMAND cat "${S}/xca.1.head" "${D}/xca.1.options" "${S}/xca.1.tail" | gzip -n9 > "${D}/xca.1.gz"
DEPENDS "${S}/xca.1.head" "${S}/xca.1.tail"
"${D}/xca.1.options"
COMMENT "Compiling man page"
OUTPUT "${D}/xca.1.gz"
COMMAND cat "${S}/xca.1.head" "${D}/xca.1.options" "${S}/xca.1.tail" | gzip -n9 > "${D}/xca.1.gz"
DEPENDS "${S}/xca.1.head" "${S}/xca.1.tail"
"${D}/xca.1.options"
COMMENT "Compiling man page"
)
add_custom_command(
OUTPUT "${D}/xca.1.options"
COMMAND xcadoc man "${D}/xca.1.options"
COMMENT "Generate 'man' commandline documentation"
OUTPUT "${D}/xca.1.options"
COMMAND xcadoc man "${D}/xca.1.options"
COMMENT "Generate 'man' commandline documentation"
)
add_custom_target(manpage ALL DEPENDS ${D}/xca.1.gz)
if (NOT APPLE)
install(FILES "${D}/xca.1.gz"
DESTINATION ${CMAKE_INSTALL_MANDIR}/man1
)
install(FILES "${D}/xca.1.gz" DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
endif()
add_dependencies(${CMAKE_PROJECT_NAME} manpage)
endif()
Loading

0 comments on commit d5d9e86

Please sign in to comment.