-
Notifications
You must be signed in to change notification settings - Fork 980
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
[bug] CMakeToolchain: BUILD_SHARED_LIBS
& CMAKE_POSITION_INDEPENDENT_CODE
not honored if CMP0077 OLD (or not set) and turned as options in upstream CMakeLists
#11840
Comments
BUILD_SHARED_LIBS
& CMAKE_POSITION_INDEPENDENT_CODE
not honored if CMP0077 (OLD or not set) and turned as options in upstream CMakeListsBUILD_SHARED_LIBS
& CMAKE_POSITION_INDEPENDENT_CODE
not honored if CMP0077 OLD (or not set) and turned as options in upstream CMakeLists
So I guess the correct fix is to set |
I just hit this issue porting GTest to Conan V2 on Conan Center: conan-io/conan-center-index#12326 |
Hi @SpaceIm, @jwillikers for reporting this issue. We will work on a fix to address the case where a project treats this as global cache variables. |
* conan v2 support * explicit cpp_info.libs * no CMAKE_BINARY_DIR patch needed with CMakeToolchain * set CMP0077 to NEW to avoid CMake warning * add ref to conan-io/conan#11840 * fix indentation
We have seen other cases where variables defined in the toolchain file generated by Conan end up "conflicting" in some way if the variables are (re)defined by the project CMakeLists, in a way that it conflicts or overrides the value that was provided in the toolchain. Defining them as cache variables directly in the toolchain file is a possibility, but it is still not equivalent to defining them with While defining them in the generated CMake preset files would be great, that would limit the usability of this to users with the most recent versions of CMake. We will work on a proof of concept to pass variables in a way that is equivalent to |
* double-conversion: add version 3.2.1 Generated and committed by [Conan Center Bot](https://github.com/qchateau/conan-center-bot) Find more updatable recipes in the [GitHub Pages](https://qchateau.github.io/conan-center-bot/) * double-conversion: Drop PDBs from package dir * double-conversion: Fix shared build using workaround from conan-io/conan#11840 Co-authored-by: Quentin Chateau via Conan Center Bot <quentin.chateau@gmail.com>
* double-conversion: add version 3.2.1 Generated and committed by [Conan Center Bot](https://github.com/qchateau/conan-center-bot) Find more updatable recipes in the [GitHub Pages](https://qchateau.github.io/conan-center-bot/) * double-conversion: Drop PDBs from package dir * double-conversion: Fix shared build using workaround from conan-io/conan#11840 Co-authored-by: Quentin Chateau via Conan Center Bot <quentin.chateau@gmail.com>
This is required in 55 CCI recipes so far https://github.com/conan-io/conan-center-index/search?q=CMAKE_POLICY_DEFAULT_CMP0077&type= |
Environment Details (include every applicable attribute)
Steps to reproduce (Include if Applicable)
tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW"
from its conanfile.pyconan create . libccd/2.1@ -o libccd:shared=False
A shared lib is created instead of a static lib, while it was working fine with the conan v1 flavor of this recipe. If
CMAKE_POLICY_DEFAULT_CMP0077
is injected as a CMakeToolchaincache_variables
(by the way this name is super misleading, since CMakeToolchain variables are CMake cache variables, and CMakeToolchain cache_variables are CMakePresets cacheVariables), static lib is properly created.Explanation:
libccd
CMakeLists:cmake_minimum_required
is < 3.13: https://github.com/danfis/libccd/blob/v2.1/CMakeLists.txt#L1BUILD_SHARED_LIBS
is overridden as an option() defaulted to ON: https://github.com/danfis/libccd/blob/v2.1/CMakeLists.txt#L23Logs (Executed commands with output) (Include/Attach if Applicable)
Click to expand log
The text was updated successfully, but these errors were encountered: