Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[package] android-ndk/r24: Imported target includes non-existent path. #10679

Open
hwhsu1231 opened this issue May 7, 2022 · 1 comment
Open
Labels
bug Something isn't working

Comments

@hwhsu1231
Copy link

hwhsu1231 commented May 7, 2022

Package and Environment Details

  • Package Name/Version: android-ndk/r24
  • Operating System+version: Windows 11
  • Compiler+version: MSVC 2019
  • Docker image: None
  • Conan version: conan 1.45.0
  • Python version: Python 3.9.2

Conan profile (output of conan profile show default)

[settings]
os=Windows
os_build=Windows
arch=x86_64
arch_build=x86_64
build_type=Release
[options]
[conf]
[build_requires]
[env]

CMakeLists.txt and main.cpp

I use CMake-Conan to install package.

  • Click to expand the CMakeLists.txt
    cmake_minimum_required(VERSION 3.15)
    get_filename_component(folder_name "${CMAKE_CURRENT_SOURCE_DIR}" NAME)
    project(${folder_name} LANGUAGES C CXX)
    message("========== ${folder_name} ==========")
    
    
    get_cmake_property(is_multi_config GENERATOR_IS_MULTI_CONFIG)
    if(is_multi_config)     # Multi-Config Generator
      set(output_dir "${CMAKE_BINARY_DIR}/$<CONFIG>")
    else(is_multi_config)   # Single-Config Generator
      set(output_dir "${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE}")
    endif(is_multi_config)
    set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${output_dir}/bin")
    set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${output_dir}/lib")
    set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${output_dir}/lib")
    
    
    if(CMAKE_CXX_COMPILER_ID MATCHES MSVC)
      add_compile_options("/source-charset:utf-8")
    elseif(CMAKE_CXX_COMPILER_DIR MATCHES GNU)
      add_compile_options("-finput-charset=utf-8")
    endif()
    
    
    if(NOT EXISTS "${CMAKE_BINARY_DIR}/conan.cmake")
      message(STATUS "Downloading conan.cmake from https://github.com/conan-io/cmake-conan ...")
      file(DOWNLOAD 
        "https://raw.githubusercontent.com/conan-io/cmake-conan/develop/conan.cmake"
        "${CMAKE_BINARY_DIR}/conan.cmake")
    endif()
    include("${CMAKE_BINARY_DIR}/conan.cmake")
    
    
    set(conan_config_generators "CMakeDeps")
    set(conan_config_requires   "android-ndk/r24")
    set(conan_config_options    "")
    
    
    if(is_multi_config)     # Multi-Config Generator
      foreach(type Debug;Release)
        conan_cmake_configure(
          GENERATORS  ${conan_config_generators}
          REQUIRES    ${conan_config_requires}
          OPTIONS     ${conan_config_options}
          IMPORTS     "bin, *.dll -> ../${type}/bin")
        conan_cmake_autodetect(settings BUILD_TYPE ${type})
        conan_cmake_install(
          PATH_OR_REFERENCE "."
          INSTALL_FOLDER    "./conan"
          BUILD             missing
          REMOTE            conancenter
          SETTINGS          ${settings})
      endforeach()
    else(is_multi_config)   # Single-Config Generator
      set(type ${CMAKE_BUILD_TYPE})
      conan_cmake_configure(
        GENERATORS  ${conan_config_generators}
        REQUIRES    ${conan_config_requires}
        OPTIONS     ${conan_config_options}
        IMPORTS     "bin, *.dll -> ../${type}/bin")
      conan_cmake_autodetect(settings)
      conan_cmake_install(
        PATH_OR_REFERENCE "."
        INSTALL_FOLDER    "./conan"
        BUILD             missing
        REMOTE            conancenter
        SETTINGS          ${settings})
    endif(is_multi_config)
    
    
    list(APPEND CMAKE_MODULE_PATH "${CMAKE_BINARY_DIR}/conan")
    list(APPEND CMAKE_PREFIX_PATH "${CMAKE_BINARY_DIR}/conan")
    
    find_package(android-ndk CONFIG REQUIRED)
    
    add_executable(main "./main.cpp")
    target_link_libraries(main PRIVATE android-ndk::android-ndk)
  • Click to expand the main.cpp
    #include <iostream>
    using namespace std;
    int main()
    {
        cout << "Hello world" << endl;
        return 0;
    }

Steps to reproduce

  1. Use VSCode to open an empty folder.
  2. Download CMake-Tools plugin from Extension.
  3. Create an empty CMakeLists.txt file, and then paste the above example on it.
  4. Create an empty main.cpp file, and then paste the above example on it.
  5. Press Ctrl+Shift+P, and then type CMake: Configure.
  6. Press Ctrl+Shift+P, and then type CMake: Build.

Logs

[cmake] CMake Error in CMakeLists.txt:
[cmake]   Imported target "android-ndk::android-ndk" includes non-existent path
[cmake] 
[cmake]     "C:/.conan/434c09/1/include"
[cmake] 
[cmake]   in its INTERFACE_INCLUDE_DIRECTORIES.  Possible reasons include:
[cmake] 
[cmake]   * The path was deleted, renamed, or moved to another location.
[cmake] 
[cmake]   * An install or uninstall procedure did not complete successfully.
[cmake] 
[cmake]   * The installation package was faulty and references files it does not
[cmake]   provide.
@hwhsu1231 hwhsu1231 added the bug Something isn't working label May 7, 2022
@hwhsu1231
Copy link
Author

I open the root directory of android-ndk package installed by Conan. It doesn't have include folder in it:

C:\.conan\434c09\1

Instead, the corresponding include folder is located in this directory:

C:\.conan\434c09\1\toolchains\llvm\prebuilt\windows-x86_64\sysroot\usr\include

Screenshots

image
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant