Skip to content

Commit

Permalink
[cmake] move derivation of version components to own function
Browse files Browse the repository at this point in the history
  • Loading branch information
andrei-toterman committed Dec 13, 2024
1 parent 0925844 commit 4a313e7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 2 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,12 @@ function(determine_version OUTPUT_VARIABLE SEMANTIC_VERSION BUILD_NUMBER)

if(VERSION_MATCH)
set(${OUTPUT_VARIABLE} ${CMAKE_MATCH_1} PARENT_SCOPE)
set(VERSION_STRING ${CMAKE_MATCH_1})
else()
message(FATAL_ERROR "Invalid tag detected: ${NEW_VERSION}")
endif()
endfunction()

function(determine_version_components VERSION_STRING SEMANTIC_VERSION BUILD_NUMBER)
# stuff before + is the version and after the + is the build metadata
string(FIND "${VERSION_STRING}" "+" PLUS_POS)
string(SUBSTRING "${VERSION_STRING}" 0 ${PLUS_POS} MULTIPASS_SEMANTIC_VERSION)
Expand All @@ -234,8 +235,6 @@ endfunction()
determine_version(MULTIPASS_VERSION MULTIPASS_SEMANTIC_VERSION MULTIPASS_BUILD_NUMBER)
set(MULTIPASS_VERSION ${MULTIPASS_VERSION})
message(STATUS "Setting version to: ${MULTIPASS_VERSION}")
message(STATUS "Setting semantic version to: ${MULTIPASS_SEMANTIC_VERSION}")
message(STATUS "Setting build number to: ${MULTIPASS_BUILD_NUMBER}")

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
Expand Down
4 changes: 4 additions & 0 deletions src/client/gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

determine_version_components(${MULTIPASS_VERSION} MULTIPASS_SEMANTIC_VERSION MULTIPASS_BUILD_NUMBER)
message(STATUS "Setting semantic version to: ${MULTIPASS_SEMANTIC_VERSION}")
message(STATUS "Setting build number to: ${MULTIPASS_BUILD_NUMBER}")

add_library(dart_ffi SHARED ffi/dart_ffi.cpp)

target_link_libraries(dart_ffi
Expand Down

0 comments on commit 4a313e7

Please sign in to comment.