From 40e8559158f4adbdb5b591bc89a6ab977dce3aaa Mon Sep 17 00:00:00 2001 From: Alexander Damian Date: Sat, 29 Jun 2019 12:38:13 -0400 Subject: [PATCH] Remove warning for cmake policy CMP0074 --- CMakeLists.txt | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 928e966..b7fdadc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,8 +1,9 @@ cmake_minimum_required(VERSION 3.9.2) project(CppKafka) - -#Allows using '_ROOT' to point to a package install dir. After CMake v3.14 this becomes default behavior. -#cmake_policy(SET CMP0074 NEW) +if (${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.12.0") + # Use _ROOT variable to find configuration files + cmake_policy(SET CMP0074 NEW) +endif() include(GNUInstallDirs) include(CMakePackageConfigHelpers) @@ -47,6 +48,10 @@ option(CPPKAFKA_RDKAFKA_STATIC_LIB "Link with Rdkafka static library." OFF) # Add FindRdKafka.cmake set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/") +if (NOT CPPKAFKA_CONFIG_DIR) + set(CPPKAFKA_CONFIG_DIR lib/cmake/${PROJECT_NAME}) +endif() + # Maintain previous compatibility if (RDKAFKA_ROOT_DIR) set(RdKafka_ROOT ${RDKAFKA_ROOT_DIR})