Revert CMAKE_FIND_PACKAGE_PREFER_CONFIG as its from cmake > 3.13

Do the overriding in the appropriate find modules in cmake/modules
This commit is contained in:
tamasmeszaros 2022-05-23 10:55:23 +02:00
parent 6365e54b1f
commit f8ec5fc9e7
2 changed files with 89 additions and 87 deletions

View File

@ -43,14 +43,6 @@ set(SLIC3R_GTK "2" CACHE STRING "GTK version to use with wxWidgets on Linux")
set(IS_CROSS_COMPILE FALSE)
if (SLIC3R_STATIC)
# Prefer config scripts over find modules. This is helpful when building with
# the static dependencies. Many libraries have their own export scripts
# while having a Find<PkgName> module in standard cmake installation.
# (e.g. CURL)
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)
endif ()
if (APPLE)
set(CMAKE_FIND_FRAMEWORK LAST)
set(CMAKE_FIND_APPBUNDLE LAST)
@ -458,19 +450,10 @@ if (NOT EIGEN3_FOUND)
endif ()
include_directories(BEFORE SYSTEM ${EIGEN3_INCLUDE_DIR})
# Find expat or use bundled version
# Always use the system libexpat on Linux.
# Find expat. We have our overriden FindEXPAT which exports libexpat target
# no matter what.
find_package(EXPAT REQUIRED)
add_library(libexpat INTERFACE)
if (TARGET EXPAT::EXPAT )
target_link_libraries(libexpat INTERFACE EXPAT::EXPAT)
elseif(TARGET expat::expat)
target_link_libraries(libexpat INTERFACE expat::expat)
endif ()
find_package(PNG REQUIRED)
set(OpenGL_GL_PREFERENCE "LEGACY")

View File

@ -30,6 +30,23 @@
# ``CURL_VERSION_STRING``
# The version of curl found.
# First, prefer config scripts
set(_q "")
if(CURL_FIND_QUIETLY)
set(_q QUIET)
endif()
find_package(CURL ${CURL_FIND_VERSION} CONFIG ${_q})
if(NOT CURL_FIND_QUIETLY)
if (NOT CURL_FOUND)
message(STATUS "Falling back to MODULE search for CURL...")
else()
message(STATUS "CURL found in ${CURL_DIR}")
endif()
endif()
if (NOT CURL_FOUND)
# Look for the header file.
find_path(CURL_INCLUDE_DIR NAMES curl/curl.h)
mark_as_advanced(CURL_INCLUDE_DIR)
@ -109,3 +126,5 @@ if(CURL_FOUND)
endif()
endif()
endif()
endif (NOT CURL_FOUND)