diff options
author | Joerg Bornemann <joerg.bornemann@qt.io> | 2021-03-16 15:59:19 +0100 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@qt.io> | 2021-03-17 09:00:02 +0100 |
commit | 86ff21be229b3245af5105a711308315250bed68 (patch) | |
tree | 0d13c2bbe07337fa4bfe2c74ba78420c858c24e7 /cmake | |
parent | e2bed44b317951494d30feb2910a05ba87ea1b63 (diff) | |
download | qtimageformats-86ff21be229b3245af5105a711308315250bed68.tar.gz |
FindWrap[Jasper|WebP].cmake: bail out on existing targets
Add the common bail out code we have in other FindWrap*.cmake files.
Pick-to: 6.1
Change-Id: I6096b31fcf6a2181b22b74ccf285ce22e14c197b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/FindWrapJasper.cmake | 7 | ||||
-rw-r--r-- | cmake/FindWrapWebP.cmake | 7 |
2 files changed, 14 insertions, 0 deletions
diff --git a/cmake/FindWrapJasper.cmake b/cmake/FindWrapJasper.cmake index e25d21b..51a63e0 100644 --- a/cmake/FindWrapJasper.cmake +++ b/cmake/FindWrapJasper.cmake @@ -1,3 +1,10 @@ +# We can't create the same interface imported target multiple times, CMake will complain if we do +# that. This can happen if the find_package call is done in multiple different subdirectories. +if(TARGET WrapJasper::WrapJasper) + set(WrapJasper_FOUND TRUE) + return() +endif() + set(WrapJasper_FOUND OFF) find_package(Jasper) diff --git a/cmake/FindWrapWebP.cmake b/cmake/FindWrapWebP.cmake index b546529..487c18b 100644 --- a/cmake/FindWrapWebP.cmake +++ b/cmake/FindWrapWebP.cmake @@ -5,6 +5,13 @@ # So try config files first, and then use the regular find_library / find_path dance with pkg-config # paths as hints. +# We can't create the same interface imported target multiple times, CMake will complain if we do +# that. This can happen if the find_package call is done in multiple different subdirectories. +if(TARGET WrapWebP::WrapWebP) + set(WrapWebP_FOUND TRUE) + return() +endif() + find_package(WebP QUIET) if(TARGET WebP::webp AND TARGET WebP::webpdemux AND TARGET WebP::libwebpmux) set(WrapWebP_FOUND ON) |