From 7a45fee7932c80f7621b98f1080aabee08bad6c7 Mon Sep 17 00:00:00 2001 From: Edgar Date: Sat, 4 Sep 2021 12:39:41 +0200 Subject: [PATCH] :bug: Fixed cmake not finding conan deps with a different package name --- cmake/DependenciesConfig.cmake | 3 +++ cmake/DependenciesFunctions.cmake | 12 ++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/cmake/DependenciesConfig.cmake b/cmake/DependenciesConfig.cmake index 4380068bde..aa7b3ccbce 100644 --- a/cmake/DependenciesConfig.cmake +++ b/cmake/DependenciesConfig.cmake @@ -8,6 +8,7 @@ set(ROR_FEAT_TIMING OFF) add_external_lib( OGRE ogre3d/1.11.6.1@anotherfoxguy/stable + CONAN_PKG_NAME OGRE REQUIRED # PKG_CONFIG "OGRE = 1.11.6" FIND_PACKAGE_OPTIONS 1.11 COMPONENTS Bites Overlay Paging RTShaderSystem MeshLodGenerator Terrain @@ -61,6 +62,7 @@ add_external_lib( Caelum ogre3d-caelum/0.6.4@anotherfoxguy/stable # PKG_CONFIG "Caelum >= 0.6.3" + CONAN_PKG_NAME Caelum FIND_PACKAGE ) add_external_lib( @@ -68,6 +70,7 @@ add_external_lib( ogre3d-pagedgeometry/1.2.1@anotherfoxguy/stable # PKG_CONFIG "PagedGeometry >= 1.2" FIND_PACKAGE + CONAN_PKG_NAME PagedGeometry SYMBOL PAGED ) diff --git a/cmake/DependenciesFunctions.cmake b/cmake/DependenciesFunctions.cmake index 6a18aa7010..3a6651f494 100644 --- a/cmake/DependenciesFunctions.cmake +++ b/cmake/DependenciesFunctions.cmake @@ -40,7 +40,7 @@ function(add_external_lib package conan_package_name) list(REMOVE_AT ARGV 0 1) better_parse_args( . REQUIRED FIND_PACKAGE ALWAYS_ALLOW_CONAN_FALLBACK HAS_ONLY_DEBUG_RELEASE - - OPTION_NAME SYMBOL INTERFACE_NAME + - OPTION_NAME SYMBOL INTERFACE_NAME CONAN_PKG_NAME + CONAN_OPTIONS FIND_PACKAGE_OPTIONS PKG_CONFIG ) @@ -169,9 +169,13 @@ function(add_external_lib package conan_package_name) endif () endif () - # We only want the name of the library - string(REPLACE "/" ";" pkg_name_split ${conan_package_name}) - list(GET pkg_name_split 0 conan_package_name_only) + if (ARG_CONAN_PKG_NAME) + set(conan_package_name_only ${ARG_CONAN_PKG_NAME}) + else () + # We only want the name of the library + string(REPLACE "/" ";" pkg_name_split ${conan_package_name}) + list(GET pkg_name_split 0 conan_package_name_only) + endif () list(APPEND CONAN_REQUIRES ${conan_package_name}) list(APPEND CONAN_PACKAGE_OPTIONS ${ARG_CONAN_OPTIONS})