forked from hoehermann/wxWEBPHandler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
38 lines (37 loc) · 1.9 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# for testing purposes, this compiles the handler into a static library
cmake_minimum_required(VERSION 3.16) # TODO: find minimal version
set(PROJECT_NAME wxWEBPHandler)
project(${PROJECT_NAME})
find_package(wxWidgets REQUIRED COMPONENTS core base)
include(${wxWidgets_USE_FILE})
add_library(${PROJECT_NAME} STATIC
src/common/imagwebp.cpp
include/wx/imagwebp.h
)
target_include_directories(${PROJECT_NAME} PRIVATE include) # find own includes (structure follows wxWidgets' conventions)
target_compile_definitions(${PROJECT_NAME} PRIVATE wxUSE_IMAGE wxUSE_STREAMS wxUSE_LIBWEBP wxOVERRIDE=) # force definitions for stand-alone build (code follows wxWidgets' conventions)
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11)
find_package(WebP CONFIG)
if (${WebP_FOUND})
target_link_libraries(${PROJECT_NAME} PRIVATE ${wxWidgets_LIBRARIES})
else()
message(STATUS "WebP: Falling back to prefix search…")
find_library(WebP_LIBRARIES_webp webp)
find_library(WebP_LIBRARIES_demux webpdemux)
set(WebP_LIBRARIES ${WebP_LIBRARIES_webp} ${WebP_LIBRARIES_demux})
message(STATUS "WebP_LIBRARIES: ${WebP_LIBRARIES}")
find_path(WebP_INCLUDE_DIRS NAMES "webp/decode.h")
message(STATUS "WebP_INCLUDE_DIRS: ${WebP_INCLUDE_DIRS}")
target_include_directories(${PROJECT_NAME} PRIVATE ${WebP_INCLUDE_DIRS})
target_link_libraries(${PROJECT_NAME} PRIVATE ${wxWidgets_LIBRARIES} ${WebP_LIBRARIES})
endif()
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
add_executable(wxWEBPHandlerTest
test/check_directives.cpp
test/imagwebptest.cpp
)
target_include_directories(wxWEBPHandlerTest PRIVATE include)
target_compile_definitions(wxWEBPHandlerTest PRIVATE wxUSE_IMAGE wxUSE_STREAMS wxUSE_LIBWEBP wxOVERRIDE=)
target_include_directories(wxWEBPHandlerTest PRIVATE ${WebP_INCLUDE_DIRS})
target_link_libraries(wxWEBPHandlerTest PRIVATE ${wxWidgets_LIBRARIES} ${PROJECT_NAME})
endif()