View Issue Details

IDProjectCategoryView StatusLast Update
0002125FreeCADBugpublic2017-01-11 15:32
Reporterhobbes1069Assigned Towmayer 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
PlatformLinuxOSFedoraOS VersionMultiple
Product Version0.15 
Target VersionFixed in Version0.17 
Summary0002125: CMake shouldn't generate Version.in for release tarballs.
DescriptionThe CMake config tries to get the revision information using git, svn, mecurial, etc and when all that fails the fallback is to just read in the Version.h.in and write it out to Version.h in the CMAKE_BINARY_DIR.

In src/Build/CMakeLists.txt:
# as fallback if Version.h isn't created for any reason
if (NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/Version.h)
    file(READ ${CMAKE_CURRENT_SOURCE_DIR}/Version.h.in VERSION_INFO)
    file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/Version.h ${VERSION_INFO})
endif (NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/Version.h)

Since I'm using a tarball, all the "smart" methods fail and the fallback is executed. The problem is that there is already a Version.h in the source directory with the correct information but the one in the binary directory is found first.

The CMake config needs to be updated to check for the existence of the Version.h in the source tree before creating one in the binary tree.
Additional InformationSince the entirety of the cmake config in src/Build is around version detection, my proposal is to skip it if Version.h is found in the source tree:

diff -Naur freecad-0.14.3702.orig/src/CMakeLists.txt freecad-0.14.3702/src/CMakeLists.txt
--- freecad-0.14.3702.orig/src/CMakeLists.txt 2014-07-13 10:33:02.000000000 -0500
+++ freecad-0.14.3702/src/CMakeLists.txt 2015-05-28 11:08:21.169188616 -0500
@@ -1,5 +1,7 @@
-
-add_subdirectory(Build)
+# Do not generate a new Version.h if the source is a release tarball.
+if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/Build/Version.h)
+ add_subdirectory(Build)
+endif()
 add_subdirectory(3rdParty)
 add_subdirectory(Base)
 add_subdirectory(App)
TagsNo tags attached.

Activities

Kunda1

2017-01-10 17:46

administrator   ~0007614

Forum thread: http://forum.freecadweb.org/viewtopic.php?f=4&t=19780

Related Changesets

FreeCAD: master 675bcc25

2017-01-11 16:31:37

wmayer

Details Diff
fixes 0002125: CMake shouldn't generate Version.in for release tarballs. Affected Issues
0002125
mod - src/Build/CMakeLists.txt Diff File

Issue History

Date Modified Username Field Change
2015-05-28 16:26 hobbes1069 New Issue
2017-01-10 17:46 Kunda1 Note Added: 0007614
2017-01-10 18:33 wmayer Assigned To => wmayer
2017-01-10 18:33 wmayer Status new => assigned
2017-01-11 15:32 wmayer Changeset attached => FreeCAD Master master 675bcc25
2017-01-11 15:32 wmayer Status assigned => closed
2017-01-11 15:32 wmayer Resolution open => fixed
2017-01-11 15:32 wmayer Fixed in Version => 0.17