Skip to content

Commit

Permalink
+ Add macro to test and get OCC version
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Aug 10, 2014
1 parent a05bf73 commit 5a33d95
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions cMake/FreeCadMacros.cmake
@@ -1,3 +1,5 @@
include (CheckCXXSourceRuns)

# ================================================================================
# == Macros, mostly for special targets ==========================================

Expand Down Expand Up @@ -251,3 +253,61 @@ MACRO(SET_PYTHON_PREFIX_SUFFIX ProjectName)
set_target_properties(${ProjectName} PROPERTIES SUFFIX ".pyd")
endif(WIN32)
ENDMACRO(SET_PYTHON_PREFIX_SUFFIX)

MACRO(CHECK_MINIMUM_OCC_VERSION_HEX MinVersionHex)
set(CMAKE_REQUIRED_INCLUDES ${OCC_INCLUDE_DIR})
unset(OCC_MIN_VERSION CACHE)
set(OCC_CHECK_VERSION 0x060600)
CHECK_CXX_SOURCE_RUNS("
#include <Standard_Version.hxx>
int main ()
{
return OCC_VERSION_HEX >= ${MinVersionHex} ? 0 : -1;
}
"
OCC_MIN_VERSION)
ENDMACRO(CHECK_MINIMUM_OCC_VERSION_HEX)

MACRO(GET_OCC_VERSION_HEX)
# clear them to run the tests for each configure step
unset(OCC_MAJOR CACHE)
unset(OCC_MAJOR_COMPILED CACHE)
unset(OCC_MAJOR_EXITCODE CACHE)
unset(OCC_MINOR CACHE)
unset(OCC_MINOR_COMPILED CACHE)
unset(OCC_MINOR_EXITCODE CACHE)
unset(OCC_MICRO CACHE)
unset(OCC_MICRO_COMPILED CACHE)
unset(OCC_MICRO_EXITCODE CACHE)

set(CMAKE_REQUIRED_INCLUDES ${OCC_INCLUDE_DIR})
CHECK_CXX_SOURCE_RUNS("
#include <Standard_Version.hxx>
int main ()
{
return OCC_VERSION_MAJOR;
}
"
OCC_MAJOR)
CHECK_CXX_SOURCE_RUNS("
#include <Standard_Version.hxx>
int main ()
{
return OCC_VERSION_MINOR;
}
"
OCC_MINOR)
CHECK_CXX_SOURCE_RUNS("
#include <Standard_Version.hxx>
int main ()
{
return OCC_VERSION_MAINTENANCE;
}
"
OCC_MICRO)

unset(OCC_VERSION_HEX CACHE)
if (OCC_MAJOR_COMPILED AND OCC_MINOR_COMPILED AND OCC_MICRO_COMPILED)
set (OCC_VERSION_HEX "0x0${OCC_MAJOR_EXITCODE}0${OCC_MINOR_EXITCODE}0${OCC_MICRO_EXITCODE}")
endif()
ENDMACRO(GET_OCC_VERSION_HEX)

0 comments on commit 5a33d95

Please sign in to comment.