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

[question] SHORT DESCRIPTION #17553

Open
1 task done
iradization opened this issue Jan 9, 2025 · 2 comments
Open
1 task done

[question] SHORT DESCRIPTION #17553

iradization opened this issue Jan 9, 2025 · 2 comments
Assignees

Comments

@iradization
Copy link

What is your question?

Hi, I'm using the following generators in the conanfile.py :
generators = "CMakeToolchain", "CMakeDeps", "XcodeDeps", "XcodeToolchain"

which generate the following file I include into my cmake project:

include("conan_toolchain.cmake")

with the following contents (the relevant part).

########## 'apple_system' block #############
# Define Apple architectures, sysroot, deployment target, bitcode, etc

# Set the architectures for which to build.
set(CMAKE_OSX_ARCHITECTURES arm64 CACHE STRING "" FORCE)
# Setting CMAKE_OSX_SYSROOT SDK, when using Xcode generator the name is enough
# but full path is necessary for others
set(CMAKE_OSX_SYSROOT macosx CACHE STRING "" FORCE)

However, when I compile my project I get compilation errors for not being able to find some basic headers since the isysroot is invalid (equal 'macos' instead of the framework Path) :

c++: warning: no such sysroot directory: 'macosx' [-Wmissing-sysroot]

this is expected since the toolchain file overrides my CMAKE_OSX_SYSROOT. in the comments you can see that if I use Xcode generator, the name should be good, but it affects my project.

Is it intentional ? I can have workaround, but perhaps I'm doing something wrong.

Thanks !

Have you read the CONTRIBUTING guide?

  • I've read the CONTRIBUTING guide
@memsharded memsharded self-assigned this Jan 9, 2025
@memsharded
Copy link
Member

Hi @iradization

Thanks for your question

include("conan_toolchain.cmake")

CMake toolchains shouldn't be included in CMakeLists.txt. This can be from a bad practice (if done before project() call), to don't work at all (if done after the project() call). The toolchains have to be passed in command line like -DCMAKE_TOOLCHAIN_FILE=. It is recommended to use the Conan generated presets with cmake --preset ... this is very convenient.

It is not fully clear what is the issue with the set(CMAKE_OSX_SYSROOT macosx CACHE STRING "" FORCE), and what did you mean with since the isysroot is invalid (equal 'macos' instead of the framework Path).

If it means that you have some special custom path, the code that determines the value for that variable is:

host_sdk_name = self._conanfile.conf.get("tools.apple:sdk_path") or get_apple_sdk_fullname(self._conanfile)

Which means that the tools.apple:sdk_path Conan conf can be used to customize the Apple SDK path.

@memsharded
Copy link
Member

Hi @iradization

Any feedback here? Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants