Skip to content

Commit

Permalink
build(cmake): cleanup variable use
Browse files Browse the repository at this point in the history
Remove unneeded quotes.
  • Loading branch information
trollixx committed Sep 11, 2023
1 parent 9f7be47 commit 04fafa2
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 25 deletions.
8 changes: 4 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ project(Zeal

# Set to TRUE for a tagged release.
# NOTE: Don't forget to add a new release entry in the AppStream metadata!
set(RELEASE_VERSION FALSE)
set(ZEAL_RELEASE_BUILD FALSE)

# Project information.
set(PROJECT_COMPANY_NAME "Oleg Shparber")
Expand All @@ -28,7 +28,7 @@ else()
endif()

# Determine version for dev builds.
if(NOT RELEASE_VERSION)
if(NOT ZEAL_RELEASE_BUILD)
message(NOTICE "Building unreleased code. Proceed at your own risk!")

# TODO: Add support for metadata passed from env, e.g. aur, appimage, etc.
Expand All @@ -48,10 +48,10 @@ endif()
set(ZEAL_VERSION_FULL "${Zeal_VERSION}${ZEAL_VERSION_SUFFIX}")
message(NOTICE "Calculated Zeal version: ${ZEAL_VERSION_FULL}")

file(WRITE "${CMAKE_BINARY_DIR}/zeal_version" "${ZEAL_VERSION_FULL}")
file(WRITE "${CMAKE_BINARY_DIR}/zeal_version" ${ZEAL_VERSION_FULL})

# For development builds insert an extra release in the AppStream metadata.
if(NOT RELEASE_VERSION)
if(NOT ZEAL_RELEASE_BUILD)
string(TIMESTAMP ZEAL_APPSTREAM_DEV_RELEASE "\n <release date=\"%Y-%m-%d\" version=\"${ZEAL_VERSION_FULL}\" type=\"development\" />")
endif()

Expand Down
42 changes: 21 additions & 21 deletions src/app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ endif()

# Define output binary name.
if(APPLE)
set(PROJECT_OUTPUT_NAME "${CMAKE_PROJECT_NAME}")
set(_project_output_name ${CMAKE_PROJECT_NAME})
else()
string(TOLOWER "${CMAKE_PROJECT_NAME}" PROJECT_OUTPUT_NAME)
string(TOLOWER ${CMAKE_PROJECT_NAME} _project_output_name)
endif()

set(PROJECT_EXECUTABLE_NAME "${PROJECT_OUTPUT_NAME}${CMAKE_EXECUTABLE_SUFFIX}")
set(PROJECT_EXECUTABLE_NAME "${_project_output_name}${CMAKE_EXECUTABLE_SUFFIX}")
message(STATUS "Project executable name: ${PROJECT_EXECUTABLE_NAME}")

# Only support installing runtime dependencies with Qt >=6.5.1 (see QTBUG-111741).
if(Qt${QT_VERSION_MAJOR}Widgets_VERSION VERSION_GREATER_EQUAL "6.5.1")
set(use_qt_cmake_commands TRUE)
set(_use_qt_cmake_commands TRUE)

qt_standard_project_setup()
endif()
Expand Down Expand Up @@ -46,15 +46,15 @@ endif()
target_link_libraries(App PRIVATE Core Util Qt${QT_VERSION_MAJOR}::Widgets)

set_target_properties(App PROPERTIES
OUTPUT_NAME ${PROJECT_OUTPUT_NAME}
OUTPUT_NAME ${_project_output_name}
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}
)

# Install Qt runtime dependencies on Windows.
if(WIN32 AND use_qt_cmake_commands)
if(WIN32 AND _use_qt_cmake_commands)
qt_generate_deploy_script(
TARGET App
OUTPUT_SCRIPT qt_deploy_script
OUTPUT_SCRIPT _qt_deploy_script
CONTENT "
# TODO: Run windeployqt after build.
# Override deployment script's working directory.
Expand All @@ -71,7 +71,7 @@ endif()
if(APPLE)
set_target_properties(App PROPERTIES
MACOSX_BUNDLE TRUE
MACOSX_BUNDLE_BUNDLE_NAME ${PROJECT_NAME}
MACOSX_BUNDLE_BUNDLE_NAME ${CMAKE_PROJECT_NAME}
MACOSX_BUNDLE_GUI_IDENTIFIER "org.zealdocs.zeal"
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
MACOSX_BUNDLE_LONG_VERSION_STRING ${PROJECT_VERSION}
Expand All @@ -83,12 +83,12 @@ if(APPLE)
elseif(WIN32)
install(TARGETS App RUNTIME DESTINATION .)

if(use_qt_cmake_commands)
if(_use_qt_cmake_commands)
# Install Qt runtime dependencies.
install(SCRIPT ${qt_deploy_script})
install(SCRIPT ${_qt_deploy_script})

unset(qt_deploy_script)
unset(use_qt_cmake_commands)
unset(_qt_deploy_script)
unset(_use_qt_cmake_commands)
endif()
elseif(UNIX)
include(GNUInstallDirs)
Expand All @@ -104,16 +104,16 @@ set(CPACK_VERBATIM_VARIABLES YES)

# Usage: cmake --build --preset <preset-name> --target package
# E.g. cmake --build build --preset ninja-multi-vcpkg-release --target package
set(CPACK_PACKAGE_NAME "${CMAKE_PROJECT_NAME}")
set(CPACK_PACKAGE_NAME ${CMAKE_PROJECT_NAME})
set(CPACK_PACKAGE_DESCRIPTION ${CMAKE_PROJECT_DESCRIPTION})
set(CPACK_PACKAGE_VENDOR "${PROJECT_COMPANY_NAME}")
set(CPACK_PACKAGE_VERSION "${PROJECT_VERSION}")
set(CPACK_PACKAGE_FILE_NAME "${PROJECT_OUTPUT_NAME}-${ZEAL_VERSION_FULL}")
set(CPACK_PACKAGE_VENDOR ${PROJECT_COMPANY_NAME})
set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
set(CPACK_PACKAGE_FILE_NAME "${_project_output_name}-${ZEAL_VERSION_FULL}")
set(CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/src/app/resources/zeal.ico")

set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME}")
set(CPACK_PACKAGE_EXECUTABLES "${PROJECT_OUTPUT_NAME}" "${CPACK_PACKAGE_NAME}")
set(CPACK_CREATE_DESKTOP_LINKS "${PROJECT_OUTPUT_NAME}" "${CPACK_PACKAGE_NAME}")
set(CPACK_PACKAGE_INSTALL_DIRECTORY ${CPACK_PACKAGE_NAME})
set(CPACK_PACKAGE_EXECUTABLES ${_project_output_name} ${CPACK_PACKAGE_NAME})
set(CPACK_CREATE_DESKTOP_LINKS ${_project_output_name} ${CPACK_PACKAGE_NAME})

# Allow CPack to do text to RTF conversion.
configure_file("${CMAKE_SOURCE_DIR}/COPYING" "${CMAKE_CURRENT_BINARY_DIR}/license.txt" COPYONLY)
Expand All @@ -125,7 +125,7 @@ set(CPACK_PACKAGE_CHECKSUM SHA256)
if(WIN32)
# CPack WiX configuration.
set(CPACK_WIX_UPGRADE_GUID "5C4B6030-A1B4-4EFE-A5AF-28F6FA2E7978")
set(CPACK_WIX_PROPERTY_ARPURLINFOABOUT "${CMAKE_PROJECT_HOMEPAGE_URL}")
set(CPACK_WIX_PROPERTY_ARPURLINFOABOUT ${CMAKE_PROJECT_HOMEPAGE_URL})
set(CPACK_WIX_PRODUCT_ICON "${CMAKE_SOURCE_DIR}/src/app/resources/zeal.ico")
#set(CPACK_WIX_UI_BANNER "${CMAKE_SOURCE_DIR}/pkg/wix/banner.png")
#set(CPACK_WIX_UI_DIALOG "${CMAKE_SOURCE_DIR}/pkg/wix/dialog.png")
Expand All @@ -149,7 +149,7 @@ endif()
# Set options for the source package.
# Usage: cmake --build <build> --target package_source
set(CPACK_SOURCE_GENERATOR "TGZ;TXZ;ZIP")
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${PROJECT_OUTPUT_NAME}-${ZEAL_VERSION_FULL}")
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${_project_output_name}-${ZEAL_VERSION_FULL}")
set(CPACK_SOURCE_IGNORE_FILES
# Directories.
".git/"
Expand Down

0 comments on commit 04fafa2

Please sign in to comment.