Closed theodelrieu closed 4 years ago
Hi @theodelrieu,
You are linking the Bincrafters documentation which we are not responsible for. What we have documented is that the CMake build helper handle the fPIC option in a recipe by setting CONAN_CMAKE_POSITION_INDEPENDENT_CODE
automatically, as you can check here: https://docs.conan.io/en/latest/reference/build_helpers/cmake.html
This variable is only used by the cmake
generator (I think it is missing from the documentation here https://docs.conan.io/en/latest/reference/generators/cmake.html) but it is definitely not set by the cmake_find_package(_multi)
generators, nor by cmake_paths
. This is because those generators only provide information about dependencies (in the case of cmake_paths
it just relies on the packaged *.cmake files).
This is a trade-off as you can tell, that is the reason we are working on the toolchain concept: https://docs.conan.io/en/latest/creating_packages/toolchains.html
To work around your issue, you can try the new toolchain feature or use both cmake
and cmake_find_package
generators and keep the conan_basic_setup()
CMake call or just the conan_set_fpic()
one.
Hope that makes sense!
Oops, didn't even see that was bincrafters' doc 🤦
Thanks, I'll try those options out!
Environment Details (include every applicable attribute)
Steps to reproduce (Include if Applicable)
When creating a package with
fPIC=True
, theCMake
build helper will setCONAN_CMAKE_POSITION_INDEPENDENT_CODE=ON
.However, this will only work when using the
cmake
generator (and using theconan_basic_setup
macro, which checks forCONAN_CMAKE_POSITION_INDEPENDENT_CODE
). It does nothing when usingcmake_find_package
generators, thecmake_paths
generator is likely to be affected as well.The doc states that the
CMake
helper will setCMAKE_POSITION_INDEPENDENT_CODE
accordingly though, which is incorrect.