Comments (12)
Thanks for your question.
Conan is not really a build system, but a package manager that wraps any build system and calls it.
So the way to change build-system properties, like this one, depends on the build system. Conan has several mechanisms to inject behavior into dependencies build systems, but that is limited to those build systems interfaces capabilities.
- Is there a C++ flag that we can inject, lets say with the Conan
tools.build:cxxflags
conf to dependencies? - How would you enable such behavior for example in CMake? Conan allows to inject CMake toolchains into dependencies for example via
tools.cmake.cmaketoolchain:user_toolchain
conf too. - What are your dependencies, which build systems do they use? How would that apple hardened runtime be enabled in those build systems?
from conan.
I'm new to conan, I understand that it's a package manager but from my understanding, it also generates config files for the build system.
It generates files for the build system in 2 dimensions:
- "Deps": Information to locate the dependencies, and to be able to consume them (includedirs, libdirs, library names, etc)
- "Toolchain": Minimal information to the current build to align with the dependencies binaries
It doesn't aim to be a build-system abstractor or meta-build system that can command any build system to do anything.
set_property(TARGET target PROPERTY XCODE_ATTRIBUTE_ENABLE_HARDENED_RUNTIME YES)
But if target
is a target of your current project, in your CMakeLists.txt
there is nothing Conan can do to set such a property. Only you can do it adding it to your CMakeLists.txt
. The information that Conan passes to the build is mostly -DCMAKE_TOOLCHAIN_FILE=.../conan_toolchan.cmake
, but that is a toolchain file, it is processed way before your targets are defined, so it is impossible for Conan to define such a property for your target.
from conan.
conan install . --build=missing cmake --preset conan-release cmake --build --preset conan-release
this works perfectly, but for what I am trying to achieve I think I need to build with Xcode, not Cmake.
CMake doesn't build anything, it's a meta build system (like Meson or Autotools). Xcode, Make, Ninja, MSBuild, NMake are build systems. CMake generates build files for a specific build system, by default for Make on macOS (Unix Makefiles
generator in CMake terminology: https://cmake.org/cmake/help/latest/manual/cmake-generators.7.html). cmake --build
is an abstraction calling appropriate build system depending on build systems files which have been generated in current directory.
If you want to switch to Xcode build system for your own project, you have to tell CMake to generate build files for Xcode during CMake configuration (-G Xcode
). It can also be enforced by conan with -c tools.cmake.cmaketoolchain:generator=Xcode
during conan install (all dependencies will be built with Xcode, and Xcode generator will be enforced in preset file for your consumer project, so no need to explicitly add -G Xcode
during cmake configuration).
from conan.
FYI, hardening is done by Xcode through codesign
utility under the hood. So if for some reason you don't build with Xcode, but let's say Ninja or Make, you can manually sign your application with codesign
as a post-process: https://developer.apple.com/library/archive/documentation/Security/Conceptual/CodeSigningGuide/Procedures/Procedures.html
But don't expect most build systems or meta build systems to abstract away such thing.
from conan.
from conan.
Hi @memsharded, thank you for your answer.
I'm new to conan
, I understand that it's a package manager but from my understanding, it also generates config files for the build system.
Here my build system is cmake
:
cmake --preset conan-release
cmake --build --preset conan-release
from my understanding, this should be set to the cmake
config generated by conan
:
set_property(TARGET target PROPERTY XCODE_ATTRIBUTE_ENABLE_HARDENED_RUNTIME YES)
for more info have a look at:
https://stackoverflow.com/questions/56023947/cmake-xcode-generator-add-capability-hardened-runtime
Do you know how can I set up this property?
from conan.
@memsharded Thank you for your explanation, it's much clearer now that conan
does with cmake
.
from conan.
conan install . --build=missing
cmake --preset conan-release
cmake --build --preset conan-release
this works perfectly, but for what I am trying to achieve I think I need to build with Xcode, not Cmake.
but this version doesn't seem to work:
conan install . --build=missing
cmake --preset conan-release -G Xcode
open build/Release/target.xcodeproj
but when building I got the following error:
#include <Eigen/Dense> file not found
so it looks like the Xcode project doesn't get the conan
path info?
Do you have any idea what I'm doing wrong?
from conan.
@SpaceIm thank you for clarifying, this makes more sense to me now.
For my project this work (using make):
conan install . --build=missing
cmake --preset conan-release
cmake --build --preset conan-release
but when using Xcode
conan install . --build=missing
cmake --preset conan-release -G Xcode
cmake --build --preset conan-release
I get the following error:
include/FileIO/CubeLUT.hpp:3:10: fatal error: 'Eigen/Dense' file not found
#include <Eigen/Dense>
Eigen has been installed with conan
at the conan install . --build=missing
step.
so it seems like cmake
is unable to generate a config with conan
include path for Xcode?
Is there anything I do wrong? How can I help Xcode find conan
include path?
from conan.
conan install . --build=missing -c tools.cmake.cmaketoolchain:generator=Xcode
cmake --preset conan-default -G Xcode
cmake --build --preset conan-release
create a successful build! I was able to solve my problem using these build commands!
I'm not sure why the preset changed name during the second step and why this is working over the previous Xcode way of building the program.
from conan.
@SpaceIm, is using codesign
on the final binary enough to have "Apple Hardened Runtime"?
The name of the feature feels misleading if the process is just signing the binary...
from conan.
@SpaceIm so if I understand correctly:
conan install . --build=missing
cmake --preset conan-release
cmake --build --preset conan-release
codesign --options=runtime -s identity ./mybin
would generate a binary with Apple Hardened Runtime enabled
and
conan install . --build=missing -c tools.cmake.cmaketoolchain:generator=Xcode
cmake --preset conan-default -G Xcode
cmake --build --preset conan-release
would do too, the only difference would be that the first one use make and the second one uses Xcode for the build system
Is it correct?
from conan.
Related Issues (20)
- [question] Please help how to use NuGet Libraries with Conan and CMake for Builds. HOT 1
- Error uploading file: conanmanifest.txt, '404 Client Error: Not Found for url: https://artifactory.com/artifactory/api/conan/conan-test/v2/conans/xxx/revisions/b9c4826ad9445ea5257f6432b5a019dd/files/conanmanifest.txt[bug] HOT 3
- [question] Confusion around python_requires using minor_mode HOT 6
- [bug] incorrect paths generated by pkgconfigdeps.py when using --deployer option HOT 1
- [question] Filtering options for package to get path to local cache HOT 4
- [bug] `conan list` filtering option asks users to use scope patterns when those don't work in that context HOT 2
- [question] Set cmake_find_mode for all deps in CMakeDeps [conan 2] HOT 2
- [feature] Option to suppress generation of script files HOT 2
- [bug] Initial setup for Conan test suite is not automated or documented HOT 3
- [question] disable package revisions HOT 3
- [bug] `conan source` does not actually get `global.conf`'s `core.` confs HOT 1
- [question] Install a binary package without matching the compiler version HOT 3
- [question] preset name != profile name HOT 4
- [question] Include jinja profile template into another HOT 7
- [question] How to disable compatilibity? HOT 5
- [question] CMAKE_INSTALL_PREFIX in toolchain - local/cache build difference [conan 2] HOT 3
- [feature] Introduce os.version or os=Ubuntu in profiles HOT 2
- [question] PUBLIC compile definition not propagated HOT 3
- [question] How to access a value defined in the `[conf]` section of a profile? HOT 1
- [feature] Add properties to MakeDeps generator HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from conan.