summaryrefslogtreecommitdiffstats
path: root/cmake/FindWrapJasper.cmake
blob: 51a63e0b181658c80892533b7caa072a5f5ab86a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# 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)

if(Jasper_FOUND)
    set(WrapJasper_FOUND ON)

    # Upstream package does not provide targets, only variables. So define a target.
    add_library(WrapJasper::WrapJasper INTERFACE IMPORTED)
    target_link_libraries(WrapJasper::WrapJasper INTERFACE ${JASPER_LIBRARIES})
    target_include_directories(WrapJasper::WrapJasper INTERFACE ${JASPER_INCLUDE_DIR})
endif()