Hello, i have issue compiling some proto files due to wrong pick of the protoc binary by CMake. I've got two projects, the first one is the main project which i want to cross-compile for arm64. The second project is a dependecy containining proto files and is responsible for building them. I've successfully installed protobuf conan package for both x86_64 and arm64 architectures, by specifying CMAKE_PROJECT_TOP_LEVEL_INCLUDES parameter and adding conanfile.txt, so as written in README. Both of my projects successfully resolves all the dependencies. But when it comes to generating C++ sources for protofiles, for some reason CMAKE chooses to use "protoc" which comes with android arm64 protobuf package, instead of using windows x84_64 version. I've got an idea for workaround, i can add project_b as an external project with different CMake command (at the moment it is being added as subdirectory), but i would like to keep this solution as a last resort and try to figure out a better way to do it.
The way i am trying to generate proto files:
cmake_minimum_required(VERSION 3.10)
project(proto_cpp NONE)
find_package(Protobuf)
add_library(my_project_b)
protobuf_generate(
TARGET my_project_b
LANGUAGE cpp
PROTOS
FileFormat.proto
)
...
My conanfile.txt looks like that:
[requires]
openssl/3.3.5
protobuf/6.32.1
[tool_requires]
protobuf/6.32.1
[generators]
CMakeToolchain
CMakeDeps
[layout]
cmake_layout
Conan build profile:
[settings]
arch=x86_64
build_type=Release
compiler=gcc
compiler.cppstd=gnu17
compiler.libcxx=libstdc++11
compiler.version=15
os=Windows
Conan host profile:
include(default)
[settings]
os=Android
arch=armv8
os.api_level=27
compiler=clang
compiler.version=19
compiler.libcxx=c++_static
compiler.cppstd=20
[conf]
tools.android:ndk_path=C:\Users\MrF\AppData\Local\Android\Sdk\ndk\28.2.13676358
Build command:
%CMAKE% -S . -B %BUILD_DIR% ^
-DCMAKE_TOOLCHAIN_FILE=%ANDROID_NDK_HOME%/build/cmake/android.toolchain.cmake ^
-DANDROID_ABI=%ANDROID_ABI% ^
-DANDROID_PLATFORM=%ANDROID_PLATFORM% ^
-DBUILD_STATIC=%BUILD_STATIC% ^
-DCMAKE_BUILD_TYPE=%BUILD_TYPE% ^
-DCMAKE_MAKE_PROGRAM=%NINJA% ^
-DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=cmake-conan/conan_provider.cmake ^
-DCONAN_HOST_PROFILE=android_conan_profile ^
-GNinja
Hello, i have issue compiling some proto files due to wrong pick of the protoc binary by CMake. I've got two projects, the first one is the main project which i want to cross-compile for arm64. The second project is a dependecy containining proto files and is responsible for building them. I've successfully installed protobuf conan package for both x86_64 and arm64 architectures, by specifying CMAKE_PROJECT_TOP_LEVEL_INCLUDES parameter and adding conanfile.txt, so as written in README. Both of my projects successfully resolves all the dependencies. But when it comes to generating C++ sources for protofiles, for some reason CMAKE chooses to use "protoc" which comes with android arm64 protobuf package, instead of using windows x84_64 version. I've got an idea for workaround, i can add project_b as an external project with different CMake command (at the moment it is being added as subdirectory), but i would like to keep this solution as a last resort and try to figure out a better way to do it.
The way i am trying to generate proto files:
My conanfile.txt looks like that:
Conan build profile:
Conan host profile:
Build command: