Allow find_package calls for METIS/Quadmath if targets already exists

This commit is contained in:
Markus Blatt
2022-10-11 20:46:38 +02:00
parent a61747eb74
commit 991ea3cf0d
2 changed files with 14 additions and 10 deletions

View File

@@ -55,11 +55,13 @@ if (METIS_INCLUDE_DIRS OR METIS_LIBRARIES)
endif()
endif()
add_library(METIS::METIS UNKNOWN IMPORTED)
set_target_properties(METIS::METIS PROPERTIES
IMPORTED_LOCATION ${METIS_LIBRARIES}
INTERFACE_INCLUDE_DIRECTORIES ${METIS_INCLUDE_DIRS}
INTERFACE_COMPILE_DEFINITIONS METIS_API_VERSION=${METIS_API_VERSION})
if (NOT TARGET METIS::METIS)
add_library(METIS::METIS UNKNOWN IMPORTED)
set_target_properties(METIS::METIS PROPERTIES
IMPORTED_LOCATION ${METIS_LIBRARIES}
INTERFACE_INCLUDE_DIRECTORIES ${METIS_INCLUDE_DIRS}
INTERFACE_COMPILE_DEFINITIONS METIS_API_VERSION=${METIS_API_VERSION})
endif()
endif()
# print a message to indicate status of this package

View File

@@ -34,11 +34,13 @@ int main(void){
if (QUADMATH_FOUND)
set(QUADMATH_LIBRARIES "quadmath")
set(HAVE_QUAD "${QUADMATH_FOUND}")
add_library(QuadMath::QuadMath INTERFACE IMPORTED)
set_target_properties(QuadMath::QuadMath PROPERTIES
INTERFACE_LINK_LIBRARIES quadmath
INTERFACE_COMPILE_DEFINITIONS _GLIBCXX_USE_FLOAT128
INTERFACE_COMPILE_OPTIONS $<$<CXX_COMPILER_ID:GNU>:-fext-numeric-literals>)
if (NOT TARGET QuadMath::QuadMath)
add_library(QuadMath::QuadMath INTERFACE IMPORTED)
set_target_properties(QuadMath::QuadMath PROPERTIES
INTERFACE_LINK_LIBRARIES quadmath
INTERFACE_COMPILE_DEFINITIONS _GLIBCXX_USE_FLOAT128
INTERFACE_COMPILE_OPTIONS $<$<CXX_COMPILER_ID:GNU>:-fext-numeric-literals>)
endif()
endif()
endif()