Skip to content
Snippets Groups Projects
Commit 6bee3e08 authored by Rashad Kanavath's avatar Rashad Kanavath
Browse files

COMP: take advantage of muparser version parsing

parent d346252b
Branches
Tags
No related merge requests found
...@@ -4,31 +4,36 @@ set(OTBMuParser_SYSTEM_INCLUDE_DIRS ${MUPARSER_INCLUDE_DIRS}) ...@@ -4,31 +4,36 @@ set(OTBMuParser_SYSTEM_INCLUDE_DIRS ${MUPARSER_INCLUDE_DIRS})
set(OTBMuParser_LIBRARIES "${MUPARSER_LIBRARIES}") set(OTBMuParser_LIBRARIES "${MUPARSER_LIBRARIES}")
set(OTBMuParser_INCLUDE_DIRS ${OTBMuParser_BINARY_DIR}/src) set(OTBMuParser_INCLUDE_DIRS ${OTBMuParser_BINARY_DIR}/src)
set(OTB_MUPARSER_HAS_CXX_LOGICAL_OPERATORS 0)
if(NOT MUPARSER_VERSION_NUMBER LESS 20000)
set(OTB_MUPARSER_HAS_CXX_LOGICAL_OPERATORS 1)
endif()
# Starting with muparser 2.0.0, # Starting with muparser 2.0.0,
# intrinsic operators "and", "or", "xor" have been removed # intrinsic operators "and", "or", "xor" have been removed
# and intrinsic operators "&&" and "||" have been introduced as replacements # and intrinsic operators "&&" and "||" have been introduced as replacements
include(CheckCXXSourceRuns) # include(CheckCXXSourceRuns)
set(CMAKE_REQUIRED_INCLUDES ${OTBMuParser_SYSTEM_INCLUDE_DIRS}) # set(CMAKE_REQUIRED_INCLUDES ${OTBMuParser_SYSTEM_INCLUDE_DIRS})
set(CMAKE_REQUIRED_LIBRARIES ${OTBMuParser_LIBRARIES}) # set(CMAKE_REQUIRED_LIBRARIES ${OTBMuParser_LIBRARIES})
unset(CMAKE_REQUIRED_FLAGS) # unset(CMAKE_REQUIRED_FLAGS)
unset(CMAKE_REQUIRED_DEFINES) # unset(CMAKE_REQUIRED_DEFINES)
file(READ ${OTBMuParser_SOURCE_DIR}/CMake/otbTestMuParserHasCxxLogicalOperators.cxx # file(READ ${OTBMuParser_SOURCE_DIR}/CMake/otbTestMuParserHasCxxLogicalOperators.cxx
OTB_MUPARSER_HAS_CXX_LOGICAL_OPERATORS_SOURCEFILE) # OTB_MUPARSER_HAS_CXX_LOGICAL_OPERATORS_SOURCEFILE)
check_cxx_source_runs( # check_cxx_source_runs(
"${OTB_MUPARSER_HAS_CXX_LOGICAL_OPERATORS_SOURCEFILE}" # "${OTB_MUPARSER_HAS_CXX_LOGICAL_OPERATORS_SOURCEFILE}"
OTB_MUPARSER_HAS_CXX_LOGICAL_OPERATORS # OTB_MUPARSER_HAS_CXX_LOGICAL_OPERATORS
) # )
unset(CMAKE_REQUIRED_INCLUDES) # unset(CMAKE_REQUIRED_INCLUDES)
unset(CMAKE_REQUIRED_LIBRARIES) # unset(CMAKE_REQUIRED_LIBRARIES)
unset(CMAKE_REQUIRED_FLAGS) # unset(CMAKE_REQUIRED_FLAGS)
unset(CMAKE_REQUIRED_DEFINES) # unset(CMAKE_REQUIRED_DEFINES)
if(OTB_MUPARSER_HAS_CXX_LOGICAL_OPERATORS) if(OTB_MUPARSER_HAS_CXX_LOGICAL_OPERATORS)
message(STATUS "MuParser version is >= 2.0.0 : " message(STATUS "MuParser version is ${MUPARSER_VERSION} >= 2.0.0 : "
"uses '&&' and '||' logical operators, and C++ like " "uses '&&' and '||' logical operators, and C++ like "
"ternary if-then-else operator") "ternary if-then-else operator")
else() else()
message(STATUS "MuParser version is < 2.0.0 : " message(STATUS "MuParser version is ${MUPARSER_VERSION} < 2.0.0 : "
"uses 'and' and 'or' logical operators, and ternary " "uses 'and' and 'or' logical operators, and ternary "
"operator 'if( ; ; )'") "operator 'if( ; ; )'")
endif() endif()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment