diff --git a/CMake/FindMuParser.cmake b/CMake/FindMuParser.cmake index 2e84940101121f24f32b487057b1aecc9a39d6ac..a776b90db53c74f589e1df4bde94fa17d784308f 100644 --- a/CMake/FindMuParser.cmake +++ b/CMake/FindMuParser.cmake @@ -41,7 +41,15 @@ find_path( MUPARSER_INCLUDE_DIR muParser.h if(EXISTS "${MUPARSER_INCLUDE_DIR}/muParserDef.h") file(READ "${MUPARSER_INCLUDE_DIR}/muParserDef.h" _muParserDef_h_CONTENTS) - string(REGEX REPLACE ".*# *define MUP_VERSION *_T\\(\"([0-9.]+)\"\\).*" "\\1" MUPARSER_VERSION "${_muParserDef_h_CONTENTS}") + + # Try to find the version for muparser < 2.3 + string(REGEX REPLACE ".*# *define MUP_VERSION *_T\\(\"([0-9.]+)\"\\).*" "\\1" + MUPARSER_VERSION_OLD_STYLE "${_muParserDef_h_CONTENTS}") + + # Try to find the version for muparser >= 2.3 + string(REGEX REPLACE ".*static *const *string_type *ParserVersion *= *string_type\\(_T\\(\"([0-9.]+)\"\\)\\);.*" + "\\1" MUPARSER_VERSION "${MUPARSER_VERSION_OLD_STYLE}") + if(MUPARSER_VERSION MATCHES "^[0-9]+\$") set(MUPARSER_VERSION "${MUPARSER_VERSION}.0.0") endif() diff --git a/CMake/OTBSetStandardCompilerFlags.cmake b/CMake/OTBSetStandardCompilerFlags.cmake index 34c42242df0e9d3c56b4ff4e6657488328e1337f..cfd3d6dd7e42fcb5abe4e19a789630c4309c4041 100644 --- a/CMake/OTBSetStandardCompilerFlags.cmake +++ b/CMake/OTBSetStandardCompilerFlags.cmake @@ -333,7 +333,7 @@ macro(check_compiler_platform_flags) set(OTB_CXX_DISABLE_OPTIMIZATION_FLAG "-O0") endif() if(DEFINED OTB_CXX_DISABLE_OPTIMIZATION_FLAG) - CHECK_CXX_SOURCE_COMPILES(${OTB_CXX_DISABLE_OPTIMIZATION_FLAG} CXX_HAS_DISABLE_OPTIMIZATION_FLAG) + CHECK_CXX_COMPILER_FLAG(${OTB_CXX_DISABLE_OPTIMIZATION_FLAG} CXX_HAS_DISABLE_OPTIMIZATION_FLAG) endif() endmacro()#End the platform check function diff --git a/SuperBuild/CMake/External_muparser.cmake b/SuperBuild/CMake/External_muparser.cmake index fa80ebb6a9d72a4647380d922762d72e74777dbf..af5c935fe0a99f814ca4c860dea65d8f5b316f62 100644 --- a/SuperBuild/CMake/External_muparser.cmake +++ b/SuperBuild/CMake/External_muparser.cmake @@ -24,21 +24,29 @@ SETUP_SUPERBUILD(MUPARSER) ExternalProject_Add(MUPARSER PREFIX MUPARSER - URL "https://github.com/beltoforion/muparser/archive/v2.2.5.tar.gz" - URL_MD5 02dae671aa5ad955fdcbcd3fee313fb7 + URL "https://github.com/beltoforion/muparser/archive/v2.3.2.tar.gz" + URL_MD5 cbc1b284e03abc7081b3c30997959893 BINARY_DIR ${MUPARSER_SB_BUILD_DIR} INSTALL_DIR ${SB_INSTALL_PREFIX} DOWNLOAD_DIR ${DOWNLOAD_LOCATION} - CMAKE_CACHE_ARGS ${SB_CMAKE_CACHE_ARGS} + CMAKE_CACHE_ARGS + ${SB_CMAKE_CACHE_ARGS} + -DCMAKE_INSTALL_LIBDIR:PATH=lib + -DENABLE_OPENMP:BOOL=FALSE + -DENABLE_SAMPLES:BOOL=FALSE CMAKE_COMMAND ${SB_CMAKE_COMMAND} DEPENDS ${MUPARSER_DEPENDENCIES} - PATCH_COMMAND ${CMAKE_COMMAND} -E copy - ${CMAKE_SOURCE_DIR}/patches/MUPARSER/CMakeLists.txt - ${MUPARSER_SB_SRC} LOG_DOWNLOAD 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 ) -SUPERBUILD_UPDATE_CMAKE_VARIABLES(MUPARSER FALSE) +SUPERBUILD_PATCH_SOURCE(MUPARSER) + +set(_SB_MUPARSER_INCLUDE_DIR ${SB_INSTALL_PREFIX}/include) +if(WIN32) + set(_SB_MUPARSER_LIBRARY ${SB_INSTALL_PREFIX}/lib/muparser.lib) +elseif(UNIX) + set(_SB_MUPARSER_LIBRARY ${SB_INSTALL_PREFIX}/lib/libmuparser${CMAKE_SHARED_LIBRARY_SUFFIX}) +endif() diff --git a/SuperBuild/patches/MUPARSER/CMakeLists.txt b/SuperBuild/patches/MUPARSER/CMakeLists.txt deleted file mode 100644 index 8a86c052f8d2cb1113b1f4b707f9c3c95aed7320..0000000000000000000000000000000000000000 --- a/SuperBuild/patches/MUPARSER/CMakeLists.txt +++ /dev/null @@ -1,52 +0,0 @@ -# -# Copyright (C) 2005-2020 Centre National d'Etudes Spatiales (CNES) -# -# This file is part of Orfeo Toolbox -# -# https://www.orfeo-toolbox.org/ -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -cmake_minimum_required(VERSION 2.8.3) - -project(muparser) - -option(BUILD_SHARED_LIBS "Building shared libs. Default is ON" ON) -if(MSVC AND BUILD_SHARED_LIBS) - set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) -endif() - -file(GLOB MUPARSER_SRCS "src/*.cpp" ) -list(REMOVE_ITEM MUPARSER_SRCS "${CMAKE_SOURCE_DIR}/src/muParserComplex.cpp") - -include_directories("${CMAKE_SOURCE_DIR}/include") - -add_library(muparser ${MUPARSER_SRCS}) -#if(OTB_LIBRARY_PROPERTIES) -# set_target_properties(muparser PROPERTIES ${OTB_LIBRARY_PROPERTIES}) -#endif() - -install(TARGETS muparser - RUNTIME DESTINATION bin COMPONENT RuntimeLibraries - LIBRARY DESTINATION lib COMPONENT RuntimeLibraries - ARCHIVE DESTINATION lib COMPONENT Development) - - - -file(GLOB MUPARSER_HEADERS "${CMAKE_SOURCE_DIR}/include/*.h") -list(REMOVE_ITEM MUPARSER_HEADERS "${CMAKE_SOURCE_DIR}/include/muParserComplex.h") -install(FILES ${MUPARSER_HEADERS} - DESTINATION include - COMPONENT Development) -