Set _FOUND variables properly for versioned components
This commit is contained in:
parent
a133663b6a
commit
56e203e248
@ -84,9 +84,7 @@ if(Boost_VERBOSE OR Boost_DEBUG)
|
|||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# find_dependency doesn't forward arguments until 3.9, so we have to roll our own
|
macro(boost_find_component comp req)
|
||||||
|
|
||||||
macro(boost_find_dependency dep req)
|
|
||||||
|
|
||||||
set(_BOOST_QUIET)
|
set(_BOOST_QUIET)
|
||||||
if(Boost_FIND_QUIETLY)
|
if(Boost_FIND_QUIETLY)
|
||||||
@ -98,36 +96,53 @@ macro(boost_find_dependency dep req)
|
|||||||
set(_BOOST_REQUIRED REQUIRED)
|
set(_BOOST_REQUIRED REQUIRED)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if("${comp}" MATCHES "^(python|numpy)([1-9])([0-9])$")
|
||||||
|
|
||||||
|
# handle pythonXY and numpyXY versioned components for compatibility
|
||||||
|
|
||||||
|
set(Boost_PYTHON_VERSION "${CMAKE_MATCH_2}.${CMAKE_MATCH_3}")
|
||||||
|
set(__boost_comp_nv "${CMAKE_MATCH_1}")
|
||||||
|
|
||||||
|
else()
|
||||||
|
|
||||||
|
set(__boost_comp_nv "${comp}")
|
||||||
|
|
||||||
|
endif()
|
||||||
|
|
||||||
get_filename_component(_BOOST_CMAKEDIR "${CMAKE_CURRENT_LIST_DIR}/../" ABSOLUTE)
|
get_filename_component(_BOOST_CMAKEDIR "${CMAKE_CURRENT_LIST_DIR}/../" ABSOLUTE)
|
||||||
|
|
||||||
if(Boost_DEBUG)
|
if(Boost_DEBUG)
|
||||||
message(STATUS "BoostConfig: find_package(boost_${dep} ${Boost_VERSION} EXACT CONFIG ${_BOOST_REQUIRED} ${_BOOST_QUIET} HINTS ${_BOOST_CMAKEDIR})")
|
message(STATUS "BoostConfig: find_package(boost_${__boost_comp_nv} ${Boost_VERSION} EXACT CONFIG ${_BOOST_REQUIRED} ${_BOOST_QUIET} HINTS ${_BOOST_CMAKEDIR})")
|
||||||
endif()
|
endif()
|
||||||
find_package(boost_${dep} ${Boost_VERSION} EXACT CONFIG ${_BOOST_REQUIRED} ${_BOOST_QUIET} HINTS ${_BOOST_CMAKEDIR})
|
find_package(boost_${__boost_comp_nv} ${Boost_VERSION} EXACT CONFIG ${_BOOST_REQUIRED} ${_BOOST_QUIET} HINTS ${_BOOST_CMAKEDIR})
|
||||||
|
|
||||||
|
set(__boost_comp_found ${boost_${__boost_comp_nv}_FOUND})
|
||||||
|
|
||||||
# FindPackageHandleStandardArgs expects <package>_<component>_FOUND
|
# FindPackageHandleStandardArgs expects <package>_<component>_FOUND
|
||||||
set(Boost_${dep}_FOUND ${boost_${dep}_FOUND})
|
set(Boost_${comp}_FOUND ${__boost_comp_found})
|
||||||
|
|
||||||
# FindBoost sets Boost_<COMPONENT>_FOUND
|
# FindBoost sets Boost_<COMPONENT>_FOUND
|
||||||
string(TOUPPER ${dep} _BOOST_DEP)
|
string(TOUPPER ${comp} _BOOST_COMP)
|
||||||
set(Boost_${_BOOST_DEP}_FOUND ${boost_${dep}_FOUND})
|
set(Boost_${_BOOST_COMP}_FOUND ${__boost_comp_found})
|
||||||
|
|
||||||
# FindBoost compatibility variables: Boost_LIBRARIES, Boost_<C>_LIBRARY
|
# FindBoost compatibility variables: Boost_LIBRARIES, Boost_<C>_LIBRARY
|
||||||
if(boost_${dep}_FOUND)
|
if(__boost_comp_found)
|
||||||
list(APPEND Boost_LIBRARIES Boost::${dep})
|
list(APPEND Boost_LIBRARIES Boost::${__boost_comp_nv})
|
||||||
set(Boost_${_BOOST_DEP}_LIBRARY Boost::${dep})
|
set(Boost_${_BOOST_COMP}_LIBRARY Boost::${__boost_comp_nv})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
unset(_BOOST_REQUIRED)
|
unset(_BOOST_REQUIRED)
|
||||||
unset(_BOOST_QUIET)
|
unset(_BOOST_QUIET)
|
||||||
unset(_BOOST_CMAKEDIR)
|
unset(_BOOST_CMAKEDIR)
|
||||||
unset(_BOOST_DEP)
|
unset(__boost_comp_nv)
|
||||||
|
unset(__boost_comp_found)
|
||||||
|
unset(_BOOST_COMP)
|
||||||
|
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
# Find boost_headers
|
# Find boost_headers
|
||||||
|
|
||||||
boost_find_dependency(headers 1)
|
boost_find_component(headers 1)
|
||||||
|
|
||||||
if(NOT boost_headers_FOUND)
|
if(NOT boost_headers_FOUND)
|
||||||
|
|
||||||
@ -154,20 +169,7 @@ set(Boost_LIBRARIES)
|
|||||||
|
|
||||||
foreach(__boost_comp IN LISTS Boost_FIND_COMPONENTS)
|
foreach(__boost_comp IN LISTS Boost_FIND_COMPONENTS)
|
||||||
|
|
||||||
set(__boost_req ${Boost_FIND_REQUIRED_${__boost_comp}})
|
boost_find_component(${__boost_comp} ${Boost_FIND_REQUIRED_${__boost_comp}})
|
||||||
|
|
||||||
if(__boost_comp MATCHES "^(python|numpy)([1-9])([0-9])$")
|
|
||||||
|
|
||||||
# handle pythonXY and numpyXY versioned components for compatibility
|
|
||||||
|
|
||||||
set(Boost_PYTHON_VERSION "${CMAKE_MATCH_2}.${CMAKE_MATCH_3}")
|
|
||||||
set(__boost_comp "${CMAKE_MATCH_1}")
|
|
||||||
|
|
||||||
endif()
|
|
||||||
|
|
||||||
boost_find_dependency(${__boost_comp} ${__boost_req})
|
|
||||||
|
|
||||||
unset(__boost_req)
|
|
||||||
|
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user