Skip to content

Commit

Permalink
🐛 Fixed cmake not finding conan deps with a different package name
Browse files Browse the repository at this point in the history
  • Loading branch information
AnotherFoxGuy committed Sep 7, 2021
1 parent 1223ece commit 7a45fee
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
3 changes: 3 additions & 0 deletions cmake/DependenciesConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -61,13 +62,15 @@ 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(
PagedGeometry
ogre3d-pagedgeometry/1.2.1@anotherfoxguy/stable
# PKG_CONFIG "PagedGeometry >= 1.2"
FIND_PACKAGE
CONAN_PKG_NAME PagedGeometry
SYMBOL PAGED
)

Expand Down
12 changes: 8 additions & 4 deletions cmake/DependenciesFunctions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

Expand Down Expand Up @@ -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})
Expand Down

0 comments on commit 7a45fee

Please # to comment.