Skip to content

Commit

Permalink
Configuration, CMake - prevent implicitly using system packages
Browse files Browse the repository at this point in the history
FFmpeg, libconfig++, OpenVR, when their search root folder is specified explicitly.
  • Loading branch information
gkv311 committed Jan 15, 2025
1 parent 9a566e0 commit 32cd314
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion adm/cmake/FindFFmpeg.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ if (FFMPEG_INCLUDE_DIR_FOUND AND FFMPEG_LIBRARY_DIR_FOUND)
endif()
endif()
endforeach()
else()
elseif ("${FFMPEG_DIR}" STREQUAL "")
# FFmpeg doesn't provide CMake configs, but has pkgconfig
find_package (PkgConfig REQUIRED)
pkg_check_modules (LIBAV REQUIRED IMPORTED_TARGET libavcodec libavdevice libavformat libavutil libswscale)
Expand All @@ -100,4 +100,6 @@ else()
set_target_properties (${aLibIter} PROPERTIES IMPORTED_LOCATION "${FFMPEG_LIBRARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}${aLibIter}${CMAKE_SHARED_LIBRARY_SUFFIX}")
endforeach()
endif()
else()
set (FFMPEG_FOUND OFF)
endif()
4 changes: 3 additions & 1 deletion adm/cmake/FindLibconfigCpp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ if (LIBCONFIGCPP_INCLUDE_DIR_FOUND AND LIBCONFIGCPP_LIBRARY_DIR_FOUND)
set_target_properties (libconfig++ PROPERTIES IMPORTED_LOCATION "${LIBCONFIGCPP_LIBRARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}${LIBCONFIGCPP_TKNAME}${CMAKE_SHARED_LIBRARY_SUFFIX}")
endif()
endif()
else()
elseif ("${LIBCONFIGCPP_DIR}" STREQUAL "")
# fallback
unset (LIBCONFIGCPP_INCLUDE_DIR)
unset (LIBCONFIGCPP_LIBRARY)
Expand All @@ -88,4 +88,6 @@ else()
set_target_properties (libconfig++ PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${LIBCONFIGCPP_INCLUDE_DIR}")
set_target_properties (libconfig++ PROPERTIES IMPORTED_LOCATION "${LIBCONFIGCPP_LIBRARY}")
endif()
else()
set (LIBCONFIGCPP_FOUND OFF)
endif()
4 changes: 3 additions & 1 deletion adm/cmake/FindOpenVR.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ if (OPENVR_INCLUDE_DIR_FOUND AND OPENVR_LIBRARY_DIR_FOUND)
endif()
endif()
endforeach()
else()
elseif ("${OPENVR_DIR}" STREQUAL "")
# OpenVR doesn't provide CMake configs, but has pkgconfig
find_package (PkgConfig REQUIRED)
pkg_check_modules (LIBVR REQUIRED IMPORTED_TARGET openvr)
Expand All @@ -95,4 +95,6 @@ else()
set_target_properties (${aLibIter} PROPERTIES IMPORTED_LOCATION "${OPENVR_LIBRARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}${aLibIter}${CMAKE_SHARED_LIBRARY_SUFFIX}")
endforeach()
endif()
else()
set (OPENVR_FOUND OFF)
endif()

0 comments on commit 32cd314

Please sign in to comment.