Skip to content

Commit 23f0e3f

Browse files
committed
CMakeLists: option to pre-supply DevIL lib and incude dir
1 parent 862ef25 commit 23f0e3f

1 file changed

Lines changed: 34 additions & 21 deletions

File tree

plugins/CMakeLists.txt

Lines changed: 34 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,35 +13,48 @@ if (WIN32)
1313
#option(BUILD_VFAPIFILTER "Build VFAPIFilter plugin" ON)
1414
endif()
1515

16-
include(FindDevIL)
17-
if(DevIL_FOUND)
16+
# DevIL detection: skip auto detection if paths are pre-supplied via -DIL_LIBRARIES=...
17+
if(IL_LIBRARIES AND IL_INCLUDE_DIR)
18+
message(STATUS "DevIL paths pre-supplied, skipping auto-detection.")
19+
set(DevIL_FOUND TRUE)
1820
set(DEVIL_PLUGIN_STATE ON)
1921
else()
20-
MESSAGE(WARNING "DevIL library not found. ImageSeq plugin will not be built.")
21-
set(DEVIL_PLUGIN_STATE OFF)
22-
endif()
23-
24-
find_package(PkgConfig)
25-
if(PkgConfig_FOUND)
26-
pkg_check_modules(SOUNDTOUCH soundtouch)
22+
include(FindDevIL) # official CMake module
23+
if(DevIL_FOUND)
24+
set(DEVIL_PLUGIN_STATE ON)
25+
else()
26+
MESSAGE(WARNING "DevIL library not found. ImageSeq plugin will not be built.")
27+
set(DEVIL_PLUGIN_STATE OFF)
28+
endif()
2729
endif()
2830

29-
if(SOUNDTOUCH_FOUND)
31+
# SoundTouch detection: skip auto-detection if paths are pre-supplied via -DSOUNDTOUCH_LINK_LIBRARIES=...
32+
if(SOUNDTOUCH_LINK_LIBRARIES AND SOUNDTOUCH_INCLUDE_DIRS)
33+
message(STATUS "SoundTouch paths pre-supplied, skipping auto-detection.")
3034
set(SOUNDTOUCH_PLUGIN_STATE ON)
3135
else()
32-
# check to see if SoundTouch's CMake files were installed and whether the library itself exists
33-
MESSAGE(WARNING "SoundTouch not found by pkg-config, falling back to CMake detection")
34-
find_package(SoundTouch)
35-
find_library(SOUNDTOUCH SoundTouch PATH ${SoundTouch_LIBRARY_DIRS})
36-
if(SoundTouch_FOUND)
37-
# override the SOUNDTOUCH_LINK_LIBRARIES and SOUNDTOUCH_INCLUDE_DIRS variables
38-
# that pkg-config would have set, and allow these to be overridden at configure time as well
39-
set(SOUNDTOUCH_LINK_LIBRARIES ${SOUNDTOUCH} CACHE PATH "Path to SoundTouch library")
40-
set(SOUNDTOUCH_INCLUDE_DIRS ${CMAKE_PREFIX_PATH}/include/soundtouch CACHE PATH "Path to SoundTouch headers")
36+
find_package(PkgConfig)
37+
if(PkgConfig_FOUND)
38+
pkg_check_modules(SOUNDTOUCH soundtouch)
39+
endif()
40+
41+
if(SOUNDTOUCH_FOUND)
4142
set(SOUNDTOUCH_PLUGIN_STATE ON)
4243
else()
43-
MESSAGE(WARNING "SoundTouch library not found. TimeStretch plugin will not be built.")
44-
set(SOUNDTOUCH_PLUGIN_STATE OFF)
44+
# check to see if SoundTouch's CMake files were installed and whether the library itself exists
45+
MESSAGE(WARNING "SoundTouch not found by pkg-config, falling back to CMake detection")
46+
find_package(SoundTouch)
47+
find_library(SOUNDTOUCH SoundTouch PATH ${SoundTouch_LIBRARY_DIRS})
48+
if(SoundTouch_FOUND)
49+
# override the SOUNDTOUCH_LINK_LIBRARIES and SOUNDTOUCH_INCLUDE_DIRS variables
50+
# that pkg-config would have set, and allow these to be overridden at configure time as well
51+
set(SOUNDTOUCH_LINK_LIBRARIES ${SOUNDTOUCH} CACHE PATH "Path to SoundTouch library")
52+
set(SOUNDTOUCH_INCLUDE_DIRS ${CMAKE_PREFIX_PATH}/include/soundtouch CACHE PATH "Path to SoundTouch headers")
53+
set(SOUNDTOUCH_PLUGIN_STATE ON)
54+
else()
55+
MESSAGE(WARNING "SoundTouch library not found. TimeStretch plugin will not be built.")
56+
set(SOUNDTOUCH_PLUGIN_STATE OFF)
57+
endif()
4558
endif()
4659
endif()
4760

0 commit comments

Comments
 (0)