From 0ed341a84c1ded47b1ea08c3389a84ef08a7e50f Mon Sep 17 00:00:00 2001 From: Chris Hennes Date: Wed, 10 Feb 2021 23:58:22 -0600 Subject: [PATCH] [CMAKE] Add Coin3D version info Modelled after the code for Eigen3, this adds a version check for Coin. If pkg_config (or some other method) finds the version string, just print that. If not, do a REGEX MATCH on the file in Coin's headers that includes the version information. Note that in this case the beta version information is excluded. --- cMake/FindCoin3D.cmake | 12 ++++++++++++ cMake/FreeCAD_Helpers/PrintFinalReport.cmake | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/cMake/FindCoin3D.cmake b/cMake/FindCoin3D.cmake index 08659ea5e9..b135302322 100644 --- a/cMake/FindCoin3D.cmake +++ b/cMake/FindCoin3D.cmake @@ -105,5 +105,17 @@ ENDIF (WIN32) IF(COIN3D_LIBRARIES) SET( COIN3D_FOUND "YES" ) message(STATUS "Coin3D libraries found") + + IF(NOT COIN3D_VERSION) + file(READ "${COIN3D_INCLUDE_DIRS}/Inventor/C/basic.h" _coin3d_basic_h) + string(REGEX MATCH "define[ \t]+COIN_MAJOR_VERSION[ \t]+([0-9?])" _coin3d_major_version_match "${_coin3d_basic_h}") + set(COIN3D_MAJOR_VERSION "${CMAKE_MATCH_1}") + string(REGEX MATCH "define[ \t]+COIN_MINOR_VERSION[ \t]+([0-9?])" _coin3d_minor_version_match "${_coin3d_basic_h}") + set(COIN3D_MINOR_VERSION "${CMAKE_MATCH_1}") + string(REGEX MATCH "define[ \t]+COIN_MICRO_VERSION[ \t]+([0-9?])" _coin3d_micro_version_match "${_coin3d_basic_h}") + set(COIN3D_MICRO_VERSION "${CMAKE_MATCH_1}") + set(COIN3D_VERSION "${COIN3D_MAJOR_VERSION}.${COIN3D_MINOR_VERSION}.${COIN3D_MICRO_VERSION}") + ENDIF() + ENDIF(COIN3D_LIBRARIES) diff --git a/cMake/FreeCAD_Helpers/PrintFinalReport.cmake b/cMake/FreeCAD_Helpers/PrintFinalReport.cmake index 96ea7de919..42de8595a4 100644 --- a/cMake/FreeCAD_Helpers/PrintFinalReport.cmake +++ b/cMake/FreeCAD_Helpers/PrintFinalReport.cmake @@ -166,7 +166,7 @@ macro(PrintFinalReport) message(STATUS "OpenGL: ${OPENGL_gl_LIBRARY}") message(STATUS "OpenGLU: ${OPENGL_glu_LIBRARY} [${OPENGL_glu_LIBRARY}][${OPENGL_INCLUDE_DIR}]") - message(STATUS "Coin3D: [${COIN3D_LIBRARIES}] [${COIN3D_INCLUDE_DIRS}]") + message(STATUS "Coin3D: ${COIN3D_VERSION} [${COIN3D_LIBRARIES}] [${COIN3D_INCLUDE_DIRS}]") if (WIN32)