File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -90,10 +90,17 @@ include(FairRootSummary)
9090include (FairMacros )
9191include (WriteConfigFile )
9292include (CheckCompiler )
93+ include (FairRootCodemeta )
9394
9495if (FairCMakeModules_VERSION VERSION_GREATER_EQUAL 1.0.0)
9596 fair_get_git_version ()
9697endif ()
98+ get_codemeta_version ()
99+ if (PROJECT_CODEMETA_VERSION
100+ AND NOT "${PROJECT_CODEMETA_VERSION} " STREQUAL "${PROJECT_VERSION} " )
101+ message (AUTHOR_WARNING "Project Version (${PROJECT_VERSION} ) and "
102+ "CodeMeta Version (${PROJECT_CODEMETA_VERSION} ) do not match!" )
103+ endif ()
97104
98105set (LIBRARY_OUTPUT_PATH "${CMAKE_BINARY_DIR} /lib" )
99106
Original file line number Diff line number Diff line change 1+ ################################################################################
2+ # Copyright (C) 2023 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH #
3+ # #
4+ # This software is distributed under the terms of the #
5+ # GNU Lesser General Public Licence (LGPL) version 3, #
6+ # copied verbatim in the file "LICENSE" #
7+ ################################################################################
8+
9+ function (get_codemeta_version )
10+ if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.19)
11+ file (READ "${CMAKE_SOURCE_DIR} /codemeta.json" codemeta_content )
12+ string (JSON codemeta_version ERROR_VARIABLE json_error
13+ GET "${codemeta_content} " "softwareVersion" )
14+ if (NOT "${json_error} " STREQUAL "NOTFOUND" )
15+ string (JSON codemeta_version ERROR_VARIABLE json_error
16+ GET "${codemeta_content} " "version" )
17+ endif ()
18+ if (NOT "${json_error} " STREQUAL "NOTFOUND" )
19+ return ()
20+ endif ()
21+ string (REGEX REPLACE "^v" "" codemeta_version "${codemeta_version} " )
22+ set (PROJECT_CODEMETA_VERSION "${codemeta_version} " PARENT_SCOPE )
23+ endif ()
24+ endfunction ()
You can’t perform that action at this time.
0 commit comments