Files
transmission/cmake/Findutf8cpp.cmake
Yat Ho 2158d631fd build: only accept cmake config package for utf8cpp
Impossible to parse package version from distributed source files.
2025-11-17 21:56:05 +08:00

20 lines
713 B
CMake

find_package(${CMAKE_FIND_PACKAGE_NAME} QUIET NO_MODULE)
include(FindPackageHandleStandardArgs)
if(${CMAKE_FIND_PACKAGE_NAME}_FOUND)
if(${CMAKE_FIND_PACKAGE_NAME}_VERSION VERSION_LESS 4.0.0)
# Before 4.0.0, some compiler options from their tests leaked into the
# main target. We workaround by clearing them here.
set_property(TARGET utf8cpp PROPERTY INTERFACE_COMPILE_OPTIONS)
endif()
find_package_handle_standard_args(${CMAKE_FIND_PACKAGE_NAME} CONFIG_MODE)
return()
endif()
# Always fails
find_package_handle_standard_args(${CMAKE_FIND_PACKAGE_NAME}
REQUIRED_VARS
${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR
VERSION_VAR ${CMAKE_FIND_PACKAGE_NAME}_VERSION)