Browse Source

Rename the automatically generated version.h to kicad_build_version.h as a workaround to an issue in msys2: for a very obscure reason, version.h was added as dependency to most of .cpp files.

It was an issue, because each time the bzr version was modified, a full kicad rebuild was made.
It does not happen on Linux.
pull/7/head
jean-pierre charras 10 years ago
parent
commit
22fb7dafba
  1. 4
      CMakeModules/WriteVersionHeader.cmake
  2. 2
      common/CMakeLists.txt
  3. 4
      common/build_version.cpp

4
CMakeModules/WriteVersionHeader.cmake

@ -49,7 +49,7 @@ set( _wvh_write_version_file ON )
# Compare the version argument against the version in the existing header file for a mismatch.
if( EXISTS ${OUTPUT_FILE} )
file( STRINGS ${CMAKE_BINARY_DIR}/version.h _current_version_str
file( STRINGS ${OUTPUT_FILE} _current_version_str
REGEX "^#define[\t ]+KICAD_BUILD_VERSION[\t ]+.*" )
string( REGEX REPLACE "^#define KICAD_BUILD_VERSION \"([()a-zA-Z0-9 -.]+)\".*"
"\\1" _wvh_last_version "${_current_version_str}" )
@ -82,6 +82,6 @@ if( _wvh_write_version_file )
endif()
# There should always be a valid version.h file. Otherwise, the build will fail.
if( NOT EXISTS ${CMAKE_BINARY_DIR}/version.h )
if( NOT EXISTS ${OUTPUT_FILE} )
message( FATAL_ERROR "Configuration failed to write file ${OUTPUT_FILE}." )
endif()

2
common/CMakeLists.txt

@ -124,7 +124,7 @@ add_custom_target(
version_header ALL
COMMAND ${CMAKE_COMMAND}
-DKICAD_BUILD_VERSION=${KICAD_BUILD_VERSION}
-DOUTPUT_FILE=${CMAKE_BINARY_DIR}/version.h
-DOUTPUT_FILE=${CMAKE_BINARY_DIR}/kicad_build_version.h
-DSRC_PATH=${PROJECT_SOURCE_DIR}
-DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}
-P ${CMAKE_MODULE_PATH}/WriteVersionHeader.cmake

4
common/build_version.cpp

@ -22,12 +22,12 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/* Date for KiCad build version */
// Date for KiCad build version
#include <fctsys.h>
// The include file version.h is always created even if the repo version cannot be
// determined. In this case KICAD_BUILD_VERSION will default to "no-bzr".
#include <version.h>
#include <kicad_build_version.h>
/**

Loading…
Cancel
Save