diff options
Diffstat (limited to 'var/spack/repos/builtin/packages/gaudi/link_target_fixes32.patch')
-rw-r--r-- | var/spack/repos/builtin/packages/gaudi/link_target_fixes32.patch | 107 |
1 files changed, 107 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/gaudi/link_target_fixes32.patch b/var/spack/repos/builtin/packages/gaudi/link_target_fixes32.patch new file mode 100644 index 0000000000..95339a0931 --- /dev/null +++ b/var/spack/repos/builtin/packages/gaudi/link_target_fixes32.patch @@ -0,0 +1,107 @@ +diff --git a/cmake/GaudiProjectConfig.cmake b/cmake/GaudiProjectConfig.cmake +index 3da52a9c6..08c11c863 100644 +--- a/cmake/GaudiProjectConfig.cmake ++++ b/cmake/GaudiProjectConfig.cmake +@@ -346,6 +346,8 @@ macro(gaudi_project project version) + # Make sure we select the version of Python provided by LCG (if we are building in that context) + if(Python_config_version) + set(Python_config_version ${Python_config_version} CACHE STRING "LCG version of Python") ++ # Prevent special LCG versions (like 2.7.9.p1) to confuse CMake ++ string(REGEX REPLACE "([0-9]+\\.[0-9]+\\.[0-9]+).*" "\\1" Python_config_version "${Python_config_version}") + find_package(PythonInterp ${Python_config_version} QUIET) + find_package(PythonLibs ${Python_config_version} QUIET) + if(CMAKE_VERSION VERSION_GREATER 3.12) +@@ -363,10 +365,10 @@ macro(gaudi_project project version) + #-- Set up the boost_python_version variable for the project + find_package(PythonInterp) + find_package(Boost) +- if((Boost_VERSION GREATER 106700) OR (Boost_VERSION EQUAL 106700)) +- set(boost_python_version "${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}") ++ if((Boost_VERSION LESS 106700) OR (Boost_VERSION GREATER 1069000)) ++ set(boost_python_version "") + else() +- set(boost_python_version "") ++ set(boost_python_version "${Python_VERSION_MAJOR}${Python_VERSION_MINOR}") + endif() + + #--- Allow installation on failed builds +@@ -1607,9 +1609,25 @@ function(gaudi_resolve_link_libraries variable) + set(collected) + foreach(package ${ARGN}) + # check if it is an actual library or a target first ++ if(NOT TARGET ${package}) ++ if(package MATCHES "^Boost::(.*)$") ++ # special handling of Boost imported targets ++ find_package(Boost COMPONENTS ${CMAKE_MATCH_1} QUIET) ++ else() ++ # the target might be in a project namespace ++ foreach(_p IN LISTS used_gaudi_projects) ++ if(TARGET ${_p}::${package}) ++ #message(STATUS "using ${_p}::${package} for ${package}") ++ set(package ${_p}::${package}) ++ break() ++ endif() ++ endforeach() ++ endif() ++ endif() ++ + if(TARGET ${package}) + get_property(target_type TARGET ${package} PROPERTY TYPE) +- if(NOT target_type MATCHES "(SHARED|STATIC)_LIBRARY") ++ if(NOT target_type MATCHES "(SHARED|STATIC|UNKNOWN)_LIBRARY") + message(FATAL_ERROR "${package} is a ${target_type}: you cannot link against it") + endif() + #message(STATUS "${package} is a TARGET") +@@ -1657,6 +1675,19 @@ function(gaudi_resolve_link_libraries variable) + endforeach() + #message(STATUS "gaudi_resolve_link_libraries collected: ${collected}") + _gaudi_strip_build_type_libs(collected) ++ # resolve missing Boost::* targets, if needed ++ set(boost_components ${collected}) ++ list(FILTER boost_components INCLUDE REGEX "^Boost::") ++ list(TRANSFORM boost_components REPLACE "^Boost::" "") ++ set(missing_components) ++ foreach(comp IN LISTS boost_components) ++ if(NOT TARGET Boost::${comp}) ++ list(APPEND missing_components ${comp}) ++ endif() ++ endforeach() ++ if(missing_components) ++ find_package(Boost COMPONENTS ${missing_components} QUIET) ++ endif() + #message(STATUS "gaudi_resolve_link_libraries output: ${collected}") + set(${variable} ${collected} PARENT_SCOPE) + endfunction() +@@ -3262,6 +3293,14 @@ macro(gaudi_external_project_environment) + list(FIND used_gaudi_projects ${pack} gaudi_project_idx) + if((NOT pack STREQUAL GaudiProject) AND (gaudi_project_idx EQUAL -1)) + message(STATUS " ${pack}") ++ if(pack STREQUAL Boost) ++ if(NOT TARGET Boost::headers) ++ # this is needed to get the non-cache variables for the packages ++ # but we do not need to call it if we do not use FindBoost.cmake (Boost >= 1.70) ++ find_package(${pack} QUIET) ++ endif() ++ endif() ++ + if(NOT pack MATCHES "^Python(Interp|Libs)?$") + # this is needed to get the non-cache variables for the packages + find_package(${pack} QUIET) +@@ -3310,6 +3349,17 @@ macro(gaudi_external_project_environment) + list(APPEND environment SET QT_XKB_CONFIG_ROOT "/usr/share/X11/xkb") + endif() + endif() ++ elseif(pack MATCHES "^boost_(.*)$") ++ # We are using BoostConfig.cmake (>=1.70) and not FindBoost.cmake ++ if(TARGET "Boost::${CMAKE_MATCH_1}") ++ set(tgt_name "Boost::${CMAKE_MATCH_1}") ++ get_property(target_type TARGET ${tgt_name} PROPERTY TYPE) ++ if(target_type MATCHES "(SHARED|UNKNOWN)_LIBRARY") ++ # FIXME: I'm not sure it's good to rely on the "_RELEASE" suffix ++ get_property(lib_path TARGET ${tgt_name} PROPERTY IMPORTED_LOCATION_RELEASE) ++ get_filename_component(${pack}_LIBRARY_DIR "${lib_path}" PATH) ++ endif() ++ endif() + endif() + + list(APPEND binary_path ${${pack}_BINARY_PATH}) |