Skip to content

[BUG] Prefab with a mixed casing name can't have its module found by CMake (Android, Gradle + CMake) #98

@4ian

Description

@4ian

Describe the bug
A prefab with a mixed casing name like name: "AwesomeSDK" in the prefab.json is triggering CMake errors when trying to find the module (in an Android Gradle + CMake project).

To Reproduce
Steps to reproduce the behavior:

  1. In a prefab.json, enter a name like name: "AwesomeSDK"
  2. Build the AAR in a folder, named awesomesdk.aar.
  3. In your Android project root build.gradle, add a local repository to find your prefab. For example:
    allprojects { repositories { flatDir { dirs '/usr/path/to/awesomesdk' } ... } }
  4. In your Android project app build.gradle, reference the AAR: implementation(name: 'awesomesdk', ext:'aar')
  5. In your Android app CMakeLists.txt, add find_package(AwesomeSDK REQUIRED CONFIG)

Expected behavior
CMake should work without errors.
Instead, CMake complains about not being able to find the module:

/usr/path/to/project/app/CMakeLists.txt : C/C++ debug|armeabi-v7a : CMake Error at /usr/path/to/project/app/CMakeLists.txt:15 (find_package):
    Could not find a package configuration file provided by "AwesomeSDK" with any
    of the following names:

      AwesomeSDKConfig.cmake
      awesomesdk-config.cmake

    Add the installation prefix of "AwesomeSDK" to CMAKE_PREFIX_PATH or set
    "AwesomeSDK_DIR" to a directory containing one of the above files.  If
    "AwesomeSDK" provides a separate development package or SDK, be sure it has
    been installed.

Taking a look at the generated file, I found it is called out/cmake/debug/prefab/armeabi-v7a/prefab/lib/arm-linux-androideabi/cmake/AwesomeSDK/AwesomeSDK-config.cmake

Environment:
Prefab version: 1.0.0 (a --version or outputting the version number in --help would be helpful btw ;))

Host OS: Linux
Target platform: Android
Target ABI: armeabi-v7a
Target OS version: API level 21+
Build system: Gradle + CMake

Additional context

I worked around the issue by changing the name: "awesomesdk" (all lowercase) and referencing it as "awesomesdk" in CMake. Not sure if this is normal.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions