From 91ceb8176afdbc5f2bdde0e409da011e99e22d9c Mon Sep 17 00:00:00 2001 From: Yang Zhao Date: Mon, 6 Feb 2023 16:01:16 -0800 Subject: [PATCH] cmake: Support configuring as subproject Use PROJECT_NAME et al instead of CMAKE_PROJECT_NAME et al so that libsrtp can be used via add_subdirectory(). --- CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 75f728652..30a484a38 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,8 +2,8 @@ cmake_minimum_required(VERSION 3.12) project(libsrtp2 VERSION 2.6.0 LANGUAGES C) -set(PACKAGE_VERSION ${CMAKE_PROJECT_VERSION}) -set(PACKAGE_STRING "${CMAKE_PROJECT_NAME} ${CMAKE_PROJECT_VERSION}") +set(PACKAGE_VERSION ${PROJECT_VERSION}) +set(PACKAGE_STRING "${PROJECT_NAME} ${PROJECT_VERSION}") list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) @@ -252,7 +252,7 @@ add_library(srtp2 ) add_library(libSRTP::srtp2 ALIAS srtp2) -set_target_properties(srtp2 PROPERTIES VERSION ${CMAKE_PROJECT_VERSION}) +set_target_properties(srtp2 PROPERTIES VERSION ${PROJECT_VERSION}) target_include_directories(srtp2 PUBLIC $ @@ -398,7 +398,7 @@ configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in # Generate the version file for the config file write_basic_package_version_file( "${CMAKE_CURRENT_BINARY_DIR}/libSRTPConfigVersion.cmake" - VERSION "${CMAKE_PROJECT_VERSION}" + VERSION "${PROJECT_VERSION}" COMPATIBILITY AnyNewerVersion )