From 04fafa21e6d2668ed3753fe9c9a9061e18808262 Mon Sep 17 00:00:00 2001 From: Oleg Shparber Date: Mon, 11 Sep 2023 00:55:00 -0400 Subject: [PATCH] build(cmake): cleanup variable use Remove unneeded quotes. --- CMakeLists.txt | 8 ++++---- src/app/CMakeLists.txt | 42 +++++++++++++++++++++--------------------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0b47602c..631b8d0f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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") @@ -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. @@ -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 ") endif() diff --git a/src/app/CMakeLists.txt b/src/app/CMakeLists.txt index a2c23c0c..75d32fb5 100644 --- a/src/app/CMakeLists.txt +++ b/src/app/CMakeLists.txt @@ -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() @@ -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. @@ -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} @@ -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) @@ -104,16 +104,16 @@ set(CPACK_VERBATIM_VARIABLES YES) # Usage: cmake --build --preset --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) @@ -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") @@ -149,7 +149,7 @@ endif() # Set options for the source package. # Usage: cmake --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/"