diff --git a/CMakeLists.txt b/CMakeLists.txt index 23db210..0758165 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,6 +51,13 @@ if(Git_FOUND) ) string(SUBSTRING ${SEMVER_BUILD} 0 7 SEMVER_BUILD) endif() +set(SEMVER ${SEMVER_VERSION_CORE}) +if(DEFINED SEMVER_PRE_RELEASE) + string(APPEND SEMVER "-${SEMVER_PRE_RELEASE}") +endif() +if(DEFINED SEMVER_BUILD) + string(APPEND SEMVER "+${SEMVER_BUILD}") +endif() configure_file( "${CMAKE_SOURCE_DIR}/src/racer/version.hpp.in" @@ -98,16 +105,16 @@ endif() # Create target directory, only include project version in release builds string(TOLOWER ${CMAKE_BUILD_TYPE} BUILD_TYPE_LC) set(TARGET_DIRECTORY "target") -set(TARGET_BASENAME "${PROJECT_NAME}-${PROJECT_VERSION}-${TARGET_TRIPLE}-${BUILD_TYPE_LC}") +set(TARGET_BASENAME "${PROJECT_NAME}-${SEMVER}-${TARGET_TRIPLE}-${BUILD_TYPE_LC}") set(TARGET_PATH "${TARGET_DIRECTORY}/${TARGET_BASENAME}") # Create zip archive on Windows, tar.gz archive on other platforms if(CMAKE_SYSTEM_NAME STREQUAL "Windows") set(TARGET_ARCHIVE "${TARGET_BASENAME}.zip") - set(ARCHIVE_COMMAND cd ${CMAKE_SOURCE_DIR}/${TARGET_PATH} && zip -r ${TARGET_ARCHIVE} ${TARGET_BASENAME}) + set(ARCHIVE_COMMAND cd ${CMAKE_SOURCE_DIR}/${TARGET_DIRECTORY} && zip -r ${TARGET_ARCHIVE} ${TARGET_BASENAME}) else() set(TARGET_ARCHIVE "${TARGET_BASENAME}.tar.gz") - set(ARCHIVE_COMMAND tar -czvf ${CMAKE_SOURCE_DIR}/${TARGET_PATH}/${TARGET_ARCHIVE} -C ${CMAKE_SOURCE_DIR}/${TARGET_PATH} ${TARGET_BASENAME}) + set(ARCHIVE_COMMAND tar -czvf ${CMAKE_SOURCE_DIR}/${TARGET_DIRECTORY}/${TARGET_ARCHIVE} -C ${CMAKE_SOURCE_DIR}/${TARGET_DIRECTORY} ${TARGET_BASENAME}) endif() set(PROJECT_ASSETS_SOURCE_PATH ${CMAKE_SOURCE_DIR}/src/racer/assets) @@ -125,7 +132,7 @@ if(CMAKE_BUILD_TYPE STREQUAL "Release") COMMAND ${CMAKE_COMMAND} -E copy $/${TARGET_EXECUTABLE} ${CMAKE_SOURCE_DIR}/${TARGET_PATH}/${TARGET_EXECUTABLE} COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_ASSETS_SOURCE_PATH} ${CMAKE_SOURCE_DIR}/${TARGET_PATH}/assets COMMAND ${ARCHIVE_COMMAND} - COMMAND sha256sum ${CMAKE_SOURCE_DIR}/${TARGET_PATH}/${TARGET_ARCHIVE} > ${CMAKE_SOURCE_DIR}/${TARGET_PATH}/${TARGET_ARCHIVE}.sha256 + COMMAND sha256sum ${CMAKE_SOURCE_DIR}/${TARGET_DIRECTORY}/${TARGET_ARCHIVE} > ${CMAKE_SOURCE_DIR}/${TARGET_DIRECTORY}/${TARGET_ARCHIVE}.sha256 ) else() # Create symlink to assets directory for development