diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 96759c88d5..aeb55bb063 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -230,26 +230,6 @@ foreach(option_flag IN LISTS option_flags) convert_env_var_to_bool("${option_flag}") endforeach() -set(CMAKE_FIND_ROOT_PATH_BACKUP "${CMAKE_FIND_ROOT_PATH}") - -macro(clear_wasm_sysroot) -if(WASM_BUILD) - # when using the nix/build-all.py build script we should not - # look into the sysroot for most of the dependencies but rather - # in the designated build/ folder created by the script. - set(CMAKE_FIND_ROOT_PATH "") -endif() -set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE NEVER) -endmacro() - -macro(restore_wasm_sysroot) -if(WASM_BUILD) - # reset to use sysroot - set(CMAKE_FIND_ROOT_PATH "${CMAKE_FIND_ROOT_PATH_BACKUP}") -endif() -set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) -endmacro() - if(WITH_CGAL) if(NOT CGAL_INCLUDE_DIR) # CGAL is not respecting default Boost_USE_STATIC_LIBS value @@ -294,9 +274,7 @@ if(GLTF_SUPPORT) endif() if(NOT nlohmann_json_DIR) - clear_wasm_sysroot() find_path(json_header_path "nlohmann/json.hpp" HINTS ${JSON_INCLUDE_DIR}) - restore_wasm_sysroot() set(JSON_INCLUDE_DIR ${json_header_path}) if(json_header_path) @@ -394,19 +372,15 @@ if(USE_MMAP) add_definitions(-DUSE_MMAP) endif() -clear_wasm_sysroot() find_package(Boost REQUIRED COMPONENTS ${BOOST_COMPONENTS}) -restore_wasm_sysroot() message(STATUS "Boost include files found in ${Boost_INCLUDE_DIRS}") message(STATUS "Boost libraries found in ${Boost_LIBRARY_DIRS}") if(NOT MINIMAL_BUILD) # libxml2 is required for IFCXML (optional) and SVGFILL (mandatory) - clear_wasm_sysroot() if(IFCXML_SUPPORT) find_package(LibXml2 REQUIRED) endif() - restore_wasm_sysroot() endif() if(IFCXML_SUPPORT) @@ -783,10 +757,8 @@ if(BUILD_IFCGEOM) set(CGAL_LIBRARIES CGAL::CGAL) message(STATUS "Using found CGAL package at '${CGAL_DIR}'") elseif(WITH_CGAL AND NOT CGAL_DIR) - clear_wasm_sysroot() find_library(libGMP NAMES gmp mpir PATHS ${GMP_LIBRARY_DIR} NO_DEFAULT_PATH) find_library(libMPFR NAMES mpfr PATHS ${MPFR_LIBRARY_DIR} NO_DEFAULT_PATH) - restore_wasm_sysroot() if(NOT libGMP) message(FATAL_ERROR "Unable to find GMP library files, aborting") endif() diff --git a/cmake/FindLibXml2.cmake b/cmake/FindLibXml2.cmake index 86be2f565b..62148c02ac 100644 --- a/cmake/FindLibXml2.cmake +++ b/cmake/FindLibXml2.cmake @@ -16,9 +16,7 @@ list(REMOVE_ITEM CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}) if((NOT LIBXML2_INCLUDE_DIR AND NOT LIBXML2_LIBRARIES)) # First try config mode (probably works with vcpkg, Conan, macOS brew installs, but not on ubuntu 22.04) # CONFIG is provided using root path, so no need to clear sysroot here. - restore_wasm_sysroot() find_package(LibXml2 QUIET CONFIG) - clear_wasm_sysroot() if(NOT LibXml2_FOUND) # Fallback to CMake's builtin FindLibXml2 module (works on Ubuntu) diff --git a/cmake/FindOpenCASCADE.cmake b/cmake/FindOpenCASCADE.cmake index af0f64cacd..0202888278 100644 --- a/cmake/FindOpenCASCADE.cmake +++ b/cmake/FindOpenCASCADE.cmake @@ -88,9 +88,7 @@ else(OCC_VERSION_STRING VERSION_LESS 7.8.0) list(APPEND OpenCASCADE_LIBRARIES TKDESTEP TKDEIGES) endif(OCC_VERSION_STRING VERSION_LESS 7.8.0) -clear_wasm_sysroot() find_library(libTKernel NAMES TKernel TKerneld PATHS ${OCC_LIBRARY_DIR} NO_DEFAULT_PATH) -restore_wasm_sysroot() if(libTKernel) message(STATUS "Required Open Cascade Library files found")