Version the lockfile

We are now versioning the configuration files, so we should apply the
same versioning to the lockfiles.

Fixes https://gitlab.com/kicad/code/kicad/issues/5637
This commit is contained in:
Seth Hillbrand 2020-09-15 09:31:24 -07:00
parent aa7e021bfc
commit 514838dbbf
2 changed files with 8 additions and 6 deletions

View File

@ -28,19 +28,19 @@ include( ${CMAKE_MODULE_PATH}/KiCadFullVersion.cmake )
# Extract the major and minor build version as a string
string( REGEX MATCH
"([0-9]+\\.[0-9]+)\\..*"
"([0-9]+)\\.([0-9]+)\\..*"
KICAD_MAJOR_MINOR_VERSION
"${KICAD_SEMANTIC_VERSION}"
)
if( CMAKE_MATCH_COUNT EQUAL 1 )
# Match slot 0 is the full string, so we want slot 1
set( KICAD_MAJOR_MINOR_VERSION "${CMAKE_MATCH_1}" )
if( CMAKE_MATCH_COUNT EQUAL 2 )
# Match slot 0 is the full string, so we want slots 1 & 2
set( KICAD_MAJOR_MINOR_VERSION "${CMAKE_MATCH_1}.${CMAKE_MATCH_2}" )
set( KICAD_MAJOR_VERSION "${CMAKE_MATCH_1}" )
else()
message( FATAL_ERROR "Unable to extract major and minor version string" )
endif()
set( _wvh_new_version_text
"/* Do not modify this file, it was automatically generated by CMake. */
@ -52,6 +52,7 @@ set( _wvh_new_version_text
#define KICAD_VERSION_FULL \"${KICAD_VERSION_FULL}\"
#define KICAD_SEMANTIC_VERSION \"${KICAD_SEMANTIC_VERSION}\"
#define KICAD_MAJOR_VERSION \"${KICAD_MAJOR_VERSION}\"
#define KICAD_MAJOR_MINOR_VERSION \"${KICAD_MAJOR_MINOR_VERSION}\"
#endif /* __KICAD_VERSION_H__ */

View File

@ -22,6 +22,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <build_version.h>
#include <lockfile.h>
#include <wx/filename.h>
@ -83,7 +84,7 @@ wxString GetKicadLockFilePath()
lockpath.AppendDir( ".cache" );
}
lockpath.AppendDir( "kicad" );
lockpath.AppendDir( wxString::Format( "kicad_v%d", GetMajorMinorVersion() ) );
#endif
#if defined( __WXMAC__ ) || defined( __UNIX__ )