Since the regular expression we used was eager it matched the 202 in 2020,
yielding a version number of 0.0. Note that this worked with older versions of
TBB since we would get, e.g., version 8.0 instead of version 2018.0.
SET(${var} TRUE)
ENDIF()
+ #
+ # TBB currently uses the version numbering scheme
+ #
+ # YYYY.X
+ #
+ # (e.g., 2018.0) where YYYY is the year of the release and X is the yearly
+ # release number. Older versions use
+ #
+ # X.Y.Z
+ #
+ # (e.g., 4.2.1). Since we are compatible with all versions that use the new
+ # numbering scheme we only check for very old versions here.
#
# TBB versions before 4.2 are missing some explicit calls to std::atomic::load
# in ternary expressions; these cause compilation errors in some compilers
IF(EXISTS ${TBB_INCLUDE_DIR}/tbb/tbb_stddef.h)
FILE(STRINGS "${TBB_INCLUDE_DIR}/tbb/tbb_stddef.h" TBB_VERSION_MAJOR_STRING
REGEX "#define.*TBB_VERSION_MAJOR")
- STRING(REGEX REPLACE "^.*TBB_VERSION_MAJOR.*([0-9]+).*" "\\1"
+ STRING(REGEX REPLACE "^.*TBB_VERSION_MAJOR +([0-9]+).*" "\\1"
TBB_VERSION_MAJOR "${TBB_VERSION_MAJOR_STRING}"
)
FILE(STRINGS "${TBB_INCLUDE_DIR}/tbb/tbb_stddef.h" TBB_VERSION_MINOR_STRING
REGEX "#define.*TBB_VERSION_MINOR")
- STRING(REGEX REPLACE "^.*TBB_VERSION_MINOR.*([0-9]+).*" "\\1"
+ STRING(REGEX REPLACE "^.*TBB_VERSION_MINOR +([0-9]+).*" "\\1"
TBB_VERSION_MINOR "${TBB_VERSION_MINOR_STRING}"
)
SET(TBB_VERSION
In the beginning the Universe was created. This has made a lot of
people very angry and has been widely regarded as a bad move.
Douglas Adams