diff --git a/cmake/modules/SearchInstalledSoftware.cmake b/cmake/modules/SearchInstalledSoftware.cmake index 7c410dfbd3347..44f02f7e8b86d 100644 --- a/cmake/modules/SearchInstalledSoftware.cmake +++ b/cmake/modules/SearchInstalledSoftware.cmake @@ -643,7 +643,9 @@ if(mathmore OR builtin_gsl OR (tmva-cpu AND use_gsl_cblas)) # FIXME: one need to find better way to extract path with GSL include files set(GSL_INCLUDE_DIR ${CMAKE_BINARY_DIR}/GSL-prefix/src/GSL-build) set(GSL_FOUND ON) - set(mathmore ON CACHE BOOL "Enabled because builtin_gsl requested (${mathmore_description})" FORCE) + if(NOT mathmore) + set(mathmore ON CACHE BOOL "Enabled because builtin_gsl requested (${mathmore_description})") + endif() endif() endif() @@ -692,7 +694,7 @@ endif() if(NOT WIN32 AND NOT APPLE) if(opengl AND NOT x11) message(STATUS "OpenGL was disabled, since it is requires x11 on Linux") - set(opengl OFF CACHE BOOL "OpenGL requires x11" FORCE) + set(opengl OFF CACHE BOOL "Disabled because OpenGL requires x11" FORCE) endif() endif() # The opengl flag enables the graf3d features that depend on OpenGL, and these @@ -715,7 +717,7 @@ if((opengl OR cocoa) AND NOT builtin_glew) # Bug in CMake on Mac OS X until 3.25: # https://gitlab.kitware.com/cmake/cmake/-/issues/19662 # https://github.com/microsoft/vcpkg/pull/7967 - message(FATAL_ERROR "Please enable builtin Glew due a bug in CMake's FindGlew < v3.25 (use cmake option -Dbuiltin_glew=ON).") + message(FATAL_ERROR "Please enable builtin Glew due to a bug in CMake's FindGlew < v3.25 (use cmake option -Dbuiltin_glew=ON).") unset(GLEW_FOUND) elseif(GLEW_FOUND AND NOT TARGET GLEW::GLEW) add_library(GLEW::GLEW UNKNOWN IMPORTED) @@ -913,18 +915,25 @@ if(fftw3) message(STATUS "Looking for FFTW3") find_package(FFTW) if(NOT FFTW_FOUND) - if(fail-on-missing) - message(SEND_ERROR "FFTW3 libraries not found and they are required (fftw3 option enabled)") - else() - message(STATUS "FFTW3 not found. Set [environment] variable FFTW_DIR to point to your FFTW3 installation") - message(STATUS " Alternatively, you can also enable the option 'builtin_fftw3' to build FFTW3 internally'") - message(STATUS " For the time being switching OFF 'fftw3' option") - set(fftw3 OFF CACHE BOOL "Disabled because FFTW3 not found and builtin_fftw3 disabled (${fftw3_description})" FORCE) + set(builtin_fftw3 ON CACHE BOOL "Enabled because FFTW3 not found (${fftw3_description})" FORCE) + ROOT_CHECK_CONNECTION_AND_DISABLE_OPTION("builtin_fftw3") + if(NOT builtin_fftw3) + if(fail-on-missing) + message(SEND_ERROR "FFTW3 libraries not found and they are required (fftw3 option enabled)") + else() + message(STATUS "FFTW3 not found. Set [environment] variable FFTW_DIR to point to your FFTW3 installation") + message(STATUS " Alternatively, you can also enable your Internet connection so that the autoset option 'builtin_fftw3' can build FFTW3 internally'") + message(STATUS " For the time being switching OFF 'fftw3' option") + set(fftw3 OFF CACHE BOOL "Disabled because FFTW3 not found and builtin_fftw3 unavailable (${fftw3_description})" FORCE) + endif() endif() endif() endif() endif() if(builtin_fftw3) + if(NOT fftw3) + set(fftw3 ON CACHE BOOL "Enabled because builtin_fftw3 requested (${fftw3_description})") + endif() set(FFTW_VERSION 3.3.8) message(STATUS "Downloading and building FFTW version ${FFTW_VERSION}") set(FFTW_LIBRARIES ${CMAKE_BINARY_DIR}/lib/libfftw3.a) @@ -942,7 +951,6 @@ if(builtin_fftw3) ) set(FFTW_INCLUDE_DIR ${CMAKE_BINARY_DIR}/include) set(FFTW3_TARGET FFTW3) - set(fftw3 ON CACHE BOOL "Enabled because builtin_fftw3 requested (${fftw3_description})" FORCE) endif() #---Check for fitsio------------------------------------------------------------------- @@ -951,9 +959,11 @@ if(fitsio OR builtin_cfitsio) ROOT_CHECK_CONNECTION_AND_DISABLE_OPTION("builtin_cfitsio") endif() if(builtin_cfitsio) + if(NOT fitsio) + set(fitsio ON CACHE BOOL "Enabled because builtin_cfitsio requested (${fitsio_description})") + endif() add_library(CFITSIO::CFITSIO STATIC IMPORTED GLOBAL) add_subdirectory(builtins/cfitsio) - set(fitsio ON CACHE BOOL "Enabled because builtin_cfitsio requested (${fitsio_description})" FORCE) else() message(STATUS "Looking for CFITSIO") if(fail-on-missing) @@ -1014,6 +1024,9 @@ if(xrootd AND NOT builtin_xrootd) endif() if(builtin_xrootd) + if(NOT xrootd) + set(xrootd ON CACHE BOOL "Enabled because builtin_xrootd requested (${xrootd_description})") + endif() ROOT_CHECK_CONNECTION("builtin_xrootd=OFF") if(NO_CONNECTION) message(FATAL_ERROR "No internet connection. Please check your connection, or either disable the 'builtin_xrootd'" @@ -1026,7 +1039,6 @@ if(builtin_xrootd) # See also: https://github.com/root-project/root/issues/16374 find_package(OpenSSL REQUIRED) add_subdirectory(builtins/xrootd) - set(xrootd ON CACHE BOOL "Enabled because builtin_xrootd requested (${xrootd_description})" FORCE) endif() # Finalise the XRootD target configuration @@ -1185,6 +1197,9 @@ if(davix AND NOT builtin_davix) endif() if(builtin_davix) + if(NOT davix) + set(davix ON CACHE BOOL "Enabled because builtin_davix is enabled (${davix_description})") + endif() ROOT_CHECK_CONNECTION("builtin_davix=OFF") if(NO_CONNECTION) message(STATUS "No internet connection, disabling the 'davix' and 'builtin_davix' options") @@ -1193,7 +1208,6 @@ if(builtin_davix) else() list(APPEND ROOT_BUILTINS Davix) add_subdirectory(builtins/davix) - set(davix ON CACHE BOOL "Enabled because builtin_davix is enabled)" FORCE) endif() endif() @@ -1287,6 +1301,9 @@ int main() { return 0; }" tbb_exception_result) endif() if(builtin_tbb) + if(NOT imt) + set(imt ON CACHE BOOL "Enabled because builtin_tbb is enabled (${imt_description})") + endif() ROOT_CHECK_CONNECTION("builtin_tbb=OFF") if(NO_CONNECTION) message(STATUS "No internet connection, disabling 'builtin_tbb' and 'imt' options") @@ -1370,7 +1387,9 @@ endif() if(builtin_vc) unset(Vc_FOUND) unset(Vc_FOUND CACHE) - set(vc ON CACHE BOOL "Enabled because builtin_vc requested (${vc_description})" FORCE) + if(NOT vc) + set(vc ON CACHE BOOL "Enabled because builtin_vc requested (${vc_description})") + endif() elseif(vc) if(fail-on-missing) find_package(Vc 1.4.4 CONFIG QUIET REQUIRED) @@ -1460,7 +1479,9 @@ endif() if(builtin_veccore) unset(VecCore_FOUND) unset(VecCore_FOUND CACHE) - set(veccore ON CACHE BOOL "Enabled because builtin_veccore requested (${veccore_description})" FORCE) + if(NOT vc) + set(veccore ON CACHE BOOL "Enabled because builtin_veccore requested (${veccore_description})") + endif() elseif(veccore) if(vc) set(VecCore_COMPONENTS Vc) @@ -1578,6 +1599,9 @@ if(vdt OR builtin_vdt) endif() endif() if(builtin_vdt) + if(NOT vdt) + set(vdt ON CACHE BOOL "Enabled because builtin_vdt enabled (${vdt_description})") + endif() set(vdt_version 0.4.6) set(VDT_FOUND True) set(VDT_LIBRARIES ${CMAKE_BINARY_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}vdt${CMAKE_SHARED_LIBRARY_SUFFIX}) @@ -1610,7 +1634,6 @@ if(vdt OR builtin_vdt) DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries) install(DIRECTORY ${CMAKE_BINARY_DIR}/include/vdt DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} COMPONENT extra-headers) - set(vdt ON CACHE BOOL "Enabled because builtin_vdt enabled (${vdt_description})" FORCE) set_property(GLOBAL APPEND PROPERTY ROOT_BUILTIN_TARGETS VDT) add_library(VDT::VDT STATIC IMPORTED GLOBAL) set_target_properties(VDT::VDT